From de22a5986734510c72ffbc9540d6660c7645673d Mon Sep 17 00:00:00 2001 From: Eugen Podaru Date: Tue, 12 Nov 2024 13:53:06 +0100 Subject: [PATCH] feat: switch the http client to ky --- package-lock.json | 3733 ++++++++++------- package.json | 13 +- .../rest.client.ts | 58 +- src/accounting-rates/rest.client.ts | 64 +- src/accounting-reports/rest.client.ts | 64 +- .../rest.client.ts | 65 +- src/api-consumers/rest.client.ts | 124 +- src/api-consumers/rest.type.ts | 47 +- .../schemas/api-consumer.schema.js | 2 +- .../schemas/get-all-response.schema.js | 2 +- src/api-keys-rotation/rest.client.ts | 53 +- src/application/rest.client.ts | 56 +- src/application/rest.type.ts | 3 + .../schemas/application-status.schema.js | 2 +- .../rest.client.ts | 65 +- src/background-process/rest.client.ts | 62 +- src/base-streaming.client.ts | 79 +- src/base-streaming.schema.ts | 7 +- src/branches-configuration/rest.client.ts | 65 +- src/branches/rest.client.ts | 70 +- src/bulks/rest.client.ts | 64 +- src/cards/rest.client.ts | 125 +- src/cards/rest.type.ts | 1 + .../schemas/get-card-transaction.schema.js | 2 +- src/centres-configuration/rest.client.ts | 65 +- src/centres/rest.client.ts | 62 +- src/client-documents/rest.client.ts | 120 +- src/client-documents/rest.type.ts | 33 + .../schemas/create-document-request.schema.js | 8 + src/client-roles-configuration/rest.client.ts | 65 +- src/clients.schema.ts | 9 +- src/clients/rest.client.ts | 133 +- src/comments/rest.client.ts | 64 +- src/communications/rest.client.ts | 104 +- src/credit-arrangements/rest.client.ts | 139 +- src/credit-arrangements/rest.type.ts | 22 + .../credit-arrangement-accounts.schema.js | 2 +- src/crons/rest.client.ts | 56 +- src/currencies-configuration/rest.client.ts | 65 +- src/currencies/rest.client.ts | 87 +- src/custom-field-sets/rest.client.ts | 62 +- .../rest.client.ts | 68 +- src/custom-fields/rest.client.ts | 56 +- src/data-import/rest.client.ts | 90 +- src/data-import/rest.type.ts | 25 + .../schemas/data-import-request.schema.js | 8 + src/database-backup/rest.client.ts | 67 +- src/deposit-accounts/rest.client.ts | 379 +- src/deposit-accounts/rest.type.ts | 54 + .../schemas/apply-interest-input.schema.js | 2 +- .../schemas/deposit-account.schema.js | 2 +- .../schemas/get-all-response.schema.js | 2 +- .../get-funded-loans-response.schema.js | 2 +- .../schemas/search-response.schema.js | 2 +- .../transfer-ownership-action.schema.js | 8 + .../rest.client.ts | 62 +- src/deposit-products/rest.client.ts | 103 +- src/deposit-products/rest.type.ts | 13 +- .../schemas/deposit-product.schema.js | 2 +- .../schemas/get-all-response.schema.js | 2 +- src/deposit-transactions/rest.client.ts | 178 +- src/deposit-transactions/rest.type.ts | 5 + .../schemas/deposit-transaction.schema.js | 2 +- .../schemas/get-all-response.schema.js | 2 +- .../schemas/search-response.schema.js | 2 +- src/documents/rest.client.ts | 118 +- src/documents/rest.type.ts | 54 + .../schemas/create-document-request.schema.js | 9 + .../rest.client.ts | 65 +- src/exchange-rate/index.ts | 2 + src/exchange-rate/rest.client.ts | 64 +- src/funding-sources/rest.client.ts | 58 +- src/funding-sources/rest.type.ts | 5 + .../schemas/sell-response.schema.js | 2 +- src/general-ledger-accounts/rest.client.ts | 78 +- src/general-setup/rest.client.ts | 56 +- src/general-setup/rest.type.ts | 1 + .../schemas/general-setup.schema.js | 2 +- .../rest.client.ts | 65 +- src/groups/rest.client.ts | 109 +- src/holidays-configuration/rest.client.ts | 65 +- src/id-templates/rest.client.ts | 56 +- .../rest.client.ts | 65 +- src/index-rate-sources/rest.client.ts | 102 +- src/index-rates-configuration/rest.client.ts | 65 +- src/index.ts | 1 + src/installments/rest.client.ts | 57 +- .../rest.client.ts | 65 +- src/journal-entries/rest.client.ts | 74 +- src/loan-account-schedule/rest.client.ts | 86 +- src/loan-account-tranches/rest.client.ts | 64 +- src/loan-accounts/rest.client.ts | 377 +- src/loan-accounts/rest.type.ts | 27 + .../schemas/apply-interest-input.schema.js | 2 +- .../apply-planned-fees-response.schema.js | 2 +- .../schemas/get-all-response.schema.js | 2 +- .../get-versions-by-id-response.schema.js | 2 +- .../loan-account-pay-off-input.schema.js | 2 +- .../schemas/loan-account.schema.js | 2 +- ...amounts-in-a-future-date-wrapper.schema.js | 2 +- .../refinance-loan-account-action.schema.js | 2 +- .../reschedule-loan-account-action.schema.js | 2 +- .../schemas/search-response.schema.js | 2 +- .../rest.client.ts | 62 +- src/loan-products/rest.client.ts | 95 +- src/loan-products/rest.type.ts | 15 +- .../schemas/get-all-response.schema.js | 2 +- .../schemas/loan-product.schema.js | 2 +- .../rest.client.ts | 65 +- src/loan-transactions/rest.client.ts | 204 +- src/loan-transactions/rest.type.ts | 55 + .../fee-loan-transaction-input.schema.js | 2 +- .../schemas/get-all-response.schema.js | 2 +- ...ctions-for-all-versions-response.schema.js | 2 +- .../schemas/loan-transaction.schema.js | 2 +- .../lock-loan-transactions-wrapper.schema.js | 2 +- .../refund-loan-transaction-input.schema.js | 8 + ...repayment-loan-transaction-input.schema.js | 2 +- .../schemas/search-response.schema.js | 2 +- .../rest.client.ts | 65 +- src/organization-configuration/rest.client.ts | 68 +- src/organization-details/rest.client.ts | 64 +- .../rest.client.ts | 73 +- src/organization-holidays/rest.client.ts | 64 +- .../rest.client.ts | 64 +- src/streaming.ts | 19 +- src/tasks/rest.client.ts | 95 +- .../rest.client.ts | 65 +- src/transaction-channels/rest.client.ts | 87 +- src/user-roles-configuration/rest.client.ts | 68 +- src/user-roles/rest.client.ts | 95 +- src/user-roles/rest.type.ts | 47 +- .../schemas/get-all-response.schema.js | 2 +- src/user-roles/schemas/role.schema.js | 2 +- src/users/rest.client.ts | 95 +- src/users/rest.type.ts | 49 +- src/users/schemas/get-all-response.schema.js | 2 +- src/users/schemas/user.schema.js | 2 +- src/users/schemas/user_request.schema.js | 2 +- 139 files changed, 6202 insertions(+), 4218 deletions(-) create mode 100644 src/client-documents/schemas/create-document-request.schema.js create mode 100644 src/data-import/schemas/data-import-request.schema.js create mode 100644 src/deposit-accounts/schemas/transfer-ownership-action.schema.js create mode 100644 src/documents/schemas/create-document-request.schema.js create mode 100644 src/exchange-rate/index.ts create mode 100644 src/loan-transactions/schemas/refund-loan-transaction-input.schema.js diff --git a/package-lock.json b/package-lock.json index 840c99d..f813d3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,20 +13,20 @@ "split2": "^4.2.0" }, "devDependencies": { - "@skyleague/axioms": "^4.3.4", - "@skyleague/node-standards": "^7.1.0", - "@skyleague/therefore": "^5.8.8", + "@skyleague/axioms": "^4.5.2", + "@skyleague/node-standards": "^8.2.4", + "@skyleague/therefore": "^5.18.0", "@types/split2": "^4.2.3", "camelcase": "^8.0.0", - "got": "^14.3.0", - "nock": "^13.5.4", + "ky": "^1.7.2", + "nock": "^14.0.0-beta.15", "typescript": "^5.4.5" }, "engines": { "node": ">=20" }, "peerDependencies": { - "got": "^14.3.0" + "ky": "^1.7.2" } }, "node_modules/@ampproject/remapping": { @@ -34,6 +34,7 @@ "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" @@ -56,19 +57,21 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz", - "integrity": "sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", - "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -145,10 +148,14 @@ } }, "node_modules/@babel/parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", - "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.2.tgz", + "integrity": "sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.26.0" + }, "bin": { "parser": "bin/babel-parser.js" }, @@ -157,14 +164,14 @@ } }, "node_modules/@babel/types": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", - "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.0.tgz", + "integrity": "sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.24.7", - "@babel/helper-validator-identifier": "^7.24.7", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -174,14 +181,16 @@ "version": "0.2.3", "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@biomejs/biome": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.8.0.tgz", - "integrity": "sha512-34xcE2z8GWrIz1sCFEmlHT/+4d+SN7YOqqvzlAKXKvaWPRJ2/NUwxPbRsP01P9QODkQ5bvGvc9rpBihmP+7RJQ==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz", + "integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==", "dev": true, "hasInstallScript": true, + "license": "MIT OR Apache-2.0", "bin": { "biome": "bin/biome" }, @@ -193,24 +202,25 @@ "url": "https://opencollective.com/biome" }, "optionalDependencies": { - "@biomejs/cli-darwin-arm64": "1.8.0", - "@biomejs/cli-darwin-x64": "1.8.0", - "@biomejs/cli-linux-arm64": "1.8.0", - "@biomejs/cli-linux-arm64-musl": "1.8.0", - "@biomejs/cli-linux-x64": "1.8.0", - "@biomejs/cli-linux-x64-musl": "1.8.0", - "@biomejs/cli-win32-arm64": "1.8.0", - "@biomejs/cli-win32-x64": "1.8.0" + "@biomejs/cli-darwin-arm64": "1.9.4", + "@biomejs/cli-darwin-x64": "1.9.4", + "@biomejs/cli-linux-arm64": "1.9.4", + "@biomejs/cli-linux-arm64-musl": "1.9.4", + "@biomejs/cli-linux-x64": "1.9.4", + "@biomejs/cli-linux-x64-musl": "1.9.4", + "@biomejs/cli-win32-arm64": "1.9.4", + "@biomejs/cli-win32-x64": "1.9.4" } }, "node_modules/@biomejs/cli-darwin-arm64": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.8.0.tgz", - "integrity": "sha512-dBAYzfIJ1JmWigKlWourT3sJ3I60LZPjqNwwlsyFjiv5AV7vPeWlHVVIImV2BpINwNjZQhpXnwDfVnGS4vr7AA==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz", + "integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT OR Apache-2.0", "optional": true, "os": [ "darwin" @@ -220,13 +230,14 @@ } }, "node_modules/@biomejs/cli-darwin-x64": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.8.0.tgz", - "integrity": "sha512-ZTTSD0bP0nn9UpRDGQrQNTILcYSj+IkxTYr3CAV64DWBDtQBomlk2oVKWzDaA1LOhpAsTh0giLCbPJaVk2jfMQ==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz", + "integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT OR Apache-2.0", "optional": true, "os": [ "darwin" @@ -236,13 +247,14 @@ } }, "node_modules/@biomejs/cli-linux-arm64": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.8.0.tgz", - "integrity": "sha512-cx725jTlJS6dskvJJwwCQaaMRBKE2Qss7ukzmx27Rn/DXRxz6tnnBix4FUGPf1uZfwrERkiJlbWM05JWzpvvXg==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz", + "integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT OR Apache-2.0", "optional": true, "os": [ "linux" @@ -252,13 +264,14 @@ } }, "node_modules/@biomejs/cli-linux-arm64-musl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.8.0.tgz", - "integrity": "sha512-+ee/pZWsvhDv6eRI00krRNSgAg8DKSxzOv3LUsCjto6N1VzqatTASeQv2HRfG1nitf79rRKM75LkMJbqEfiKww==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz", + "integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT OR Apache-2.0", "optional": true, "os": [ "linux" @@ -268,13 +281,14 @@ } }, "node_modules/@biomejs/cli-linux-x64": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.8.0.tgz", - "integrity": "sha512-cmgmhlD4QUxMhL1VdaNqnB81xBHb3R7huVNyYnPYzP+AykZ7XqJbPd1KcWAszNjUk2AHdx0aLKEBwCOWemxb2g==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz", + "integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT OR Apache-2.0", "optional": true, "os": [ "linux" @@ -284,13 +298,14 @@ } }, "node_modules/@biomejs/cli-linux-x64-musl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.8.0.tgz", - "integrity": "sha512-VPA4ocrAOak50VYl8gOAVnjuFFDpIUolShntc/aWM0pZfSIMbRucxnrfUfp44EVwayxjK6ruJTR5xEWj93WvDA==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz", + "integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT OR Apache-2.0", "optional": true, "os": [ "linux" @@ -300,13 +315,14 @@ } }, "node_modules/@biomejs/cli-win32-arm64": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.8.0.tgz", - "integrity": "sha512-J31spvlh39FfRHQacYXxJX9PvTCH/a8+2Jx9D1lxw+LSF0JybqZcw/4JrlFUWUl4kF3yv8AuYUK0sENScc3g9w==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz", + "integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT OR Apache-2.0", "optional": true, "os": [ "win32" @@ -316,13 +332,14 @@ } }, "node_modules/@biomejs/cli-win32-x64": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.8.0.tgz", - "integrity": "sha512-uPHHvu76JC1zYe9zZDcOU9PAg+1MZmPuNgWkb5jljaDeATvzLFPB+0nuJTilf603LXL+E8IdPQAO61Wy2VuEJA==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz", + "integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT OR Apache-2.0", "optional": true, "os": [ "win32" @@ -331,34 +348,6 @@ "node": ">=14.21.3" } }, - "node_modules/@biomejs/js-api": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@biomejs/js-api/-/js-api-0.6.0.tgz", - "integrity": "sha512-23+BQd6BeFIAkovD/tOaBzKU3XANndQzdVlMp2L6nA0DPC+VoCsIgcJ+ZltDyHdV82edQXUBrLIfrqN7a2rA2Q==", - "dev": true, - "peerDependencies": { - "@biomejs/wasm-bundler": "^1.7.2", - "@biomejs/wasm-nodejs": "^1.7.2", - "@biomejs/wasm-web": "^1.7.2" - }, - "peerDependenciesMeta": { - "@biomejs/wasm-bundler": { - "optional": true - }, - "@biomejs/wasm-nodejs": { - "optional": true - }, - "@biomejs/wasm-web": { - "optional": true - } - } - }, - "node_modules/@biomejs/wasm-nodejs": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/@biomejs/wasm-nodejs/-/wasm-nodejs-1.7.3.tgz", - "integrity": "sha512-O18tSf8Af7gBmSPXLztHSVKpM92uIJnG0cb/lFe0uB78FwW+LckHfYX61bLRT7gKrh+2VzYNHcChJ6AbTfGiBA==", - "dev": true - }, "node_modules/@colors/colors": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", @@ -370,17 +359,18 @@ } }, "node_modules/@commitlint/cli": { - "version": "19.3.0", - "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-19.3.0.tgz", - "integrity": "sha512-LgYWOwuDR7BSTQ9OLZ12m7F/qhNY+NpAyPBgo4YNMkACE7lGuUnuQq1yi9hz1KA4+3VqpOYl8H1rY/LYK43v7g==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-19.5.0.tgz", + "integrity": "sha512-gaGqSliGwB86MDmAAKAtV9SV1SHdmN8pnGq4EJU4+hLisQ7IFfx4jvU4s+pk6tl0+9bv6yT+CaZkufOinkSJIQ==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/format": "^19.3.0", - "@commitlint/lint": "^19.2.2", - "@commitlint/load": "^19.2.0", - "@commitlint/read": "^19.2.1", - "@commitlint/types": "^19.0.3", - "execa": "^8.0.1", + "@commitlint/format": "^19.5.0", + "@commitlint/lint": "^19.5.0", + "@commitlint/load": "^19.5.0", + "@commitlint/read": "^19.5.0", + "@commitlint/types": "^19.5.0", + "tinyexec": "^0.3.0", "yargs": "^17.0.0" }, "bin": { @@ -391,12 +381,13 @@ } }, "node_modules/@commitlint/config-conventional": { - "version": "19.2.2", - "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-19.2.2.tgz", - "integrity": "sha512-mLXjsxUVLYEGgzbxbxicGPggDuyWNkf25Ht23owXIH+zV2pv1eJuzLK3t1gDY5Gp6pxdE60jZnWUY5cvgL3ufw==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-19.5.0.tgz", + "integrity": "sha512-OBhdtJyHNPryZKg0fFpZNOBM1ZDbntMvqMuSmpfyP86XSfwzGw4CaoYRG4RutUPg0BTK07VMRIkNJT6wi2zthg==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/types": "^19.0.3", + "@commitlint/types": "^19.5.0", "conventional-changelog-conventionalcommits": "^7.0.2" }, "engines": { @@ -404,12 +395,13 @@ } }, "node_modules/@commitlint/config-validator": { - "version": "19.0.3", - "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-19.0.3.tgz", - "integrity": "sha512-2D3r4PKjoo59zBc2auodrSCaUnCSALCx54yveOFwwP/i2kfEAQrygwOleFWswLqK0UL/F9r07MFi5ev2ohyM4Q==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-19.5.0.tgz", + "integrity": "sha512-CHtj92H5rdhKt17RmgALhfQt95VayrUo2tSqY9g2w+laAXyk7K/Ef6uPm9tn5qSIwSmrLjKaXK9eiNuxmQrDBw==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/types": "^19.0.3", + "@commitlint/types": "^19.5.0", "ajv": "^8.11.0" }, "engines": { @@ -417,12 +409,13 @@ } }, "node_modules/@commitlint/ensure": { - "version": "19.0.3", - "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-19.0.3.tgz", - "integrity": "sha512-SZEpa/VvBLoT+EFZVb91YWbmaZ/9rPH3ESrINOl0HD2kMYsjvl0tF7nMHh0EpTcv4+gTtZBAe1y/SS6/OhfZzQ==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-19.5.0.tgz", + "integrity": "sha512-Kv0pYZeMrdg48bHFEU5KKcccRfKmISSm9MvgIgkpI6m+ohFTB55qZlBW6eYqh/XDfRuIO0x4zSmvBjmOwWTwkg==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/types": "^19.0.3", + "@commitlint/types": "^19.5.0", "lodash.camelcase": "^4.3.0", "lodash.kebabcase": "^4.1.1", "lodash.snakecase": "^4.1.1", @@ -434,21 +427,23 @@ } }, "node_modules/@commitlint/execute-rule": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-19.0.0.tgz", - "integrity": "sha512-mtsdpY1qyWgAO/iOK0L6gSGeR7GFcdW7tIjcNFxcWkfLDF5qVbPHKuGATFqRMsxcO8OUKNj0+3WOHB7EHm4Jdw==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-19.5.0.tgz", + "integrity": "sha512-aqyGgytXhl2ejlk+/rfgtwpPexYyri4t8/n4ku6rRJoRhGZpLFMqrZ+YaubeGysCP6oz4mMA34YSTaSOKEeNrg==", "dev": true, + "license": "MIT", "engines": { "node": ">=v18" } }, "node_modules/@commitlint/format": { - "version": "19.3.0", - "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-19.3.0.tgz", - "integrity": "sha512-luguk5/aF68HiF4H23ACAfk8qS8AHxl4LLN5oxPc24H+2+JRPsNr1OS3Gaea0CrH7PKhArBMKBz5RX9sA5NtTg==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-19.5.0.tgz", + "integrity": "sha512-yNy088miE52stCI3dhG/vvxFo9e4jFkU1Mj3xECfzp/bIS/JUay4491huAlVcffOoMK1cd296q0W92NlER6r3A==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/types": "^19.0.3", + "@commitlint/types": "^19.5.0", "chalk": "^5.3.0" }, "engines": { @@ -456,12 +451,13 @@ } }, "node_modules/@commitlint/is-ignored": { - "version": "19.2.2", - "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-19.2.2.tgz", - "integrity": "sha512-eNX54oXMVxncORywF4ZPFtJoBm3Tvp111tg1xf4zWXGfhBPKpfKG6R+G3G4v5CPlRROXpAOpQ3HMhA9n1Tck1g==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-19.5.0.tgz", + "integrity": "sha512-0XQ7Llsf9iL/ANtwyZ6G0NGp5Y3EQ8eDQSxv/SRcfJ0awlBY4tHFAvwWbw66FVUaWICH7iE5en+FD9TQsokZ5w==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/types": "^19.0.3", + "@commitlint/types": "^19.5.0", "semver": "^7.6.0" }, "engines": { @@ -469,30 +465,32 @@ } }, "node_modules/@commitlint/lint": { - "version": "19.2.2", - "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-19.2.2.tgz", - "integrity": "sha512-xrzMmz4JqwGyKQKTpFzlN0dx0TAiT7Ran1fqEBgEmEj+PU98crOFtysJgY+QdeSagx6EDRigQIXJVnfrI0ratA==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-19.5.0.tgz", + "integrity": "sha512-cAAQwJcRtiBxQWO0eprrAbOurtJz8U6MgYqLz+p9kLElirzSCc0vGMcyCaA1O7AqBuxo11l1XsY3FhOFowLAAg==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/is-ignored": "^19.2.2", - "@commitlint/parse": "^19.0.3", - "@commitlint/rules": "^19.0.3", - "@commitlint/types": "^19.0.3" + "@commitlint/is-ignored": "^19.5.0", + "@commitlint/parse": "^19.5.0", + "@commitlint/rules": "^19.5.0", + "@commitlint/types": "^19.5.0" }, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/load": { - "version": "19.2.0", - "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-19.2.0.tgz", - "integrity": "sha512-XvxxLJTKqZojCxaBQ7u92qQLFMMZc4+p9qrIq/9kJDy8DOrEa7P1yx7Tjdc2u2JxIalqT4KOGraVgCE7eCYJyQ==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-19.5.0.tgz", + "integrity": "sha512-INOUhkL/qaKqwcTUvCE8iIUf5XHsEPCLY9looJ/ipzi7jtGhgmtH7OOFiNvwYgH7mA8osUWOUDV8t4E2HAi4xA==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/config-validator": "^19.0.3", - "@commitlint/execute-rule": "^19.0.0", - "@commitlint/resolve-extends": "^19.1.0", - "@commitlint/types": "^19.0.3", + "@commitlint/config-validator": "^19.5.0", + "@commitlint/execute-rule": "^19.5.0", + "@commitlint/resolve-extends": "^19.5.0", + "@commitlint/types": "^19.5.0", "chalk": "^5.3.0", "cosmiconfig": "^9.0.0", "cosmiconfig-typescript-loader": "^5.0.0", @@ -505,21 +503,23 @@ } }, "node_modules/@commitlint/message": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-19.0.0.tgz", - "integrity": "sha512-c9czf6lU+9oF9gVVa2lmKaOARJvt4soRsVmbR7Njwp9FpbBgste5i7l/2l5o8MmbwGh4yE1snfnsy2qyA2r/Fw==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-19.5.0.tgz", + "integrity": "sha512-R7AM4YnbxN1Joj1tMfCyBryOC5aNJBdxadTZkuqtWi3Xj0kMdutq16XQwuoGbIzL2Pk62TALV1fZDCv36+JhTQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=v18" } }, "node_modules/@commitlint/parse": { - "version": "19.0.3", - "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-19.0.3.tgz", - "integrity": "sha512-Il+tNyOb8VDxN3P6XoBBwWJtKKGzHlitEuXA5BP6ir/3loWlsSqDr5aecl6hZcC/spjq4pHqNh0qPlfeWu38QA==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-19.5.0.tgz", + "integrity": "sha512-cZ/IxfAlfWYhAQV0TwcbdR1Oc0/r0Ik1GEessDJ3Lbuma/MRO8FRQX76eurcXtmhJC//rj52ZSZuXUg0oIX0Fw==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/types": "^19.0.3", + "@commitlint/types": "^19.5.0", "conventional-changelog-angular": "^7.0.0", "conventional-commits-parser": "^5.0.0" }, @@ -528,29 +528,31 @@ } }, "node_modules/@commitlint/read": { - "version": "19.2.1", - "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-19.2.1.tgz", - "integrity": "sha512-qETc4+PL0EUv7Q36lJbPG+NJiBOGg7SSC7B5BsPWOmei+Dyif80ErfWQ0qXoW9oCh7GTpTNRoaVhiI8RbhuaNw==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-19.5.0.tgz", + "integrity": "sha512-TjS3HLPsLsxFPQj6jou8/CZFAmOP2y+6V4PGYt3ihbQKTY1Jnv0QG28WRKl/d1ha6zLODPZqsxLEov52dhR9BQ==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/top-level": "^19.0.0", - "@commitlint/types": "^19.0.3", - "execa": "^8.0.1", + "@commitlint/top-level": "^19.5.0", + "@commitlint/types": "^19.5.0", "git-raw-commits": "^4.0.0", - "minimist": "^1.2.8" + "minimist": "^1.2.8", + "tinyexec": "^0.3.0" }, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/resolve-extends": { - "version": "19.1.0", - "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-19.1.0.tgz", - "integrity": "sha512-z2riI+8G3CET5CPgXJPlzftH+RiWYLMYv4C9tSLdLXdr6pBNimSKukYP9MS27ejmscqCTVA4almdLh0ODD2KYg==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-19.5.0.tgz", + "integrity": "sha512-CU/GscZhCUsJwcKTJS9Ndh3AKGZTNFIOoQB2n8CmFnizE0VnEuJoum+COW+C1lNABEeqk6ssfc1Kkalm4bDklA==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/config-validator": "^19.0.3", - "@commitlint/types": "^19.0.3", + "@commitlint/config-validator": "^19.5.0", + "@commitlint/types": "^19.5.0", "global-directory": "^4.0.1", "import-meta-resolve": "^4.0.0", "lodash.mergewith": "^4.6.2", @@ -561,35 +563,37 @@ } }, "node_modules/@commitlint/rules": { - "version": "19.0.3", - "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-19.0.3.tgz", - "integrity": "sha512-TspKb9VB6svklxNCKKwxhELn7qhtY1rFF8ls58DcFd0F97XoG07xugPjjbVnLqmMkRjZDbDIwBKt9bddOfLaPw==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-19.5.0.tgz", + "integrity": "sha512-hDW5TPyf/h1/EufSHEKSp6Hs+YVsDMHazfJ2azIk9tHPXS6UqSz1dIRs1gpqS3eMXgtkT7JH6TW4IShdqOwhAw==", "dev": true, + "license": "MIT", "dependencies": { - "@commitlint/ensure": "^19.0.3", - "@commitlint/message": "^19.0.0", - "@commitlint/to-lines": "^19.0.0", - "@commitlint/types": "^19.0.3", - "execa": "^8.0.1" + "@commitlint/ensure": "^19.5.0", + "@commitlint/message": "^19.5.0", + "@commitlint/to-lines": "^19.5.0", + "@commitlint/types": "^19.5.0" }, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/to-lines": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-19.0.0.tgz", - "integrity": "sha512-vkxWo+VQU5wFhiP9Ub9Sre0FYe019JxFikrALVoD5UGa8/t3yOJEpEhxC5xKiENKKhUkTpEItMTRAjHw2SCpZw==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-19.5.0.tgz", + "integrity": "sha512-R772oj3NHPkodOSRZ9bBVNq224DOxQtNef5Pl8l2M8ZnkkzQfeSTr4uxawV2Sd3ui05dUVzvLNnzenDBO1KBeQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=v18" } }, "node_modules/@commitlint/top-level": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-19.0.0.tgz", - "integrity": "sha512-KKjShd6u1aMGNkCkaX4aG1jOGdn7f8ZI8TR1VEuNqUOjWTOdcDSsmglinglJ18JTjuBX5I1PtjrhQCRcixRVFQ==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-19.5.0.tgz", + "integrity": "sha512-IP1YLmGAk0yWrImPRRc578I3dDUI5A2UBJx9FbSOjxe9sTlzFiwVJ+zeMLgAtHMtGZsC8LUnzmW1qRemkFU4ng==", "dev": true, + "license": "MIT", "dependencies": { "find-up": "^7.0.0" }, @@ -598,10 +602,11 @@ } }, "node_modules/@commitlint/types": { - "version": "19.0.3", - "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-19.0.3.tgz", - "integrity": "sha512-tpyc+7i6bPG9mvaBbtKUeghfyZSDgWquIDfMgqYtTbmZ9Y9VzEm2je9EYcQ0aoz5o7NvGS+rcDec93yO08MHYA==", + "version": "19.5.0", + "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-19.5.0.tgz", + "integrity": "sha512-DSHae2obMSMkAtTBSOulg5X7/z+rGLxcXQIkg3OmWvY6wifojge5uVMydfhUvs7yQj+V7jNmRZ2Xzl8GJyqRgg==", "dev": true, + "license": "MIT", "dependencies": { "@types/conventional-commits-parser": "^5.0.0", "chalk": "^5.3.0" @@ -611,371 +616,411 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.4.tgz", - "integrity": "sha512-Zrm+B33R4LWPLjDEVnEqt2+SLTATlru1q/xYKVn8oVTbiRBGmK2VIMoIYGJDGyftnGaC788IuzGFAlb7IQ0Y8A==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", + "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "aix" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-arm": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.4.tgz", - "integrity": "sha512-E7H/yTd8kGQfY4z9t3nRPk/hrhaCajfA3YSQSBrst8B+3uTcgsi8N+ZWYCaeIDsiVs6m65JPCaQN/DxBRclF3A==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", + "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-arm64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.4.tgz", - "integrity": "sha512-fYFnz+ObClJ3dNiITySBUx+oNalYUT18/AryMxfovLkYWbutXsct3Wz2ZWAcGGppp+RVVX5FiXeLYGi97umisA==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", + "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-x64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.4.tgz", - "integrity": "sha512-mDqmlge3hFbEPbCWxp4fM6hqq7aZfLEHZAKGP9viq9wMUBVQx202aDIfc3l+d2cKhUJM741VrCXEzRFhPDKH3Q==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", + "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.4.tgz", - "integrity": "sha512-72eaIrDZDSiWqpmCzVaBD58c8ea8cw/U0fq/PPOTqE3c53D0xVMRt2ooIABZ6/wj99Y+h4ksT/+I+srCDLU9TA==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", + "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.4.tgz", - "integrity": "sha512-uBsuwRMehGmw1JC7Vecu/upOjTsMhgahmDkWhGLWxIgUn2x/Y4tIwUZngsmVb6XyPSTXJYS4YiASKPcm9Zitag==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", + "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.4.tgz", - "integrity": "sha512-8JfuSC6YMSAEIZIWNL3GtdUT5NhUA/CMUCpZdDRolUXNAXEE/Vbpe6qlGLpfThtY5NwXq8Hi4nJy4YfPh+TwAg==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", + "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.4.tgz", - "integrity": "sha512-8d9y9eQhxv4ef7JmXny7591P/PYsDFc4+STaxC1GBv0tMyCdyWfXu2jBuqRsyhY8uL2HU8uPyscgE2KxCY9imQ==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", + "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-arm": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.4.tgz", - "integrity": "sha512-2rqFFefpYmpMs+FWjkzSgXg5vViocqpq5a1PSRgT0AvSgxoXmGF17qfGAzKedg6wAwyM7UltrKVo9kxaJLMF/g==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", + "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.4.tgz", - "integrity": "sha512-/GLD2orjNU50v9PcxNpYZi+y8dJ7e7/LhQukN3S4jNDXCKkyyiyAz9zDw3siZ7Eh1tRcnCHAo/WcqKMzmi4eMQ==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", + "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.4.tgz", - "integrity": "sha512-pNftBl7m/tFG3t2m/tSjuYeWIffzwAZT9m08+9DPLizxVOsUl8DdFzn9HvJrTQwe3wvJnwTdl92AonY36w/25g==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", + "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.4.tgz", - "integrity": "sha512-cSD2gzCK5LuVX+hszzXQzlWya6c7hilO71L9h4KHwqI4qeqZ57bAtkgcC2YioXjsbfAv4lPn3qe3b00Zt+jIfQ==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", + "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", "cpu": [ "loong64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.4.tgz", - "integrity": "sha512-qtzAd3BJh7UdbiXCrg6npWLYU0YpufsV9XlufKhMhYMJGJCdfX/G6+PNd0+v877X1JG5VmjBLUiFB0o8EUSicA==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", + "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", "cpu": [ "mips64el" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.4.tgz", - "integrity": "sha512-yB8AYzOTaL0D5+2a4xEy7OVvbcypvDR05MsB/VVPVA7nL4hc5w5Dyd/ddnayStDgJE59fAgNEOdLhBxjfx5+dg==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", + "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.4.tgz", - "integrity": "sha512-Y5AgOuVzPjQdgU59ramLoqSSiXddu7F3F+LI5hYy/d1UHN7K5oLzYBDZe23QmQJ9PIVUXwOdKJ/jZahPdxzm9w==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", + "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", "cpu": [ "riscv64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.4.tgz", - "integrity": "sha512-Iqc/l/FFwtt8FoTK9riYv9zQNms7B8u+vAI/rxKuN10HgQIXaPzKZc479lZ0x6+vKVQbu55GdpYpeNWzjOhgbA==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", + "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", "cpu": [ "s390x" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-x64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.4.tgz", - "integrity": "sha512-Td9jv782UMAFsuLZINfUpoF5mZIbAj+jv1YVtE58rFtfvoKRiKSkRGQfHTgKamLVT/fO7203bHa3wU122V/Bdg==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", + "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.4.tgz", - "integrity": "sha512-Awn38oSXxsPMQxaV0Ipb7W/gxZtk5Tx3+W+rAPdZkyEhQ6968r9NvtkjhnhbEgWXYbgV+JEONJ6PcdBS+nlcpA==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", + "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "netbsd" ], "engines": { - "node": ">=12" + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", + "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.4.tgz", - "integrity": "sha512-IsUmQeCY0aU374R82fxIPu6vkOybWIMc3hVGZ3ChRwL9hA1TwY+tS0lgFWV5+F1+1ssuvvXt3HFqe8roCip8Hg==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", + "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "openbsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.4.tgz", - "integrity": "sha512-hsKhgZ4teLUaDA6FG/QIu2q0rI6I36tZVfM4DBZv3BG0mkMIdEnMbhc4xwLvLJSS22uWmaVkFkqWgIS0gPIm+A==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", + "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "sunos" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.4.tgz", - "integrity": "sha512-UUfMgMoXPoA/bvGUNfUBFLCh0gt9dxZYIx9W4rfJr7+hKe5jxxHmfOK8YSH4qsHLLN4Ck8JZ+v7Q5fIm1huErg==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", + "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.4.tgz", - "integrity": "sha512-yIxbspZb5kGCAHWm8dexALQ9en1IYDfErzjSEq1KzXFniHv019VT3mNtTK7t8qdy4TwT6QYHI9sEZabONHg+aw==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", + "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-x64": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.4.tgz", - "integrity": "sha512-sywLRD3UK/qRJt0oBwdpYLBibk7KiRfbswmWRDabuncQYSlf8aLEEUor/oP6KRz8KEG+HoiVLBhPRD5JWjS8Sg==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", + "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@exodus/schemasafe": { @@ -993,25 +1038,104 @@ "node": ">=10.13.0" } }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, "engines": { - "node": ">=8" + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/@jest/schemas": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", - "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, + "license": "MIT", "dependencies": { - "@sinclair/typebox": "^0.27.8" + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "license": "MIT", "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">=8" } }, "node_modules/@jridgewell/gen-mapping": { @@ -1019,6 +1143,7 @@ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", @@ -1033,6 +1158,7 @@ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } @@ -1042,26 +1168,47 @@ "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@mswjs/interceptors": { + "version": "0.36.10", + "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.36.10.tgz", + "integrity": "sha512-GXrJgakgJW3DWKueebkvtYgGKkxA7s0u5B0P5syJM5rvQUnrpLPigvci8Hukl7yEM+sU06l+er2Fgvx/gmiRgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@open-draft/deferred-promise": "^2.2.0", + "@open-draft/logger": "^0.3.0", + "@open-draft/until": "^2.0.0", + "is-node-process": "^1.2.0", + "outvariant": "^1.4.3", + "strict-event-emitter": "^0.5.1" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1102,6 +1249,7 @@ "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.1.tgz", "integrity": "sha512-rh3G3wDO8J9wSjfI436JUKzHIxq8NaiL0tVeB2aXmG6p/9859aUOAjA9pmSPNGGZxfwmaJ9ozOJImuNVJdpvbA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 18" } @@ -1111,6 +1259,7 @@ "resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.2.tgz", "integrity": "sha512-hEb7Ma4cGJGEUNOAVmyfdB/3WirWMg5hDuNFVejGEDFqupeOysLc2sG6HJxY2etBp5YQu5Wtxwi020jS9xlUwg==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/auth-token": "^5.0.0", "@octokit/graphql": "^8.0.0", @@ -1129,6 +1278,7 @@ "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.1.tgz", "integrity": "sha512-JYjh5rMOwXMJyUpj028cu0Gbp7qe/ihxfJMLc8VZBMMqSwLgOxDI1911gV4Enl1QSavAQNJcwmwBF9M0VvLh6Q==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/types": "^13.0.0", "universal-user-agent": "^7.0.2" @@ -1142,6 +1292,7 @@ "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-8.1.1.tgz", "integrity": "sha512-ukiRmuHTi6ebQx/HFRCXKbDlOh/7xEV6QUXaE7MJEKGNAncGI/STSbOkl12qVXZrfZdpXctx5O9X1AIaebiDBg==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/request": "^9.0.0", "@octokit/types": "^13.0.0", @@ -1152,18 +1303,20 @@ } }, "node_modules/@octokit/openapi-types": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.1.0.tgz", - "integrity": "sha512-pGUdSP+eEPfZiQHNkZI0U01HLipxncisdJQB4G//OAmfeO8sqTQ9KRa0KF03TUPCziNsoXUrTg4B2Q1EX++T0Q==", - "dev": true + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", + "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==", + "dev": true, + "license": "MIT" }, "node_modules/@octokit/plugin-paginate-rest": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.1.1.tgz", - "integrity": "sha512-joUIZu9TupD4pRXLmWShD1Ur/oxYf/bJjYcnaopmGTReNrmWwcW7DUGSrWOjoTeihnlDig+a79m8koiafc4XQw==", + "version": "11.3.5", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.3.5.tgz", + "integrity": "sha512-cgwIRtKrpwhLoBi0CUNuY83DPGRMaWVjqVI/bGKsLJ4PzyWZNaEmhHroI2xlrVXkk6nFv0IsZpOp+ZWSWUS2AQ==", "dev": true, + "license": "MIT", "dependencies": { - "@octokit/types": "^13.4.0" + "@octokit/types": "^13.6.0" }, "engines": { "node": ">= 18" @@ -1173,10 +1326,11 @@ } }, "node_modules/@octokit/plugin-retry": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-7.1.0.tgz", - "integrity": "sha512-6mc4xNtT6eoDBGrJJn0sFALUmIba2f7Wx+G8XV9GkBLcyX5PogBdx2mDMW5yPPqSD/y23tYagkjOLX9sT7O6jA==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-7.1.2.tgz", + "integrity": "sha512-XOWnPpH2kJ5VTwozsxGurw+svB2e61aWlmk5EVIYZPwFK5F9h4cyPyj9CIKRyMXMHSwpIsI3mPOdpMmrRhe7UQ==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/request-error": "^6.0.0", "@octokit/types": "^13.0.0", @@ -1190,10 +1344,11 @@ } }, "node_modules/@octokit/plugin-throttling": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-9.2.0.tgz", - "integrity": "sha512-zHZSZCC7wk3HbK3ZCuvc3iPrnFGoYIVJsJAY4l8ilsVu4fqPfe7BP7QLZ1A641yttLWqgy2oID3ETD3Z1036Gw==", + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-9.3.2.tgz", + "integrity": "sha512-FqpvcTpIWFpMMwIeSoypoJXysSAQ3R+ALJhXXSG1HTP3YZOIeLmcNcimKaXxTcws+Sh6yoRl13SJ5r8sXc1Fhw==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/types": "^13.0.0", "bottleneck": "^2.15.3" @@ -1206,10 +1361,11 @@ } }, "node_modules/@octokit/request": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.1.1.tgz", - "integrity": "sha512-pyAguc0p+f+GbQho0uNetNQMmLG1e80WjkIaqqgUkihqUp0boRU6nKItXO4VWnr+nbZiLGEyy4TeKRwqaLvYgw==", + "version": "9.1.3", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.1.3.tgz", + "integrity": "sha512-V+TFhu5fdF3K58rs1pGUJIDH5RZLbZm5BI+MNF+6o/ssFNT4vWlCh/tVpF3NxGtP15HUxTTMUbsG5llAuU2CZA==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/endpoint": "^10.0.0", "@octokit/request-error": "^6.0.1", @@ -1221,10 +1377,11 @@ } }, "node_modules/@octokit/request-error": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.1.tgz", - "integrity": "sha512-1mw1gqT3fR/WFvnoVpY/zUM2o/XkMs/2AszUUG9I69xn0JFLv6PGkPhNk5lbfvROs79wiS0bqiJNxfCZcRJJdg==", + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.5.tgz", + "integrity": "sha512-IlBTfGX8Yn/oFPMwSfvugfncK2EwRLjzbrpifNaMY8o/HTEAFqCA1FZxjD9cWvSKBHgrIhc4CSBIzMxiLsbzFQ==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/types": "^13.0.0" }, @@ -1233,12 +1390,49 @@ } }, "node_modules/@octokit/types": { - "version": "13.4.1", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.4.1.tgz", - "integrity": "sha512-Y73oOAzRBAUzR/iRAbGULzpNkX8vaxKCqEtg6K74Ff3w9f5apFnWtE/2nade7dMWWW3bS5Kkd6DJS4HF04xreg==", + "version": "13.6.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.6.1.tgz", + "integrity": "sha512-PHZE9Z+kWXb23Ndik8MKPirBPziOc0D2/3KH1P+6jK5nGWe96kadZuE4jev2/Jq7FvIfTlT2Ltg8Fv2x1v0a5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^22.2.0" + } + }, + "node_modules/@open-draft/deferred-promise": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz", + "integrity": "sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@open-draft/logger": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@open-draft/logger/-/logger-0.3.0.tgz", + "integrity": "sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==", "dev": true, + "license": "MIT", "dependencies": { - "@octokit/openapi-types": "^22.1.0" + "is-node-process": "^1.2.0", + "outvariant": "^1.4.0" + } + }, + "node_modules/@open-draft/until": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@open-draft/until/-/until-2.1.0.tgz", + "integrity": "sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" } }, "node_modules/@pnpm/config.env-replace": { @@ -1283,208 +1477,252 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", - "integrity": "sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.25.0.tgz", + "integrity": "sha512-CC/ZqFZwlAIbU1wUPisHyV/XRc5RydFrNLtgl3dGYskdwPZdt4HERtKm50a/+DtTlKeCq9IXFEWR+P6blwjqBA==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz", - "integrity": "sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.25.0.tgz", + "integrity": "sha512-/Y76tmLGUJqVBXXCfVS8Q8FJqYGhgH4wl4qTA24E9v/IJM0XvJCGQVSW1QZ4J+VURO9h8YCa28sTFacZXwK7Rg==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz", - "integrity": "sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.25.0.tgz", + "integrity": "sha512-YVT6L3UrKTlC0FpCZd0MGA7NVdp7YNaEqkENbWQ7AOVOqd/7VzyHpgIpc1mIaxRAo1ZsJRH45fq8j4N63I/vvg==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz", - "integrity": "sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.25.0.tgz", + "integrity": "sha512-ZRL+gexs3+ZmmWmGKEU43Bdn67kWnMeWXLFhcVv5Un8FQcx38yulHBA7XR2+KQdYIOtD0yZDWBCudmfj6lQJoA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.25.0.tgz", + "integrity": "sha512-xpEIXhiP27EAylEpreCozozsxWQ2TJbOLSivGfXhU4G1TBVEYtUPi2pOZBnvGXHyOdLAUUhPnJzH3ah5cqF01g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.25.0.tgz", + "integrity": "sha512-sC5FsmZGlJv5dOcURrsnIK7ngc3Kirnx3as2XU9uER+zjfyqIjdcMVgzy4cOawhsssqzoAX19qmxgJ8a14Qrqw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz", - "integrity": "sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.25.0.tgz", + "integrity": "sha512-uD/dbLSs1BEPzg564TpRAQ/YvTnCds2XxyOndAO8nJhaQcqQGFgv/DAVko/ZHap3boCvxnzYMa3mTkV/B/3SWA==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz", - "integrity": "sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.25.0.tgz", + "integrity": "sha512-ZVt/XkrDlQWegDWrwyC3l0OfAF7yeJUF4fq5RMS07YM72BlSfn2fQQ6lPyBNjt+YbczMguPiJoCfaQC2dnflpQ==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz", - "integrity": "sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.25.0.tgz", + "integrity": "sha512-qboZ+T0gHAW2kkSDPHxu7quaFaaBlynODXpBVnPxUgvWYaE84xgCKAPEYE+fSMd3Zv5PyFZR+L0tCdYCMAtG0A==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz", - "integrity": "sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.25.0.tgz", + "integrity": "sha512-ndWTSEmAaKr88dBuogGH2NZaxe7u2rDoArsejNslugHZ+r44NfWiwjzizVS1nUOHo+n1Z6qV3X60rqE/HlISgw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz", - "integrity": "sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.25.0.tgz", + "integrity": "sha512-BVSQvVa2v5hKwJSy6X7W1fjDex6yZnNKy3Kx1JGimccHft6HV0THTwNtC2zawtNXKUu+S5CjXslilYdKBAadzA==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz", - "integrity": "sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.25.0.tgz", + "integrity": "sha512-G4hTREQrIdeV0PE2JruzI+vXdRnaK1pg64hemHq2v5fhv8C7WjVaeXc9P5i4Q5UC06d/L+zA0mszYIKl+wY8oA==", "cpu": [ "riscv64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz", - "integrity": "sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.25.0.tgz", + "integrity": "sha512-9T/w0kQ+upxdkFL9zPVB6zy9vWW1deA3g8IauJxojN4bnz5FwSsUAD034KpXIVX5j5p/rn6XqumBMxfRkcHapQ==", "cpu": [ "s390x" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", - "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.25.0.tgz", + "integrity": "sha512-ThcnU0EcMDn+J4B9LD++OgBYxZusuA7iemIIiz5yzEcFg04VZFzdFjuwPdlURmYPZw+fgVrFzj4CA64jSTG4Ig==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz", - "integrity": "sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.25.0.tgz", + "integrity": "sha512-zx71aY2oQxGxAT1JShfhNG79PnjYhMC6voAjzpu/xmMjDnKNf6Nl/xv7YaB/9SIa9jDYf8RBPWEnjcdlhlv1rQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz", - "integrity": "sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.25.0.tgz", + "integrity": "sha512-JT8tcjNocMs4CylWY/CxVLnv8e1lE7ff1fi6kbGocWwxDq9pj30IJ28Peb+Y8yiPNSF28oad42ApJB8oUkwGww==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz", - "integrity": "sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.25.0.tgz", + "integrity": "sha512-dRLjLsO3dNOfSN6tjyVlG+Msm4IiZnGkuZ7G5NmpzwF9oOc582FZG05+UdfTbz5Jd4buK/wMb6UeHFhG18+OEg==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz", - "integrity": "sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.25.0.tgz", + "integrity": "sha512-/RqrIFtLB926frMhZD0a5oDa4eFIbyNEwLLloMTEjmqfwZWXywwVVOVmwTsuyhC9HKkVEZcOOi+KV4U9wmOdlg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -1573,10 +1811,11 @@ } }, "node_modules/@semantic-release/github": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-10.0.3.tgz", - "integrity": "sha512-nSJQboKrG4xBn7hHpRMrK8lt5DgqJg50ZMz9UbrsfTxuRk55XVoQEadbGZ2L9M0xZAC6hkuwkDhQJKqfPU35Fw==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-11.0.1.tgz", + "integrity": "sha512-Z9cr0LgU/zgucbT9cksH0/pX9zmVda9hkDPcgIE0uvjMQ8w/mElDivGjx1w1pEQ+MuQJ5CBq3VCF16S6G4VH3A==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/core": "^6.0.0", "@octokit/plugin-paginate-rest": "^11.0.0", @@ -1599,7 +1838,7 @@ "node": ">=20.8.1" }, "peerDependencies": { - "semantic-release": ">=20.1.0" + "semantic-release": ">=24.1.0" } }, "node_modules/@semantic-release/github/node_modules/@semantic-release/error": { @@ -1607,6 +1846,7 @@ "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-4.0.0.tgz", "integrity": "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" } @@ -1616,6 +1856,7 @@ "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-5.0.0.tgz", "integrity": "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw==", "dev": true, + "license": "MIT", "dependencies": { "clean-stack": "^5.2.0", "indent-string": "^5.0.0" @@ -1632,6 +1873,7 @@ "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-5.2.0.tgz", "integrity": "sha512-TyUIUJgdFnCISzG5zu3291TAsE77ddchd0bepon1VVQrKLGKFED4iXFEDQ24mIPdPBbyE16PK3F8MYE1CmcBEQ==", "dev": true, + "license": "MIT", "dependencies": { "escape-string-regexp": "5.0.0" }, @@ -1647,6 +1889,7 @@ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -1796,29 +2039,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@sinclair/typebox": { - "version": "0.27.8", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", - "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", - "dev": true - }, - "node_modules/@sindresorhus/is": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-6.3.1.tgz", - "integrity": "sha512-FX4MfcifwJyFOI2lPoX7PQxCqx8BG1HCho7WdiXwpEQx1Ycij0JxkfYtGK7yqNScrZGSlt6RE6sw8QYoH7eKnQ==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sindresorhus/is?sponsor=1" - } - }, "node_modules/@sindresorhus/merge-streams": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" }, @@ -1827,45 +2053,54 @@ } }, "node_modules/@skyleague/axioms": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@skyleague/axioms/-/axioms-4.3.4.tgz", - "integrity": "sha512-Gnf7ktsPXr1N9i19ht9ZWpGOzV7RxGKyUoipasdem2fdZOa7c72YY8LChw4W5tQidSgsaV8GPiQzjiiraGOnnA==", + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@skyleague/axioms/-/axioms-4.5.2.tgz", + "integrity": "sha512-lcxlfxrMdRTCgXbapba2zTEz0JVMjA7zchP2CL29+IfgvV2aRJdazMvHZvbnYaYdP0hSrGXNBettqCijBN2HrQ==", "dev": true, + "license": "MIT", + "workspaces": [ + "docs" + ], "dependencies": { "fast-deep-equal": "^3.1.3", "node-object-hash": "^3.0.0", - "type-fest": "^4.15.0" + "type-fest": "^4.20.1" }, "engines": { "node": ">=20" } }, "node_modules/@skyleague/node-standards": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@skyleague/node-standards/-/node-standards-7.1.0.tgz", - "integrity": "sha512-8KBzZrTD70Ey1Hk0wzTtnQoBnN11ofh4qO+JTPz9C+UcqQ1ra0YhO4+C9uH1bwjdSYy9DJiPxOvw8D0+CaWY7A==", + "version": "8.2.4", + "resolved": "https://registry.npmjs.org/@skyleague/node-standards/-/node-standards-8.2.4.tgz", + "integrity": "sha512-+QoSOelMAt+8dip0F53y+RWSIbx8ZSsmamPsBgd9AK133bEjK0U4NK+n4lW6HLslXUUD4F5t+PWVxAzfB64XOw==", "dev": true, + "license": "MIT", + "workspaces": [ + "./", + "examples/*" + ], "dependencies": { - "@biomejs/biome": "^1.8.0", - "@commitlint/cli": "^19.3.0", - "@commitlint/config-conventional": "^19.2.2", + "@biomejs/biome": "^1.9.4", + "@commitlint/cli": "^19.5.0", + "@commitlint/config-conventional": "^19.5.0", "@semantic-release/changelog": "^6.0.3", - "@types/node": "^20.14.2", - "@vitest/coverage-v8": "^1.6.0", + "@types/node": "^20.16.1", + "@vitest/coverage-v8": "^2.1.4", "conventional-changelog": "^6.0.0", "enquirer": "^2.4.1", - "esbuild": "^0.21.4", + "esbuild": "^0.24.0", "fast-glob": "^3.3.2", "find-root": "^1.1.0", - "husky": "^9.0.11", + "husky": "^9.1.6", "is-ci": "^3.0.1", "line-diff": "^2.1.1", - "lint-staged": "^15.2.5", - "semantic-release": "^24.0.0", - "semver": "^7.6.2", - "tsx": "^4.12.0", + "lint-staged": "^15.2.10", + "semantic-release": "^24.2.0", + "semver": "^7.6.3", + "tsx": "^4.19.2", "variable-diff": "^2.0.2", - "vitest": "^1.6.0", + "vitest": "^2.1.4", "yargs": "^17.7.2" }, "bin": { @@ -1875,193 +2110,523 @@ "node": ">=20" }, "peerDependencies": { - "typescript": "^5.4.5" + "typescript": "^5.6.3" } }, - "node_modules/@skyleague/therefore": { - "version": "5.8.8", - "resolved": "https://registry.npmjs.org/@skyleague/therefore/-/therefore-5.8.8.tgz", - "integrity": "sha512-6iAwLx6u4NONs/iq7uLiXXXlY3kpH5+Sze9Zd1wmyn8R5PK/D0CAik0ZNRgNMT/7S5s9AtU0Ohmd6hprnowSMA==", + "node_modules/@skyleague/node-standards/node_modules/@esbuild/aix-ppc64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz", + "integrity": "sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==", + "cpu": [ + "ppc64" + ], "dev": true, - "dependencies": { - "@biomejs/js-api": "^0.6.0", - "@biomejs/wasm-nodejs": "1.7.3", - "@skyleague/axioms": "4.3.3", - "@typeschema/main": "^0.13.9", - "@urql/introspection": "^1.1.0", - "ajv": "^8.13.0", - "ajv-formats": "^3.0.1", - "camelcase": "^8.0.0", - "code-block-writer": "^13.0.1", - "decamelize": "^6.0.0", - "fast-glob": "^3.3.2", - "graphql": "^16.8.1", - "inflection": "^3.0.0", - "js-yaml": "^4.1.0", - "jsonpointer": "^5.0.1", - "make-synchronous": "^1.0.0", - "regex-to-strings": "^2.1.0", - "swagger2openapi": "^7.0.8", - "yargs": "^17.7.2" - }, - "bin": { - "therefore": "bin/run.js" - }, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], "engines": { - "node": ">=20" - }, - "peerDependencies": { - "got": "^14.3.0", - "tsx": "^4.11.0" + "node": ">=18" } }, - "node_modules/@skyleague/therefore/node_modules/@skyleague/axioms": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@skyleague/axioms/-/axioms-4.3.3.tgz", - "integrity": "sha512-Z54yyVPJ6V1Sme3YB15KMeDViGo7AMNnc8xAVHszMiOQL4xHW5P0JLEMamw5rpV1rJ3ttdu6UO8JTiHIB5PMKA==", + "node_modules/@skyleague/node-standards/node_modules/@esbuild/android-arm": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.0.tgz", + "integrity": "sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==", + "cpu": [ + "arm" + ], "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.3", - "node-object-hash": "^3.0.0", - "type-fest": "^4.15.0" - }, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=20" + "node": ">=18" } }, - "node_modules/@skyleague/therefore/node_modules/@typeschema/main": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/@typeschema/main/-/main-0.13.9.tgz", - "integrity": "sha512-Z6yFaf2dLoqvuSNIeUelek9XI8T5Rog/NXHBMwV6KLhQCT0lQPBtmZSXAdW6EzFaqn1najhQEcirBqjWiFXiig==", + "node_modules/@skyleague/node-standards/node_modules/@esbuild/android-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz", + "integrity": "sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "@typeschema/core": "0.13.2" - }, - "peerDependencies": { - "@typeschema/arktype": "0.13.2", - "@typeschema/class-validator": "0.1.2", - "@typeschema/deepkit": "0.13.4", - "@typeschema/effect": "0.13.4", - "@typeschema/fastest-validator": "0.1.0", - "@typeschema/function": "0.13.2", - "@typeschema/io-ts": "0.13.3", - "@typeschema/joi": "0.13.3", - "@typeschema/json": "0.13.3", - "@typeschema/ow": "0.13.3", - "@typeschema/runtypes": "0.13.2", - "@typeschema/superstruct": "0.13.2", - "@typeschema/suretype": "0.1.0", - "@typeschema/typebox": "0.13.4", - "@typeschema/valibot": "0.13.4", - "@typeschema/valita": "0.1.0", - "@typeschema/vine": "0.1.0", - "@typeschema/yup": "0.13.3", - "@typeschema/zod": "0.13.3" - }, - "peerDependenciesMeta": { - "@typeschema/arktype": { - "optional": true - }, - "@typeschema/class-validator": { - "optional": true - }, - "@typeschema/deepkit": { - "optional": true - }, - "@typeschema/effect": { - "optional": true - }, - "@typeschema/fastest-validator": { - "optional": true - }, - "@typeschema/function": { - "optional": true - }, - "@typeschema/io-ts": { - "optional": true - }, - "@typeschema/joi": { - "optional": true - }, - "@typeschema/json": { - "optional": true - }, - "@typeschema/ow": { - "optional": true - }, - "@typeschema/runtypes": { - "optional": true - }, - "@typeschema/superstruct": { - "optional": true - }, - "@typeschema/suretype": { - "optional": true - }, - "@typeschema/typebox": { - "optional": true - }, - "@typeschema/valibot": { - "optional": true - }, - "@typeschema/valita": { - "optional": true - }, - "@typeschema/vine": { - "optional": true - }, - "@typeschema/yup": { - "optional": true - }, - "@typeschema/zod": { - "optional": true - } + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" } }, - "node_modules/@szmarczak/http-timer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", - "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", + "node_modules/@skyleague/node-standards/node_modules/@esbuild/android-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.0.tgz", + "integrity": "sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "defer-to-connect": "^2.0.1" - }, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=14.16" + "node": ">=18" } }, - "node_modules/@types/conventional-commits-parser": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", - "integrity": "sha512-loB369iXNmAZglwWATL+WRe+CRMmmBPtpolYzIebFaX4YA3x+BEfLqhUAV9WanycKI3TG1IMr5bMJDajDKLlUQ==", + "node_modules/@skyleague/node-standards/node_modules/@esbuild/darwin-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz", + "integrity": "sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "@types/node": "*" + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" } }, - "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", - "dev": true - }, - "node_modules/@types/http-cache-semantics": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz", - "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==", - "dev": true + "node_modules/@skyleague/node-standards/node_modules/@esbuild/darwin-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz", + "integrity": "sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } }, - "node_modules/@types/node": { - "version": "20.14.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.2.tgz", - "integrity": "sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==", + "node_modules/@skyleague/node-standards/node_modules/@esbuild/freebsd-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz", + "integrity": "sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "undici-types": "~5.26.4" + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" } }, - "node_modules/@types/normalize-package-data": { - "version": "2.4.4", + "node_modules/@skyleague/node-standards/node_modules/@esbuild/freebsd-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz", + "integrity": "sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/linux-arm": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz", + "integrity": "sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/linux-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz", + "integrity": "sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/linux-ia32": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz", + "integrity": "sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/linux-loong64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz", + "integrity": "sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/linux-mips64el": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz", + "integrity": "sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/linux-ppc64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz", + "integrity": "sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/linux-riscv64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz", + "integrity": "sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/linux-s390x": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz", + "integrity": "sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/linux-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz", + "integrity": "sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/netbsd-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz", + "integrity": "sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/openbsd-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz", + "integrity": "sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/openbsd-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz", + "integrity": "sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/sunos-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz", + "integrity": "sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/win32-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz", + "integrity": "sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/win32-ia32": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz", + "integrity": "sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/@esbuild/win32-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz", + "integrity": "sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@skyleague/node-standards/node_modules/esbuild": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz", + "integrity": "sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.24.0", + "@esbuild/android-arm": "0.24.0", + "@esbuild/android-arm64": "0.24.0", + "@esbuild/android-x64": "0.24.0", + "@esbuild/darwin-arm64": "0.24.0", + "@esbuild/darwin-x64": "0.24.0", + "@esbuild/freebsd-arm64": "0.24.0", + "@esbuild/freebsd-x64": "0.24.0", + "@esbuild/linux-arm": "0.24.0", + "@esbuild/linux-arm64": "0.24.0", + "@esbuild/linux-ia32": "0.24.0", + "@esbuild/linux-loong64": "0.24.0", + "@esbuild/linux-mips64el": "0.24.0", + "@esbuild/linux-ppc64": "0.24.0", + "@esbuild/linux-riscv64": "0.24.0", + "@esbuild/linux-s390x": "0.24.0", + "@esbuild/linux-x64": "0.24.0", + "@esbuild/netbsd-x64": "0.24.0", + "@esbuild/openbsd-arm64": "0.24.0", + "@esbuild/openbsd-x64": "0.24.0", + "@esbuild/sunos-x64": "0.24.0", + "@esbuild/win32-arm64": "0.24.0", + "@esbuild/win32-ia32": "0.24.0", + "@esbuild/win32-x64": "0.24.0" + } + }, + "node_modules/@skyleague/therefore": { + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@skyleague/therefore/-/therefore-5.18.0.tgz", + "integrity": "sha512-WFth0xk0d99pk3ok90BS8xHQEpzHM7b53bG1nBWUS3WWZ6gw75QRcOAZZe6+qOWZyfVR7sQxJbWoLWuxyGg5wA==", + "dev": true, + "license": "MIT", + "workspaces": [ + "docs" + ], + "dependencies": { + "@skyleague/axioms": "^4.5.2", + "@typeschema/main": "^0.13.10", + "@urql/introspection": "^1.1.0", + "ajv": "^8.17.1", + "ajv-formats": "^3.0.1", + "camelcase": "^8.0.0", + "code-block-writer": "^13.0.2", + "decamelize": "^6.0.0", + "fast-glob": "^3.3.2", + "graphql": "^16.9.0", + "inflection": "^3.0.0", + "js-yaml": "^4.1.0", + "jsonpointer": "^5.0.1", + "make-synchronous": "^1.0.0", + "regex-to-strings": "^2.1.0", + "swagger2openapi": "^7.0.8", + "yargs": "^17.7.2" + }, + "bin": { + "therefore": "bin/run.js" + }, + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "tsx": "^4.19.1" + } + }, + "node_modules/@types/conventional-commits-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", + "integrity": "sha512-loB369iXNmAZglwWATL+WRe+CRMmmBPtpolYzIebFaX4YA3x+BEfLqhUAV9WanycKI3TG1IMr5bMJDajDKLlUQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "20.17.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.6.tgz", + "integrity": "sha512-VEI7OdvK2wP7XHnsuXbAJnEpEkF6NjSN45QJlL4VGqZSXsnicpesdTWsg9RISeSdYd3yeRj/y3k5KGjUXYnFwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.4", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", "dev": true @@ -2086,6 +2651,7 @@ "resolved": "https://registry.npmjs.org/@typeschema/core/-/core-0.13.2.tgz", "integrity": "sha512-pAt0MK249/9szYaoPuvzhSfOd3smrLhhwCCpUNB4onX32mRx5F3lzDIveIYGQkLYRq58xOX5sjoW+n72f/MLLw==", "dev": true, + "license": "MIT", "peerDependencies": { "@types/json-schema": "^7.0.15" }, @@ -2095,6 +2661,96 @@ } } }, + "node_modules/@typeschema/main": { + "version": "0.13.10", + "resolved": "https://registry.npmjs.org/@typeschema/main/-/main-0.13.10.tgz", + "integrity": "sha512-ArdFC4GbgdVWWgPKg2tymxx2KHMus3xZ8I2kHwqw/0P4FtWBXCmSNAiBqDtpoXXF8h9cbcm7fVpcs5ftoWT9+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typeschema/core": "0.13.2" + }, + "peerDependencies": { + "@typeschema/arktype": "0.13.2", + "@typeschema/class-validator": "0.1.2", + "@typeschema/deepkit": "0.13.4", + "@typeschema/effect": "0.13.4", + "@typeschema/fastest-validator": "0.1.0", + "@typeschema/function": "0.13.2", + "@typeschema/io-ts": "0.13.3", + "@typeschema/joi": "0.13.3", + "@typeschema/json": "0.13.3", + "@typeschema/ow": "0.13.3", + "@typeschema/runtypes": "0.13.2", + "@typeschema/superstruct": "0.13.2", + "@typeschema/suretype": "0.1.0", + "@typeschema/typebox": "0.13.4", + "@typeschema/valibot": "0.13.5", + "@typeschema/valita": "0.1.0", + "@typeschema/vine": "0.1.0", + "@typeschema/yup": "0.13.3", + "@typeschema/zod": "0.13.3" + }, + "peerDependenciesMeta": { + "@typeschema/arktype": { + "optional": true + }, + "@typeschema/class-validator": { + "optional": true + }, + "@typeschema/deepkit": { + "optional": true + }, + "@typeschema/effect": { + "optional": true + }, + "@typeschema/fastest-validator": { + "optional": true + }, + "@typeschema/function": { + "optional": true + }, + "@typeschema/io-ts": { + "optional": true + }, + "@typeschema/joi": { + "optional": true + }, + "@typeschema/json": { + "optional": true + }, + "@typeschema/ow": { + "optional": true + }, + "@typeschema/runtypes": { + "optional": true + }, + "@typeschema/superstruct": { + "optional": true + }, + "@typeschema/suretype": { + "optional": true + }, + "@typeschema/typebox": { + "optional": true + }, + "@typeschema/valibot": { + "optional": true + }, + "@typeschema/valita": { + "optional": true + }, + "@typeschema/vine": { + "optional": true + }, + "@typeschema/yup": { + "optional": true + }, + "@typeschema/zod": { + "optional": true + } + } + }, "node_modules/@urql/introspection": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@urql/introspection/-/introspection-1.1.0.tgz", @@ -2105,135 +2761,149 @@ } }, "node_modules/@vitest/coverage-v8": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-1.6.0.tgz", - "integrity": "sha512-KvapcbMY/8GYIG0rlwwOKCVNRc0OL20rrhFkg/CHNzncV03TE2XWvO5w9uZYoxNiMEBacAJt3unSOiZ7svePew==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-2.1.4.tgz", + "integrity": "sha512-FPKQuJfR6VTfcNMcGpqInmtJuVXFSCd9HQltYncfR01AzXhLucMEtQ5SinPdZxsT5x/5BK7I5qFJ5/ApGCmyTQ==", "dev": true, + "license": "MIT", "dependencies": { - "@ampproject/remapping": "^2.2.1", + "@ampproject/remapping": "^2.3.0", "@bcoe/v8-coverage": "^0.2.3", - "debug": "^4.3.4", + "debug": "^4.3.7", "istanbul-lib-coverage": "^3.2.2", "istanbul-lib-report": "^3.0.1", - "istanbul-lib-source-maps": "^5.0.4", - "istanbul-reports": "^3.1.6", - "magic-string": "^0.30.5", - "magicast": "^0.3.3", - "picocolors": "^1.0.0", - "std-env": "^3.5.0", - "strip-literal": "^2.0.0", - "test-exclude": "^6.0.0" + "istanbul-lib-source-maps": "^5.0.6", + "istanbul-reports": "^3.1.7", + "magic-string": "^0.30.12", + "magicast": "^0.3.5", + "std-env": "^3.7.0", + "test-exclude": "^7.0.1", + "tinyrainbow": "^1.2.0" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "vitest": "1.6.0" + "@vitest/browser": "2.1.4", + "vitest": "2.1.4" + }, + "peerDependenciesMeta": { + "@vitest/browser": { + "optional": true + } } }, "node_modules/@vitest/expect": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.0.tgz", - "integrity": "sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.4.tgz", + "integrity": "sha512-DOETT0Oh1avie/D/o2sgMHGrzYUFFo3zqESB2Hn70z6QB1HrS2IQ9z5DfyTqU8sg4Bpu13zZe9V4+UTNQlUeQA==", "dev": true, + "license": "MIT", "dependencies": { - "@vitest/spy": "1.6.0", - "@vitest/utils": "1.6.0", - "chai": "^4.3.10" + "@vitest/spy": "2.1.4", + "@vitest/utils": "2.1.4", + "chai": "^5.1.2", + "tinyrainbow": "^1.2.0" }, "funding": { "url": "https://opencollective.com/vitest" } }, - "node_modules/@vitest/runner": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.0.tgz", - "integrity": "sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==", + "node_modules/@vitest/mocker": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.4.tgz", + "integrity": "sha512-Ky/O1Lc0QBbutJdW0rqLeFNbuLEyS+mIPiNdlVlp2/yhJ0SbyYqObS5IHdhferJud8MbbwMnexg4jordE5cCoQ==", "dev": true, + "license": "MIT", "dependencies": { - "@vitest/utils": "1.6.0", - "p-limit": "^5.0.0", - "pathe": "^1.1.1" + "@vitest/spy": "2.1.4", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.12" }, "funding": { "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^5.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } } }, - "node_modules/@vitest/runner/node_modules/p-limit": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", - "integrity": "sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==", + "node_modules/@vitest/pretty-format": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.4.tgz", + "integrity": "sha512-L95zIAkEuTDbUX1IsjRl+vyBSLh3PwLLgKpghl37aCK9Jvw0iP+wKwIFhfjdUtA2myLgjrG6VU6JCFLv8q/3Ww==", "dev": true, + "license": "MIT", "dependencies": { - "yocto-queue": "^1.0.0" - }, - "engines": { - "node": ">=18" + "tinyrainbow": "^1.2.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://opencollective.com/vitest" } }, - "node_modules/@vitest/snapshot": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.0.tgz", - "integrity": "sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==", + "node_modules/@vitest/runner": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.4.tgz", + "integrity": "sha512-sKRautINI9XICAMl2bjxQM8VfCMTB0EbsBc/EDFA57V6UQevEKY/TOPOF5nzcvCALltiLfXWbq4MaAwWx/YxIA==", "dev": true, + "license": "MIT", "dependencies": { - "magic-string": "^0.30.5", - "pathe": "^1.1.1", - "pretty-format": "^29.7.0" + "@vitest/utils": "2.1.4", + "pathe": "^1.1.2" }, "funding": { "url": "https://opencollective.com/vitest" } }, - "node_modules/@vitest/spy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.0.tgz", - "integrity": "sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==", + "node_modules/@vitest/snapshot": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.4.tgz", + "integrity": "sha512-3Kab14fn/5QZRog5BPj6Rs8dc4B+mim27XaKWFWHWA87R56AKjHTGcBFKpvZKDzC4u5Wd0w/qKsUIio3KzWW4Q==", "dev": true, + "license": "MIT", "dependencies": { - "tinyspy": "^2.2.0" + "@vitest/pretty-format": "2.1.4", + "magic-string": "^0.30.12", + "pathe": "^1.1.2" }, "funding": { "url": "https://opencollective.com/vitest" } }, - "node_modules/@vitest/utils": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.0.tgz", - "integrity": "sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==", + "node_modules/@vitest/spy": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.4.tgz", + "integrity": "sha512-4JOxa+UAizJgpZfaCPKK2smq9d8mmjZVPMt2kOsg/R8QkoRzydHH1qHxIYNvr1zlEaFj4SXiaaJWxq/LPLKaLg==", "dev": true, + "license": "MIT", "dependencies": { - "diff-sequences": "^29.6.3", - "estree-walker": "^3.0.3", - "loupe": "^2.3.7", - "pretty-format": "^29.7.0" + "tinyspy": "^3.0.2" }, "funding": { "url": "https://opencollective.com/vitest" } }, - "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "node_modules/@vitest/utils": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.4.tgz", + "integrity": "sha512-MXDnZn0Awl2S86PSNIim5PWXgIAx8CIkzu35mBdSApUip6RFOGXBCf3YFyeEu8n1IHk4bWD46DeYFu9mQlFIRg==", "dev": true, - "bin": { - "acorn": "bin/acorn" + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "2.1.4", + "loupe": "^3.1.2", + "tinyrainbow": "^1.2.0" }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", - "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", - "dev": true, - "engines": { - "node": ">=0.4.0" + "funding": { + "url": "https://opencollective.com/vitest" } }, "node_modules/add-stream": { @@ -2247,6 +2917,7 @@ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^4.3.4" }, @@ -2268,14 +2939,15 @@ } }, "node_modules/ajv": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.14.0.tgz", - "integrity": "sha512-oYs1UUtO97ZO2lJ4bwnWeQW8/zvOIQLGKcvPTsWmvc2SYgBb+upuNS5NxoLaMU4h8Ju3Nbj6Cq8mD2LQoqVKFA==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.4.1" + "require-from-string": "^2.0.2" }, "funding": { "type": "github", @@ -2334,6 +3006,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -2404,12 +3077,13 @@ } }, "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", "dev": true, + "license": "MIT", "engines": { - "node": "*" + "node": ">=12" } }, "node_modules/available-typed-arrays": { @@ -2431,104 +3105,53 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/before-after-hook": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz", "integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/bottleneck": { "version": "2.19.5", "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, + "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "node_modules/braces": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/cacheable-lookup": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", - "integrity": "sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==", - "dev": true, - "engines": { - "node": ">=14.16" - } - }, - "node_modules/cacheable-request": { - "version": "12.0.1", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-12.0.1.tgz", - "integrity": "sha512-Yo9wGIQUaAfIbk+qY0X4cDQgCosecfBe3V9NSyeY4qPC2SAkbCS4Xj79VP8WOzitpJUZKc/wsRCYF5ariDIwkg==", - "dev": true, - "dependencies": { - "@types/http-cache-semantics": "^4.0.4", - "get-stream": "^9.0.1", - "http-cache-semantics": "^4.1.1", - "keyv": "^4.5.4", - "mimic-response": "^4.0.0", - "normalize-url": "^8.0.1", - "responselike": "^3.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/cacheable-request/node_modules/get-stream": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz", - "integrity": "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "@sec-ant/readable-stream": "^0.4.1", - "is-stream": "^4.0.1" + "fill-range": "^7.1.1" }, "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/cacheable-request/node_modules/is-stream": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-4.0.1.tgz", - "integrity": "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==", + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, "node_modules/call-bind": { @@ -2578,21 +3201,20 @@ } }, "node_modules/chai": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", - "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.1.2.tgz", + "integrity": "sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==", "dev": true, + "license": "MIT", "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.3", - "deep-eql": "^4.1.3", - "get-func-name": "^2.0.2", - "loupe": "^2.3.6", - "pathval": "^1.1.1", - "type-detect": "^4.0.8" + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" }, "engines": { - "node": ">=4" + "node": ">=12" } }, "node_modules/chalk": { @@ -2617,15 +3239,13 @@ } }, "node_modules/check-error": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", + "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", "dev": true, - "dependencies": { - "get-func-name": "^2.0.2" - }, + "license": "MIT", "engines": { - "node": "*" + "node": ">= 16" } }, "node_modules/ci-info": { @@ -2653,15 +3273,16 @@ } }, "node_modules/cli-cursor": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", - "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", + "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", "dev": true, + "license": "MIT", "dependencies": { - "restore-cursor": "^4.0.0" + "restore-cursor": "^5.0.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -2870,6 +3491,7 @@ "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz", "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==", "dev": true, + "license": "MIT", "dependencies": { "slice-ansi": "^5.0.0", "string-width": "^7.0.0" @@ -2975,10 +3597,11 @@ } }, "node_modules/code-block-writer": { - "version": "13.0.1", - "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-13.0.1.tgz", - "integrity": "sha512-c5or4P6erEA69TxaxTNcHUNcIn+oyxSRTOWV+pSYF+z4epXqNvwvJ70XPGjPNgue83oAFAPBRQYwpAJ/Hpe/Sg==", - "dev": true + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-13.0.3.tgz", + "integrity": "sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg==", + "dev": true, + "license": "MIT" }, "node_modules/color-convert": { "version": "1.9.3", @@ -2999,13 +3622,15 @@ "version": "2.0.20", "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/commander": { "version": "12.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" } @@ -3020,18 +3645,6 @@ "dot-prop": "^5.1.0" } }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "node_modules/confbox": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.7.tgz", - "integrity": "sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==", - "dev": true - }, "node_modules/config-chain": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", @@ -3075,6 +3688,7 @@ "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz", "integrity": "sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==", "dev": true, + "license": "ISC", "dependencies": { "compare-func": "^2.0.0" }, @@ -3105,6 +3719,7 @@ "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-7.0.2.tgz", "integrity": "sha512-NKXYmMR/Hr1DevQegFB4MwfM5Vv0m4UIxKZTTYuD98lpTknaZlSRrDOG4X7wIXpGkfsYxZTghUN+Qq+T0YQI7w==", "dev": true, + "license": "ISC", "dependencies": { "compare-func": "^2.0.0" }, @@ -3303,6 +3918,7 @@ "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", "integrity": "sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==", "dev": true, + "license": "MIT", "dependencies": { "is-text-path": "^2.0.0", "JSONStream": "^1.3.5", @@ -3321,6 +3937,7 @@ "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", "dev": true, + "license": "MIT", "engines": { "node": ">=16.10" }, @@ -3373,12 +3990,13 @@ } }, "node_modules/cosmiconfig-typescript-loader": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-5.0.0.tgz", - "integrity": "sha512-+8cK7jRAReYkMwMiG+bxhcNKiHJDM6bR9FD/nGBXOWdMLuYawjF5cGrtLilJ+LGd3ZjCXnJjR5DkfWPoIVlqJA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-5.1.0.tgz", + "integrity": "sha512-7PtBB+6FdsOvZyJtlF3hEPpACq7RQX6BVGsgC7/lfVXnKMvNCu/XY3ykreqG5w/rBNdu2z8LCIKoF3kpHHdHlA==", "dev": true, + "license": "MIT", "dependencies": { - "jiti": "^1.19.1" + "jiti": "^1.21.6" }, "engines": { "node": ">=v16" @@ -3435,6 +4053,7 @@ "resolved": "https://registry.npmjs.org/dargs/-/dargs-8.1.0.tgz", "integrity": "sha512-wAV9QHOsNbwnWdNW2FYvE1P56wtgSbM+3SZcdGiWQILwVjACCXDCI3Ai8QlCjMDB8YK5zySiXZYBiwGmNY3lnw==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -3494,12 +4113,13 @@ } }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, + "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -3522,41 +4142,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dev": true, - "dependencies": { - "mimic-response": "^3.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/decompress-response/node_modules/mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/deep-eql": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", - "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", "dev": true, - "dependencies": { - "type-detect": "^4.0.0" - }, + "license": "MIT", "engines": { "node": ">=6" } @@ -3570,15 +4161,6 @@ "node": ">=4.0.0" } }, - "node_modules/defer-to-connect": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", - "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", @@ -3613,20 +4195,12 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/diff-sequences": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", - "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", - "dev": true, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, + "license": "MIT", "dependencies": { "path-type": "^4.0.0" }, @@ -3655,11 +4229,19 @@ "readable-stream": "^2.0.2" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, "node_modules/emoji-regex": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", - "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==", - "dev": true + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "dev": true, + "license": "MIT" }, "node_modules/emojilib": { "version": "2.4.0", @@ -3702,6 +4284,19 @@ "node": ">=6" } }, + "node_modules/environment": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -3842,41 +4437,43 @@ "dev": true }, "node_modules/esbuild": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.4.tgz", - "integrity": "sha512-sFMcNNrj+Q0ZDolrp5pDhH0nRPN9hLIM3fRPwgbLYJeSHHgnXSnbV3xYgSVuOeLWH9c73VwmEverVzupIv5xuA==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", + "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, "engines": { - "node": ">=12" + "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.21.4", - "@esbuild/android-arm": "0.21.4", - "@esbuild/android-arm64": "0.21.4", - "@esbuild/android-x64": "0.21.4", - "@esbuild/darwin-arm64": "0.21.4", - "@esbuild/darwin-x64": "0.21.4", - "@esbuild/freebsd-arm64": "0.21.4", - "@esbuild/freebsd-x64": "0.21.4", - "@esbuild/linux-arm": "0.21.4", - "@esbuild/linux-arm64": "0.21.4", - "@esbuild/linux-ia32": "0.21.4", - "@esbuild/linux-loong64": "0.21.4", - "@esbuild/linux-mips64el": "0.21.4", - "@esbuild/linux-ppc64": "0.21.4", - "@esbuild/linux-riscv64": "0.21.4", - "@esbuild/linux-s390x": "0.21.4", - "@esbuild/linux-x64": "0.21.4", - "@esbuild/netbsd-x64": "0.21.4", - "@esbuild/openbsd-x64": "0.21.4", - "@esbuild/sunos-x64": "0.21.4", - "@esbuild/win32-arm64": "0.21.4", - "@esbuild/win32-ia32": "0.21.4", - "@esbuild/win32-x64": "0.21.4" + "@esbuild/aix-ppc64": "0.23.1", + "@esbuild/android-arm": "0.23.1", + "@esbuild/android-arm64": "0.23.1", + "@esbuild/android-x64": "0.23.1", + "@esbuild/darwin-arm64": "0.23.1", + "@esbuild/darwin-x64": "0.23.1", + "@esbuild/freebsd-arm64": "0.23.1", + "@esbuild/freebsd-x64": "0.23.1", + "@esbuild/linux-arm": "0.23.1", + "@esbuild/linux-arm64": "0.23.1", + "@esbuild/linux-ia32": "0.23.1", + "@esbuild/linux-loong64": "0.23.1", + "@esbuild/linux-mips64el": "0.23.1", + "@esbuild/linux-ppc64": "0.23.1", + "@esbuild/linux-riscv64": "0.23.1", + "@esbuild/linux-s390x": "0.23.1", + "@esbuild/linux-x64": "0.23.1", + "@esbuild/netbsd-x64": "0.23.1", + "@esbuild/openbsd-arm64": "0.23.1", + "@esbuild/openbsd-x64": "0.23.1", + "@esbuild/sunos-x64": "0.23.1", + "@esbuild/win32-arm64": "0.23.1", + "@esbuild/win32-ia32": "0.23.1", + "@esbuild/win32-x64": "0.23.1" } }, "node_modules/escalade": { @@ -3905,6 +4502,7 @@ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", "dev": true, + "license": "MIT", "dependencies": { "@types/estree": "^1.0.0" } @@ -3913,7 +4511,8 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/execa": { "version": "8.0.1", @@ -3938,6 +4537,16 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, + "node_modules/expect-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.1.0.tgz", + "integrity": "sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -3965,6 +4574,12 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", "dev": true }, + "node_modules/fast-uri": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.3.tgz", + "integrity": "sha512-aLrHthzCjH5He4Z2H9YZ+v6Ujb9ocRuW6ZzkJQOrTxleEijANq4v1TsaPaVG1PZcuurEzrLcWRyYBYXD5cEiaw==", + "license": "BSD-3-Clause" + }, "node_modules/fastq": { "version": "1.17.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", @@ -4012,6 +4627,7 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-7.0.0.tgz", "integrity": "sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==", "dev": true, + "license": "MIT", "dependencies": { "locate-path": "^7.2.0", "path-exists": "^5.0.0", @@ -4061,13 +4677,21 @@ "is-callable": "^1.1.3" } }, - "node_modules/form-data-encoder": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-4.0.2.tgz", - "integrity": "sha512-KQVhvhK8ZkWzxKxOr56CPulAhH3dobtuQ4+hNQ+HekH/Wp5gSOafqRAeTphQUJAIk0GBvHZgJ2ZGRWd5kphMuw==", + "node_modules/foreground-child": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", + "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, "engines": { - "node": ">= 18" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/from2": { @@ -4094,18 +4718,13 @@ "node": ">=14.14" } }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -4172,10 +4791,11 @@ } }, "node_modules/get-east-asian-width": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", - "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.3.0.tgz", + "integrity": "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" }, @@ -4183,15 +4803,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-func-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", - "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/get-intrinsic": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", @@ -4241,10 +4852,11 @@ } }, "node_modules/get-tsconfig": { - "version": "4.7.5", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", - "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", + "integrity": "sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==", "dev": true, + "license": "MIT", "dependencies": { "resolve-pkg-maps": "^1.0.0" }, @@ -4280,6 +4892,7 @@ "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-4.0.0.tgz", "integrity": "sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==", "dev": true, + "license": "MIT", "dependencies": { "dargs": "^8.0.0", "meow": "^12.0.1", @@ -4297,6 +4910,7 @@ "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", "dev": true, + "license": "MIT", "engines": { "node": ">=16.10" }, @@ -4363,21 +4977,21 @@ } }, "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", "dev": true, + "license": "ISC", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" }, - "engines": { - "node": "*" + "bin": { + "glob": "dist/esm/bin.mjs" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -4400,6 +5014,7 @@ "resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz", "integrity": "sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==", "dev": true, + "license": "MIT", "dependencies": { "ini": "4.1.1" }, @@ -4426,10 +5041,11 @@ } }, "node_modules/globby": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz", - "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==", + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.2.tgz", + "integrity": "sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==", "dev": true, + "license": "MIT", "dependencies": { "@sindresorhus/merge-streams": "^2.1.0", "fast-glob": "^3.3.2", @@ -4450,6 +5066,7 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -4469,31 +5086,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/got": { - "version": "14.3.0", - "resolved": "https://registry.npmjs.org/got/-/got-14.3.0.tgz", - "integrity": "sha512-vZkrXdq5BtPWTXqvjXSpl6zky3zpHaOVfSug/RfFHu3YrtSsvYzopVMDqrh2do77WnGoCSSRCHW25zXOSAQ9zw==", - "dev": true, - "dependencies": { - "@sindresorhus/is": "^6.3.1", - "@szmarczak/http-timer": "^5.0.1", - "cacheable-lookup": "^7.0.0", - "cacheable-request": "^12.0.1", - "decompress-response": "^6.0.0", - "form-data-encoder": "^4.0.2", - "get-stream": "^8.0.1", - "http2-wrapper": "^2.2.1", - "lowercase-keys": "^3.0.0", - "p-cancelable": "^4.0.1", - "responselike": "^3.0.0" - }, - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sindresorhus/got?sponsor=1" - } - }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -4501,10 +5093,11 @@ "dev": true }, "node_modules/graphql": { - "version": "16.8.1", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz", - "integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==", + "version": "16.9.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.9.0.tgz", + "integrity": "sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==", "dev": true, + "license": "MIT", "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } @@ -4648,19 +5241,15 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "node_modules/http-cache-semantics": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/http-proxy-agent": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, + "license": "MIT", "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" @@ -4675,24 +5264,12 @@ "integrity": "sha512-EC2utToWl4RKfs5zd36Mxq7nzHHBuomZboI0yYL6Y0RmBgT7Sgkq4rQ0ezFTYoIsSs7Tm9SJe+o2FcAg6GBhGA==", "dev": true }, - "node_modules/http2-wrapper": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.1.tgz", - "integrity": "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==", - "dev": true, - "dependencies": { - "quick-lru": "^5.1.1", - "resolve-alpn": "^1.2.0" - }, - "engines": { - "node": ">=10.19.0" - } - }, "node_modules/https-proxy-agent": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", - "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", + "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", "dev": true, + "license": "MIT", "dependencies": { "agent-base": "^7.0.2", "debug": "4" @@ -4711,12 +5288,13 @@ } }, "node_modules/husky": { - "version": "9.0.11", - "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", - "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", + "version": "9.1.6", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.6.tgz", + "integrity": "sha512-sqbjZKK7kf44hfdE94EoX8MZNk0n7HeW37O4YrVGCF4wzgQjp+akPAkfUK5LZ6KuR/6sqeAVuXHji+RzQgOn5A==", "dev": true, + "license": "MIT", "bin": { - "husky": "bin.mjs" + "husky": "bin.js" }, "engines": { "node": ">=18" @@ -4726,10 +5304,11 @@ } }, "node_modules/ignore": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", - "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } @@ -4812,17 +5391,6 @@ "node": ">=18.0.0" } }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -4834,6 +5402,7 @@ "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.1.tgz", "integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==", "dev": true, + "license": "ISC", "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } @@ -4998,6 +5567,7 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -5029,6 +5599,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-node-process": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-node-process/-/is-node-process-1.2.0.tgz", + "integrity": "sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==", + "dev": true, + "license": "MIT" + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -5152,6 +5729,7 @@ "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz", "integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==", "dev": true, + "license": "MIT", "dependencies": { "text-extensions": "^2.0.0" }, @@ -5211,10 +5789,11 @@ "dev": true }, "node_modules/issue-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-7.0.0.tgz", - "integrity": "sha512-jgAw78HO3gs9UrKqJNQvfDj9Ouy8Mhu40fbEJ8yXff4MW8+/Fcn9iFjyWUQ6SKbX8ipPk3X5A3AyfYHRu6uVLw==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-7.0.1.tgz", + "integrity": "sha512-3YZcUUR2Wt1WsapF+S/WiA2WmlW0cWAoPccMqne7AxEBhCdFeTPjfv/Axb8V2gyCgY3nRw+ksZ3xSUX+R47iAg==", "dev": true, + "license": "MIT", "dependencies": { "lodash.capitalize": "^4.2.1", "lodash.escaperegexp": "^4.1.2", @@ -5231,6 +5810,7 @@ "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=8" } @@ -5240,6 +5820,7 @@ "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "istanbul-lib-coverage": "^3.0.0", "make-dir": "^4.0.0", @@ -5250,10 +5831,11 @@ } }, "node_modules/istanbul-lib-source-maps": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.4.tgz", - "integrity": "sha512-wHOoEsNJTVltaJp8eVkm8w+GVkVNHT2YDYo53YdzQEL2gWm1hBX5cGFR9hQJtuGLebidVX7et3+dmDZrmclduw==", + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz", + "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "@jridgewell/trace-mapping": "^0.3.23", "debug": "^4.1.1", @@ -5268,6 +5850,7 @@ "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "html-escaper": "^2.0.0", "istanbul-lib-report": "^3.0.0" @@ -5276,6 +5859,22 @@ "node": ">=8" } }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/java-properties": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/java-properties/-/java-properties-1.0.2.tgz", @@ -5286,10 +5885,11 @@ } }, "node_modules/jiti": { - "version": "1.21.3", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.3.tgz", - "integrity": "sha512-uy2bNX5zQ+tESe+TiC7ilGRz8AtRGmnJH55NC5S0nSUjvvvM2hJHmefHErugGXN4pNv4Qx7vLsnNw9qJ9mtIsw==", + "version": "1.21.6", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.6.tgz", + "integrity": "sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==", "dev": true, + "license": "MIT", "bin": { "jiti": "bin/jiti.js" } @@ -5312,12 +5912,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true - }, "node_modules/json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -5360,7 +5954,8 @@ "dev": true, "engines": [ "node >= 0.2.0" - ] + ], + "license": "MIT" }, "node_modules/jsonpointer": { "version": "5.0.1", @@ -5376,6 +5971,7 @@ "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", "dev": true, + "license": "(MIT OR Apache-2.0)", "dependencies": { "jsonparse": "^1.2.0", "through": ">=2.2.7 <3" @@ -5387,13 +5983,17 @@ "node": "*" } }, - "node_modules/keyv": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", - "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "node_modules/ky": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/ky/-/ky-1.7.2.tgz", + "integrity": "sha512-OzIvbHKKDpi60TnF9t7UUVAF1B4mcqc02z5PIvrm08Wyb+yOcz63GRvEuVxNT18a9E1SrNouhB4W2NNLeD7Ykg==", "dev": true, - "dependencies": { - "json-buffer": "3.0.1" + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sindresorhus/ky?sponsor=1" } }, "node_modules/levdist": { @@ -5403,10 +6003,11 @@ "dev": true }, "node_modules/lilconfig": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.1.tgz", - "integrity": "sha512-O18pf7nyvHTckunPWCV1XUNXU1piu01y2b7ATJ0ppkUkk8ocqVWBrYjJBCwHDjD/ZWcfyrA0P4gKhzWGi5EINQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz", + "integrity": "sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==", "dev": true, + "license": "MIT", "engines": { "node": ">=14" }, @@ -5430,21 +6031,22 @@ "dev": true }, "node_modules/lint-staged": { - "version": "15.2.5", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.5.tgz", - "integrity": "sha512-j+DfX7W9YUvdzEZl3Rk47FhDF6xwDBV5wwsCPw6BwWZVPYJemusQmvb9bRsW23Sqsaa+vRloAWogbK4BUuU2zA==", + "version": "15.2.10", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.10.tgz", + "integrity": "sha512-5dY5t743e1byO19P9I4b3x8HJwalIznL5E1FWYnU6OWw33KxNBSLAc6Cy7F2PsFEO8FKnLwjwm5hx7aMF0jzZg==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "~5.3.0", "commander": "~12.1.0", - "debug": "~4.3.4", + "debug": "~4.3.6", "execa": "~8.0.1", - "lilconfig": "~3.1.1", - "listr2": "~8.2.1", - "micromatch": "~4.0.7", + "lilconfig": "~3.1.2", + "listr2": "~8.2.4", + "micromatch": "~4.0.8", "pidtree": "~0.6.0", "string-argv": "~0.3.2", - "yaml": "~2.4.2" + "yaml": "~2.5.0" }, "bin": { "lint-staged": "bin/lint-staged.js" @@ -5457,16 +6059,17 @@ } }, "node_modules/listr2": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.2.1.tgz", - "integrity": "sha512-irTfvpib/rNiD637xeevjO2l3Z5loZmuaRi0L0YE5LfijwVY96oyVn0DFD3o/teAok7nfobMG1THvvcHh/BP6g==", + "version": "8.2.5", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.2.5.tgz", + "integrity": "sha512-iyAZCeyD+c1gPyE9qpFu8af0Y+MRtmKOncdGoA2S5EY8iFq99dmmvkNnHiWo+pj0s7yH7l3KPIgee77tKpXPWQ==", "dev": true, + "license": "MIT", "dependencies": { "cli-truncate": "^4.0.0", "colorette": "^2.0.20", "eventemitter3": "^5.0.1", - "log-update": "^6.0.0", - "rfdc": "^1.3.1", + "log-update": "^6.1.0", + "rfdc": "^1.4.1", "wrap-ansi": "^9.0.0" }, "engines": { @@ -5497,24 +6100,8 @@ "error-ex": "^1.3.1", "json-parse-better-errors": "^1.0.1" }, - "engines": { - "node": ">=4" - } - }, - "node_modules/local-pkg": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.0.tgz", - "integrity": "sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==", - "dev": true, - "dependencies": { - "mlly": "^1.4.2", - "pkg-types": "^1.0.3" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" + "engines": { + "node": ">=4" } }, "node_modules/locate-path": { @@ -5522,6 +6109,7 @@ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", "dev": true, + "license": "MIT", "dependencies": { "p-locate": "^6.0.0" }, @@ -5548,89 +6136,103 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.capitalize": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", "integrity": "sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.escaperegexp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", "integrity": "sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.isstring": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.kebabcase": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", "integrity": "sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.mergewith": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.snakecase": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.startcase": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", "integrity": "sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.uniqby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", "integrity": "sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.upperfirst": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz", "integrity": "sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/log-update": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.0.0.tgz", - "integrity": "sha512-niTvB4gqvtof056rRIrTZvjNYE4rCUzO6X/X+kYjd7WFxXeJ0NwEFnRxX6ehkvv3jTwrXnNdtAak5XYZuIyPFw==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz", + "integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-escapes": "^6.2.0", - "cli-cursor": "^4.0.0", - "slice-ansi": "^7.0.0", + "ansi-escapes": "^7.0.0", + "cli-cursor": "^5.0.0", + "slice-ansi": "^7.1.0", "strip-ansi": "^7.1.0", "wrap-ansi": "^9.0.0" }, @@ -5641,11 +6243,28 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/log-update/node_modules/ansi-escapes": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.0.0.tgz", + "integrity": "sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "environment": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/log-update/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -5658,6 +6277,7 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.0.0.tgz", "integrity": "sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==", "dev": true, + "license": "MIT", "dependencies": { "get-east-asian-width": "^1.0.0" }, @@ -5673,6 +6293,7 @@ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.0.tgz", "integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^6.2.1", "is-fullwidth-code-point": "^5.0.0" @@ -5689,6 +6310,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" }, @@ -5700,25 +6322,11 @@ } }, "node_modules/loupe": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", - "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", - "dev": true, - "dependencies": { - "get-func-name": "^2.0.1" - } - }, - "node_modules/lowercase-keys": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", - "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.2.tgz", + "integrity": "sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==", "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "license": "MIT" }, "node_modules/lru-cache": { "version": "10.2.0", @@ -5730,22 +6338,24 @@ } }, "node_modules/magic-string": { - "version": "0.30.10", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.10.tgz", - "integrity": "sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==", + "version": "0.30.12", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.12.tgz", + "integrity": "sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==", "dev": true, + "license": "MIT", "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15" + "@jridgewell/sourcemap-codec": "^1.5.0" } }, "node_modules/magicast": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.4.tgz", - "integrity": "sha512-TyDF/Pn36bBji9rWKHlZe+PZb6Mx5V8IHCSxk7X4aljM4e/vyDvZZYwHewdVaqiA0nb3ghfHU/6AUpDxWoER2Q==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz", + "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/parser": "^7.24.4", - "@babel/types": "^7.24.0", + "@babel/parser": "^7.25.4", + "@babel/types": "^7.25.4", "source-map-js": "^1.2.0" } }, @@ -5754,6 +6364,7 @@ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", "dev": true, + "license": "MIT", "dependencies": { "semver": "^7.5.3" }, @@ -5852,10 +6463,11 @@ } }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -5865,13 +6477,14 @@ } }, "node_modules/mime": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-4.0.1.tgz", - "integrity": "sha512-5lZ5tyrIfliMXzFtkYyekWbtRXObT9OWa8IwQ5uxTBDHucNNwniRqo0yInflj+iYi5CBa6qxadGzGarDfuEOxA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-4.0.4.tgz", + "integrity": "sha512-v8yqInVjhXyqP6+Kw4fV3ZzeMRqEW6FotRsKXjRS5VMTNIuXsdRoAvklpoRgSqXm6o9VNH4/C0mgedko9DdLsQ==", "dev": true, "funding": [ "https://github.com/sponsors/broofa" ], + "license": "MIT", "bin": { "mime": "bin/cli.js" }, @@ -5891,28 +6504,33 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/mimic-response": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-4.0.0.tgz", - "integrity": "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==", + "node_modules/mimic-function": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", + "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==", "dev": true, + "license": "MIT", "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, + "license": "ISC", "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/minimist": { @@ -5924,16 +6542,14 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/mlly": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.1.tgz", - "integrity": "sha512-rrVRZRELyQzrIUAVMHxP97kv+G786pHmOKzuFII8zDYahFBS7qnHh2AlYSl1GAHhaMPCz6/oHjVMcfFYgFYHgA==", + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, - "dependencies": { - "acorn": "^8.11.3", - "pathe": "^1.1.2", - "pkg-types": "^1.1.1", - "ufo": "^1.5.3" + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" } }, "node_modules/mnemonist": { @@ -5946,10 +6562,11 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" }, "node_modules/mz": { "version": "2.7.0", @@ -5973,6 +6590,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -5993,17 +6611,18 @@ "dev": true }, "node_modules/nock": { - "version": "13.5.4", - "resolved": "https://registry.npmjs.org/nock/-/nock-13.5.4.tgz", - "integrity": "sha512-yAyTfdeNJGGBFxWdzSKCBYxs5FxLbCg5X5Q4ets974hcQzG1+qCxvIyOo4j2Ry6MUlhWVMX4OoYDefAIIwupjw==", + "version": "14.0.0-beta.15", + "resolved": "https://registry.npmjs.org/nock/-/nock-14.0.0-beta.15.tgz", + "integrity": "sha512-rp72chatxoZbR/2cYHwtb+IX6n6kkanYKGN2PKn4c12JBrj9n4xGUKFykuQHB+Gkz3fynlikFbMH2LI6VoebuQ==", "dev": true, + "license": "MIT", "dependencies": { - "debug": "^4.1.0", + "@mswjs/interceptors": "^0.36.4", "json-stringify-safe": "^5.0.1", "propagate": "^2.0.0" }, "engines": { - "node": ">= 10.13" + "node": ">= 18" } }, "node_modules/node-emoji": { @@ -9087,15 +9706,6 @@ "integrity": "sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==", "dev": true }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, "node_modules/onetime": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", @@ -9111,14 +9721,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-cancelable": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-4.0.1.tgz", - "integrity": "sha512-wBowNApzd45EIKdO1LaU+LrMBwAcjfPaYtVzV3lmfM3gf8Z4CHZsiIqlM8TZZ8okYvh5A1cP6gTfCRQtwUpaUg==", + "node_modules/outvariant": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/outvariant/-/outvariant-1.4.3.tgz", + "integrity": "sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==", "dev": true, - "engines": { - "node": ">=14.16" - } + "license": "MIT" }, "node_modules/p-each-series": { "version": "3.0.0", @@ -9137,6 +9745,7 @@ "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-4.1.0.tgz", "integrity": "sha512-37/tPdZ3oJwHaS3gNJdenCDB3Tz26i9sjhnguBtvN0vYlRIiDNnvTWkuh+0hETV9rLPdJ3rlL3yVOYPIAnM8rw==", "dev": true, + "license": "MIT", "dependencies": { "p-map": "^7.0.1" }, @@ -9161,6 +9770,7 @@ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", "dev": true, + "license": "MIT", "dependencies": { "yocto-queue": "^1.0.0" }, @@ -9176,6 +9786,7 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", "dev": true, + "license": "MIT", "dependencies": { "p-limit": "^4.0.0" }, @@ -9191,6 +9802,7 @@ "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.2.tgz", "integrity": "sha512-z4cYYMMdKHzw4O5UkWJImbZynVIo0lSGTXc7bzB1e/rrDqkgGUNysK/o4bTr+0+xKvvLoTyGqYC4Fgljy9qe1Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" }, @@ -9219,6 +9831,13 @@ "node": ">=4" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/pandemonium": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/pandemonium/-/pandemonium-2.4.1.tgz", @@ -9296,19 +9915,11 @@ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", "dev": true, + "license": "MIT", "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -9318,11 +9929,29 @@ "node": ">=8" } }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -9331,22 +9960,25 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", + "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", "dev": true, + "license": "MIT", "engines": { - "node": "*" + "node": ">= 14.16" } }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.1", @@ -9365,6 +9997,7 @@ "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", "dev": true, + "license": "MIT", "bin": { "pidtree": "bin/pidtree.js" }, @@ -9452,17 +10085,6 @@ "node": ">=4" } }, - "node_modules/pkg-types": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.1.1.tgz", - "integrity": "sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==", - "dev": true, - "dependencies": { - "confbox": "^0.1.7", - "mlly": "^1.7.0", - "pathe": "^1.1.2" - } - }, "node_modules/possible-typed-array-names": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", @@ -9473,9 +10095,9 @@ } }, "node_modules/postcss": { - "version": "8.4.38", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", - "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", + "version": "8.4.48", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.48.tgz", + "integrity": "sha512-GCRK8F6+Dl7xYniR5a4FYbpBzU8XnZVeowqsQFYdcXuSbChgiks7qybSkbvnaeqv0G0B+dd9/jJgH8kkLDQeEA==", "dev": true, "funding": [ { @@ -9491,41 +10113,16 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.0.0", - "source-map-js": "^1.2.0" + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" } }, - "node_modules/pretty-format": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", - "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", - "dev": true, - "dependencies": { - "@jest/schemas": "^29.6.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/pretty-ms": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-9.0.0.tgz", @@ -9562,14 +10159,6 @@ "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", "dev": true }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "engines": { - "node": ">=6" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -9590,18 +10179,6 @@ } ] }, - "node_modules/quick-lru": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -9623,12 +10200,6 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, - "node_modules/react-is": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", - "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", - "dev": true - }, "node_modules/read-package-up": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/read-package-up/-/read-package-up-11.0.0.tgz", @@ -9806,12 +10377,6 @@ "node": ">=0.10.0" } }, - "node_modules/resolve-alpn": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", - "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", - "dev": true - }, "node_modules/resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", @@ -9826,71 +10391,44 @@ "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, - "node_modules/responselike": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", - "integrity": "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==", - "dev": true, - "dependencies": { - "lowercase-keys": "^3.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/restore-cursor": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", - "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", + "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", "dev": true, + "license": "MIT", "dependencies": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" + "onetime": "^7.0.0", + "signal-exit": "^4.1.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/restore-cursor/node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/restore-cursor/node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz", + "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", "dev": true, + "license": "MIT", "dependencies": { - "mimic-fn": "^2.1.0" + "mimic-function": "^5.0.0" }, "engines": { - "node": ">=6" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/restore-cursor/node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -9902,18 +10440,20 @@ } }, "node_modules/rfdc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.1.tgz", - "integrity": "sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==", - "dev": true + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", + "dev": true, + "license": "MIT" }, "node_modules/rollup": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz", - "integrity": "sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.25.0.tgz", + "integrity": "sha512-uVbClXmR6wvx5R1M3Od4utyLUxrmOcEm3pAtMphn73Apq19PDtHpgZoEvqH2YnnaNUuvKmg2DgRd2Sqv+odyqg==", "dev": true, + "license": "MIT", "dependencies": { - "@types/estree": "1.0.5" + "@types/estree": "1.0.6" }, "bin": { "rollup": "dist/bin/rollup" @@ -9923,22 +10463,24 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.18.0", - "@rollup/rollup-android-arm64": "4.18.0", - "@rollup/rollup-darwin-arm64": "4.18.0", - "@rollup/rollup-darwin-x64": "4.18.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.18.0", - "@rollup/rollup-linux-arm-musleabihf": "4.18.0", - "@rollup/rollup-linux-arm64-gnu": "4.18.0", - "@rollup/rollup-linux-arm64-musl": "4.18.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.18.0", - "@rollup/rollup-linux-riscv64-gnu": "4.18.0", - "@rollup/rollup-linux-s390x-gnu": "4.18.0", - "@rollup/rollup-linux-x64-gnu": "4.18.0", - "@rollup/rollup-linux-x64-musl": "4.18.0", - "@rollup/rollup-win32-arm64-msvc": "4.18.0", - "@rollup/rollup-win32-ia32-msvc": "4.18.0", - "@rollup/rollup-win32-x64-msvc": "4.18.0", + "@rollup/rollup-android-arm-eabi": "4.25.0", + "@rollup/rollup-android-arm64": "4.25.0", + "@rollup/rollup-darwin-arm64": "4.25.0", + "@rollup/rollup-darwin-x64": "4.25.0", + "@rollup/rollup-freebsd-arm64": "4.25.0", + "@rollup/rollup-freebsd-x64": "4.25.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.25.0", + "@rollup/rollup-linux-arm-musleabihf": "4.25.0", + "@rollup/rollup-linux-arm64-gnu": "4.25.0", + "@rollup/rollup-linux-arm64-musl": "4.25.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.25.0", + "@rollup/rollup-linux-riscv64-gnu": "4.25.0", + "@rollup/rollup-linux-s390x-gnu": "4.25.0", + "@rollup/rollup-linux-x64-gnu": "4.25.0", + "@rollup/rollup-linux-x64-musl": "4.25.0", + "@rollup/rollup-win32-arm64-msvc": "4.25.0", + "@rollup/rollup-win32-ia32-msvc": "4.25.0", + "@rollup/rollup-win32-x64-msvc": "4.25.0", "fsevents": "~2.3.2" } }, @@ -10013,14 +10555,15 @@ } }, "node_modules/semantic-release": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-24.0.0.tgz", - "integrity": "sha512-v46CRPw+9eI3ZuYGF2oAjqPqsfbnfFTwLBgQsv/lch4goD09ytwOTESMN4QIrx/wPLxUGey60/NMx+ANQtWRsA==", + "version": "24.2.0", + "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-24.2.0.tgz", + "integrity": "sha512-fQfn6e/aYToRtVJYKqneFM1Rg3KP2gh3wSWtpYsLlz6uaPKlISrTzvYAFn+mYWo07F0X1Cz5ucU89AVE8X1mbg==", "dev": true, + "license": "MIT", "dependencies": { "@semantic-release/commit-analyzer": "^13.0.0-beta.1", "@semantic-release/error": "^4.0.0", - "@semantic-release/github": "^10.0.0", + "@semantic-release/github": "^11.0.0", "@semantic-release/npm": "^12.0.0", "@semantic-release/release-notes-generator": "^14.0.0-beta.1", "aggregate-error": "^5.0.0", @@ -10033,7 +10576,7 @@ "get-stream": "^6.0.0", "git-log-parser": "^1.2.0", "hook-std": "^3.0.0", - "hosted-git-info": "^7.0.0", + "hosted-git-info": "^8.0.0", "import-from-esm": "^1.3.1", "lodash-es": "^4.17.21", "marked": "^12.0.0", @@ -10161,6 +10704,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/semantic-release/node_modules/hosted-git-info": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-8.0.0.tgz", + "integrity": "sha512-4nw3vOVR+vHUOT8+U4giwe2tcGv+R3pwwRidUe67DoMBTjhrfr6rZYJVVwdkBE+Um050SG+X9tf0Jo4fOpn01w==", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^10.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, "node_modules/semantic-release/node_modules/human-signals": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-7.0.0.tgz", @@ -10207,10 +10763,11 @@ } }, "node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -10374,7 +10931,8 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/signal-exit": { "version": "4.1.0", @@ -10487,6 +11045,7 @@ "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", "dev": true, + "license": "MIT", "engines": { "node": ">=14.16" }, @@ -10499,6 +11058,7 @@ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^6.0.0", "is-fullwidth-code-point": "^4.0.0" @@ -10520,10 +11080,11 @@ } }, "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -10578,13 +11139,15 @@ "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/std-env": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.7.0.tgz", - "integrity": "sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==", - "dev": true + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.0.tgz", + "integrity": "sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==", + "dev": true, + "license": "MIT" }, "node_modules/stream-combiner2": { "version": "1.1.1", @@ -10596,6 +11159,13 @@ "readable-stream": "^2.0.2" } }, + "node_modules/strict-event-emitter": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz", + "integrity": "sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==", + "dev": true, + "license": "MIT" + }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -10610,15 +11180,17 @@ "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.6.19" } }, "node_modules/string-width": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.1.0.tgz", - "integrity": "sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", "dev": true, + "license": "MIT", "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", @@ -10631,11 +11203,45 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/string-width/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -10648,6 +11254,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" }, @@ -10719,6 +11326,20 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -10749,24 +11370,6 @@ "node": ">=0.10.0" } }, - "node_modules/strip-literal": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.1.0.tgz", - "integrity": "sha512-Op+UycaUt/8FbN/Z2TWPBLge3jWrP3xj10f3fnYxf052bKuS3EKs1ZQcVGjnEMdsNVAM+plXRdmjrZ/KgG3Skw==", - "dev": true, - "dependencies": { - "js-tokens": "^9.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/strip-literal/node_modules/js-tokens": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.0.tgz", - "integrity": "sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ==", - "dev": true - }, "node_modules/subsume": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/subsume/-/subsume-4.0.0.tgz", @@ -10900,17 +11503,18 @@ } }, "node_modules/test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz", + "integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==", "dev": true, + "license": "ISC", "dependencies": { "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" + "glob": "^10.4.1", + "minimatch": "^9.0.4" }, "engines": { - "node": ">=8" + "node": ">=18" } }, "node_modules/text-extensions": { @@ -10918,6 +11522,7 @@ "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz", "integrity": "sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -10950,7 +11555,8 @@ "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/through2": { "version": "2.0.5", @@ -10978,36 +11584,47 @@ } }, "node_modules/tinybench": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.8.0.tgz", - "integrity": "sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==", - "dev": true + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.1.tgz", + "integrity": "sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==", + "dev": true, + "license": "MIT" }, "node_modules/tinypool": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.4.tgz", - "integrity": "sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.1.tgz", + "integrity": "sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=14.0.0" + "node": "^18.0.0 || >=20.0.0" } }, - "node_modules/tinyspy": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", - "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", + "node_modules/tinyrainbow": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-1.2.0.tgz", + "integrity": "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=14.0.0" } }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "node_modules/tinyspy": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", + "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", "dev": true, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=14.0.0" } }, "node_modules/to-regex-range": { @@ -11046,12 +11663,13 @@ } }, "node_modules/tsx": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.15.1.tgz", - "integrity": "sha512-k/6h17jA1KfUR7SpcteOa880zGmF56s8gMIcSqUR5avyNFi9nlCEKpMiHLrzrqyARGr52A/JablmGey1DEWbCA==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz", + "integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==", "dev": true, + "license": "MIT", "dependencies": { - "esbuild": "~0.21.4", + "esbuild": "~0.23.0", "get-tsconfig": "^4.7.5" }, "bin": { @@ -11064,20 +11682,12 @@ "fsevents": "~2.3.3" } }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/type-fest": { - "version": "4.15.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.15.0.tgz", - "integrity": "sha512-tB9lu0pQpX5KJq54g+oHOLumOx+pMep4RaM6liXh2PKmVRFF+/vAtUP0ZaJ0kOySfVNjF6doBWPHhBhISKdlIA==", + "version": "4.26.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.26.1.tgz", + "integrity": "sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=16" }, @@ -11179,10 +11789,11 @@ } }, "node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -11191,12 +11802,6 @@ "node": ">=14.17" } }, - "node_modules/ufo": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.3.tgz", - "integrity": "sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==", - "dev": true - }, "node_modules/uglify-js": { "version": "3.17.4", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", @@ -11226,10 +11831,11 @@ } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" }, "node_modules/unicode-emoji-modifier-base": { "version": "1.0.0", @@ -11271,7 +11877,8 @@ "version": "7.0.2", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz", "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/universalify": { "version": "2.0.1", @@ -11282,19 +11889,12 @@ "node": ">= 10.0.0" } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/url-join": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/url-join/-/url-join-5.0.0.tgz", "integrity": "sha512-n2huDr9h9yzd6exQVnH/jU5mr+Pfx08LRXXZhkLLetAMESRj+anQsTAh940iMrIetKAmry9coFuZQ2jY8/p3WA==", "dev": true, + "license": "MIT", "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } @@ -11374,14 +11974,15 @@ "dev": true }, "node_modules/vite": { - "version": "5.2.13", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.13.tgz", - "integrity": "sha512-SSq1noJfY9pR3I1TUENL3rQYDQCFqgD+lM6fTRAM8Nv6Lsg5hDLaXkjETVeBt+7vZBCMoibD+6IWnT2mJ+Zb/A==", + "version": "5.4.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", + "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", "dev": true, + "license": "MIT", "dependencies": { - "esbuild": "^0.20.1", - "postcss": "^8.4.38", - "rollup": "^4.13.0" + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" }, "bin": { "vite": "bin/vite.js" @@ -11400,6 +12001,7 @@ "less": "*", "lightningcss": "^1.21.0", "sass": "*", + "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.4.0" @@ -11417,6 +12019,9 @@ "sass": { "optional": true }, + "sass-embedded": { + "optional": true + }, "stylus": { "optional": true }, @@ -11429,15 +12034,15 @@ } }, "node_modules/vite-node": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.0.tgz", - "integrity": "sha512-de6HJgzC+TFzOu0NTC4RAIsyf/DY/ibWDYQUcuEA84EMHhcefTUGkjFHKKEJhQN4A+6I0u++kr3l36ZF2d7XRw==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.4.tgz", + "integrity": "sha512-kqa9v+oi4HwkG6g8ufRnb5AeplcRw8jUF6/7/Qz1qRQOXHImG8YnLbB+LLszENwFnoBl9xIf9nVdCFzNd7GQEg==", "dev": true, + "license": "MIT", "dependencies": { "cac": "^6.7.14", - "debug": "^4.3.4", - "pathe": "^1.1.1", - "picocolors": "^1.0.0", + "debug": "^4.3.7", + "pathe": "^1.1.2", "vite": "^5.0.0" }, "bin": { @@ -11451,13 +12056,14 @@ } }, "node_modules/vite/node_modules/@esbuild/aix-ppc64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", - "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "aix" @@ -11467,13 +12073,14 @@ } }, "node_modules/vite/node_modules/@esbuild/android-arm": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz", - "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -11483,13 +12090,14 @@ } }, "node_modules/vite/node_modules/@esbuild/android-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz", - "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -11499,13 +12107,14 @@ } }, "node_modules/vite/node_modules/@esbuild/android-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz", - "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -11515,13 +12124,14 @@ } }, "node_modules/vite/node_modules/@esbuild/darwin-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz", - "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -11531,13 +12141,14 @@ } }, "node_modules/vite/node_modules/@esbuild/darwin-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz", - "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -11547,13 +12158,14 @@ } }, "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz", - "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -11563,13 +12175,14 @@ } }, "node_modules/vite/node_modules/@esbuild/freebsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz", - "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -11579,13 +12192,14 @@ } }, "node_modules/vite/node_modules/@esbuild/linux-arm": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz", - "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -11595,13 +12209,14 @@ } }, "node_modules/vite/node_modules/@esbuild/linux-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz", - "integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -11611,13 +12226,14 @@ } }, "node_modules/vite/node_modules/@esbuild/linux-ia32": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz", - "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -11627,13 +12243,14 @@ } }, "node_modules/vite/node_modules/@esbuild/linux-loong64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz", - "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", "cpu": [ "loong64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -11643,13 +12260,14 @@ } }, "node_modules/vite/node_modules/@esbuild/linux-mips64el": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz", - "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", "cpu": [ "mips64el" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -11659,13 +12277,14 @@ } }, "node_modules/vite/node_modules/@esbuild/linux-ppc64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz", - "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -11675,13 +12294,14 @@ } }, "node_modules/vite/node_modules/@esbuild/linux-riscv64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz", - "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", "cpu": [ "riscv64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -11691,13 +12311,14 @@ } }, "node_modules/vite/node_modules/@esbuild/linux-s390x": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz", - "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", "cpu": [ "s390x" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -11707,13 +12328,14 @@ } }, "node_modules/vite/node_modules/@esbuild/linux-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz", - "integrity": "sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -11723,13 +12345,14 @@ } }, "node_modules/vite/node_modules/@esbuild/netbsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz", - "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "netbsd" @@ -11739,13 +12362,14 @@ } }, "node_modules/vite/node_modules/@esbuild/openbsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", - "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "openbsd" @@ -11755,13 +12379,14 @@ } }, "node_modules/vite/node_modules/@esbuild/sunos-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz", - "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "sunos" @@ -11771,13 +12396,14 @@ } }, "node_modules/vite/node_modules/@esbuild/win32-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz", - "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -11787,13 +12413,14 @@ } }, "node_modules/vite/node_modules/@esbuild/win32-ia32": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz", - "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -11803,13 +12430,14 @@ } }, "node_modules/vite/node_modules/@esbuild/win32-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz", - "integrity": "sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -11819,11 +12447,12 @@ } }, "node_modules/vite/node_modules/esbuild": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz", - "integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -11831,57 +12460,58 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.20.2", - "@esbuild/android-arm": "0.20.2", - "@esbuild/android-arm64": "0.20.2", - "@esbuild/android-x64": "0.20.2", - "@esbuild/darwin-arm64": "0.20.2", - "@esbuild/darwin-x64": "0.20.2", - "@esbuild/freebsd-arm64": "0.20.2", - "@esbuild/freebsd-x64": "0.20.2", - "@esbuild/linux-arm": "0.20.2", - "@esbuild/linux-arm64": "0.20.2", - "@esbuild/linux-ia32": "0.20.2", - "@esbuild/linux-loong64": "0.20.2", - "@esbuild/linux-mips64el": "0.20.2", - "@esbuild/linux-ppc64": "0.20.2", - "@esbuild/linux-riscv64": "0.20.2", - "@esbuild/linux-s390x": "0.20.2", - "@esbuild/linux-x64": "0.20.2", - "@esbuild/netbsd-x64": "0.20.2", - "@esbuild/openbsd-x64": "0.20.2", - "@esbuild/sunos-x64": "0.20.2", - "@esbuild/win32-arm64": "0.20.2", - "@esbuild/win32-ia32": "0.20.2", - "@esbuild/win32-x64": "0.20.2" + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" } }, "node_modules/vitest": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.0.tgz", - "integrity": "sha512-H5r/dN06swuFnzNFhq/dnz37bPXnq8xB2xB5JOVk8K09rUtoeNN+LHWkoQ0A/i3hvbUKKcCei9KpbxqHMLhLLA==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.4.tgz", + "integrity": "sha512-eDjxbVAJw1UJJCHr5xr/xM86Zx+YxIEXGAR+bmnEID7z9qWfoxpHw0zdobz+TQAFOLT+nEXz3+gx6nUJ7RgmlQ==", "dev": true, + "license": "MIT", "dependencies": { - "@vitest/expect": "1.6.0", - "@vitest/runner": "1.6.0", - "@vitest/snapshot": "1.6.0", - "@vitest/spy": "1.6.0", - "@vitest/utils": "1.6.0", - "acorn-walk": "^8.3.2", - "chai": "^4.3.10", - "debug": "^4.3.4", - "execa": "^8.0.1", - "local-pkg": "^0.5.0", - "magic-string": "^0.30.5", - "pathe": "^1.1.1", - "picocolors": "^1.0.0", - "std-env": "^3.5.0", - "strip-literal": "^2.0.0", - "tinybench": "^2.5.1", - "tinypool": "^0.8.3", + "@vitest/expect": "2.1.4", + "@vitest/mocker": "2.1.4", + "@vitest/pretty-format": "^2.1.4", + "@vitest/runner": "2.1.4", + "@vitest/snapshot": "2.1.4", + "@vitest/spy": "2.1.4", + "@vitest/utils": "2.1.4", + "chai": "^5.1.2", + "debug": "^4.3.7", + "expect-type": "^1.1.0", + "magic-string": "^0.30.12", + "pathe": "^1.1.2", + "std-env": "^3.7.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.1", + "tinypool": "^1.0.1", + "tinyrainbow": "^1.2.0", "vite": "^5.0.0", - "vite-node": "1.6.0", - "why-is-node-running": "^2.2.2" + "vite-node": "2.1.4", + "why-is-node-running": "^2.3.0" }, "bin": { "vitest": "vitest.mjs" @@ -11895,8 +12525,8 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "1.6.0", - "@vitest/ui": "1.6.0", + "@vitest/browser": "2.1.4", + "@vitest/ui": "2.1.4", "happy-dom": "*", "jsdom": "*" }, @@ -11988,10 +12618,11 @@ } }, "node_modules/why-is-node-running": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", - "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", "dev": true, + "license": "MIT", "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" @@ -12014,6 +12645,7 @@ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", @@ -12026,11 +12658,99 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -12043,6 +12763,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" }, @@ -12053,12 +12774,6 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", @@ -12078,10 +12793,11 @@ } }, "node_modules/yaml": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", - "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz", + "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", "dev": true, + "license": "ISC", "bin": { "yaml": "bin.mjs" }, @@ -12146,10 +12862,11 @@ } }, "node_modules/yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", + "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", "dev": true, + "license": "MIT", "engines": { "node": ">=12.20" }, diff --git a/package.json b/package.json index b07a14b..a645498 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "build": "tsc -p tsconfig.dist.json", "build:docs": "npx typedoc", "build:index": "node --import tsx/esm scripts/build-index.ts", + "build:types": "npx therefore -f src", "check:coverage": "vitest run --coverage=true", "check:project": "node-standards lint", "check:types": "tsc -p tsconfig.json", @@ -35,17 +36,17 @@ "split2": "^4.2.0" }, "devDependencies": { - "@skyleague/axioms": "^4.3.4", - "@skyleague/node-standards": "^7.1.0", - "@skyleague/therefore": "^5.8.8", + "@skyleague/axioms": "^4.5.2", + "@skyleague/node-standards": "^8.2.4", + "@skyleague/therefore": "^5.18.0", "@types/split2": "^4.2.3", "camelcase": "^8.0.0", - "got": "^14.3.0", - "nock": "^13.5.4", + "ky": "^1.7.2", + "nock": "^14.0.0-beta.15", "typescript": "^5.4.5" }, "peerDependencies": { - "got": "^14.3.0" + "ky": "^1.7.2" }, "engines": { "node": ">=20" diff --git a/src/accounting-interest-accrual/rest.client.ts b/src/accounting-interest-accrual/rest.client.ts index 5357632..df7f397 100644 --- a/src/accounting-interest-accrual/rest.client.ts +++ b/src/accounting-interest-accrual/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, InterestAccrualSearchCriteria, SearchResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, InterestAccrualSearchCriteria, SearchResponse } from './ * accounting/interestaccrual */ export class MambuAccountingInterestAccrual { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuAccountingInterestAccrual { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /accounting/interestaccrual:search + * * Allows search of interest accrual breakdown entries by various criteria. */ public search({ @@ -66,7 +70,7 @@ export class MambuAccountingInterestAccrual { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -78,10 +82,9 @@ export class MambuAccountingInterestAccrual { return this.awaitResponse( this.buildClient(auth).post('accounting/interestaccrual:search', { - json: body, + json: _body.right as InterestAccrualSearchCriteria, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: SearchResponse, @@ -89,6 +92,7 @@ export class MambuAccountingInterestAccrual { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } @@ -113,44 +117,45 @@ export class MambuAccountingInterestAccrual { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -158,8 +163,7 @@ export class MambuAccountingInterestAccrual { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -167,21 +171,21 @@ export class MambuAccountingInterestAccrual { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/accounting-rates/rest.client.ts b/src/accounting-rates/rest.client.ts index 15b41f7..bb9d2e4 100644 --- a/src/accounting-rates/rest.client.ts +++ b/src/accounting-rates/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { AccountingRate, ErrorResponse, GetAllResponse, PostAccountingRateDTO } from './rest.type.js' @@ -16,7 +16,7 @@ import { AccountingRate, ErrorResponse, GetAllResponse, PostAccountingRateDTO } * currencies/accountingRates */ export class MambuAccountingRates { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuAccountingRates { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /currencies/{currencyCode}/accountingRates + * * Create accounting rates */ public create({ @@ -70,7 +74,7 @@ export class MambuAccountingRates { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -82,9 +86,8 @@ export class MambuAccountingRates { return this.awaitResponse( this.buildClient(auth).post(`currencies/${path.currencyCode}/accountingRates`, { - json: body, + json: _body.right as PostAccountingRateDTO, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -94,10 +97,13 @@ export class MambuAccountingRates { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /currencies/{currencyCode}/accountingRates + * * Get accounting rates */ public getAll({ @@ -117,7 +123,7 @@ export class MambuAccountingRates { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -126,7 +132,6 @@ export class MambuAccountingRates { this.buildClient(auth).get(`currencies/${path.currencyCode}/accountingRates`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -135,6 +140,7 @@ export class MambuAccountingRates { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -159,44 +165,45 @@ export class MambuAccountingRates { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -204,8 +211,7 @@ export class MambuAccountingRates { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -213,21 +219,21 @@ export class MambuAccountingRates { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/accounting-reports/rest.client.ts b/src/accounting-reports/rest.client.ts index 51fdaf4..1d4ceb5 100644 --- a/src/accounting-reports/rest.client.ts +++ b/src/accounting-reports/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { AccountingReport, @@ -21,7 +21,7 @@ import { * accounting/reports */ export class MambuAccountingReports { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -36,22 +36,26 @@ export class MambuAccountingReports { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /accounting/reports + * * Create accounting report */ public create({ @@ -73,7 +77,7 @@ export class MambuAccountingReports { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -85,9 +89,8 @@ export class MambuAccountingReports { return this.awaitResponse( this.buildClient(auth).post('accounting/reports', { - json: body, + json: _body.right as AccountingReportGenerationInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -97,10 +100,13 @@ export class MambuAccountingReports { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /accounting/reports/{reportKey} + * * Get accounting reports */ public get({ @@ -114,7 +120,7 @@ export class MambuAccountingReports { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -122,7 +128,6 @@ export class MambuAccountingReports { return this.awaitResponse( this.buildClient(auth).get(`accounting/reports/${path.reportKey}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: AccountingReport, @@ -130,6 +135,7 @@ export class MambuAccountingReports { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -154,44 +160,45 @@ export class MambuAccountingReports { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -199,8 +206,7 @@ export class MambuAccountingReports { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -208,21 +214,21 @@ export class MambuAccountingReports { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/accounting-rules-configuration/rest.client.ts b/src/accounting-rules-configuration/rest.client.ts index d20bf23..8dae8ad 100644 --- a/src/accounting-rules-configuration/rest.client.ts +++ b/src/accounting-rules-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/accountingrules.yaml */ export class MambuAccountingRulesConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuAccountingRulesConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/accountingrules.yaml + * * Retrieve accounting rulesconfiguration */ public get({ @@ -54,22 +58,24 @@ export class MambuAccountingRulesConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/accountingrules.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/accountingrules.yaml + * * Update the current accounting rules configuration */ public update({ @@ -83,15 +89,13 @@ export class MambuAccountingRulesConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/accountingrules.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/accountingrules.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -99,50 +103,52 @@ export class MambuAccountingRulesConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -150,8 +156,7 @@ export class MambuAccountingRulesConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -159,21 +164,21 @@ export class MambuAccountingRulesConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/api-consumers/rest.client.ts b/src/api-consumers/rest.client.ts index 433b9d6..0696db5 100644 --- a/src/api-consumers/rest.client.ts +++ b/src/api-consumers/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ApiConsumer, @@ -25,7 +25,7 @@ import { * consumers */ export class MambuApiConsumers { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -40,22 +40,26 @@ export class MambuApiConsumers { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /consumers + * * Create API consumer */ public create({ @@ -72,7 +76,7 @@ export class MambuApiConsumers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -84,9 +88,8 @@ export class MambuApiConsumers { return this.awaitResponse( this.buildClient(auth).post('consumers', { - json: body, + json: _body.right as ApiConsumer, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -95,10 +98,13 @@ export class MambuApiConsumers { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /consumers/{apiConsumerId}/apikeys + * * Create API key */ public createApiKeyForConsumer({ @@ -122,7 +128,7 @@ export class MambuApiConsumers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -134,9 +140,8 @@ export class MambuApiConsumers { return this.awaitResponse( this.buildClient(auth).post(`consumers/${path.apiConsumerId}/apikeys`, { - json: body, + json: _body.right as ApiKeyInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -146,10 +151,13 @@ export class MambuApiConsumers { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /consumers/{apiConsumerId}/secretkeys + * * Create secret key */ public createSecretKeyForConsumer({ @@ -166,7 +174,7 @@ export class MambuApiConsumers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -174,7 +182,6 @@ export class MambuApiConsumers { return this.awaitResponse( this.buildClient(auth).post(`consumers/${path.apiConsumerId}/secretkeys`, { headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -184,10 +191,13 @@ export class MambuApiConsumers { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /consumers/{apiConsumerId} + * * Delete API consumer */ public delete({ @@ -202,15 +212,13 @@ export class MambuApiConsumers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`consumers/${path.apiConsumerId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`consumers/${path.apiConsumerId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -218,10 +226,13 @@ export class MambuApiConsumers { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * DELETE /consumers/{apiConsumerId}/apikeys/{apiKeyId} + * * Delete API key */ public deleteApiKeyForConsumer({ @@ -236,15 +247,13 @@ export class MambuApiConsumers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`consumers/${path.apiConsumerId}/apikeys/${path.apiKeyId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`consumers/${path.apiConsumerId}/apikeys/${path.apiKeyId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -252,10 +261,13 @@ export class MambuApiConsumers { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /consumers + * * Get all API consumers */ public getAll({ @@ -269,7 +281,7 @@ export class MambuApiConsumers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -278,7 +290,6 @@ export class MambuApiConsumers { this.buildClient(auth).get('consumers', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -286,10 +297,13 @@ export class MambuApiConsumers { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /consumers/{apiConsumerId} + * * Get API consumer */ public getById({ @@ -304,7 +318,7 @@ export class MambuApiConsumers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -312,7 +326,6 @@ export class MambuApiConsumers { return this.awaitResponse( this.buildClient(auth).get(`consumers/${path.apiConsumerId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: ApiConsumer, @@ -321,10 +334,13 @@ export class MambuApiConsumers { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /consumers/{apiConsumerId}/keys + * * Get API keys * * This endpoint allows you to get the API key ID and a six character clear text prefix of the API key. @@ -341,7 +357,7 @@ export class MambuApiConsumers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -349,7 +365,6 @@ export class MambuApiConsumers { return this.awaitResponse( this.buildClient(auth).get(`consumers/${path.apiConsumerId}/keys`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetKeysByConsumerIdResponse, @@ -358,10 +373,13 @@ export class MambuApiConsumers { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /consumers/{apiConsumerId} + * * Partially update API consumer */ public patch({ @@ -384,7 +402,7 @@ export class MambuApiConsumers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -396,9 +414,8 @@ export class MambuApiConsumers { return this.awaitResponse( this.buildClient(auth).patch(`consumers/${path.apiConsumerId}`, { - json: body, + json: _body.right as PatchRequest, headers: headers ?? {}, - responseType: 'text', }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -407,10 +424,13 @@ export class MambuApiConsumers { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PUT /consumers/{apiConsumerId} + * * Update API consumer */ public update({ @@ -434,7 +454,7 @@ export class MambuApiConsumers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -446,9 +466,8 @@ export class MambuApiConsumers { return this.awaitResponse( this.buildClient(auth).put(`consumers/${path.apiConsumerId}`, { - json: body, + json: _body.right as ApiConsumer, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -458,6 +477,7 @@ export class MambuApiConsumers { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -482,44 +502,45 @@ export class MambuApiConsumers { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -527,8 +548,7 @@ export class MambuApiConsumers { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -536,21 +556,21 @@ export class MambuApiConsumers { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/api-consumers/rest.type.ts b/src/api-consumers/rest.type.ts index 62b3910..21d962b 100644 --- a/src/api-consumers/rest.type.ts +++ b/src/api-consumers/rest.type.ts @@ -317,6 +317,7 @@ type Permissions = | 'PERFORM_REPAYMENTS_WITH_CUSTOM_AMOUNTS_ALLOCATION' | 'MANAGE_LOAN_ASSOCIATION' | 'MAKE_WITHDRAWAL_REDRAW' + | 'ENTER_REFUND' | 'VIEW_SAVINGS_ACCOUNT_DETAILS' | 'CREATE_SAVINGS_ACCOUNT' | 'EDIT_SAVINGS_ACCOUNT' @@ -346,6 +347,7 @@ type Permissions = | 'MAKE_BULK_CHANGE_INTEREST_AVAILABILITY' | 'MANAGE_DEPOSIT_ACCOUNT_RECIPIENT' | 'MANAGE_DEPOSIT_ASSOCIATION' + | 'BYPASS_ACCOUNT_OWNERSHIP_TRANSFER_VIEW_RESTRICTION' | 'CREATE_CARDS' | 'VIEW_CARDS' | 'DELETE_CARDS' @@ -475,44 +477,19 @@ type Permissions = | 'CREATE_MAMBU_FUNCTIONS_SECRETS' | 'EDIT_MAMBU_FUNCTIONS_SECRETS' | 'DELETE_MAMBU_FUNCTIONS_SECRETS' - | 'VIEW_CURRENT_USER_DETAILS' - | 'VIEW_PROFIT_SHARING_CLASSES' - | 'CREATE_PROFIT_SHARING_CLASSES' - | 'EDIT_PROFIT_SHARING_CLASSES' - | 'DELETE_PROFIT_SHARING_CLASSES' - | 'VIEW_PROFIT_SHARING_POOLS' + | 'VIEW_PROFIT_SHARING_PROPOSALS' + | 'CREATE_PROFIT_SHARING_CASH_FLOWS' + | 'VIEW_PROFIT_SHARING_CASH_FLOWS' + | 'EDIT_PROFIT_SHARING_CASH_FLOWS' + | 'DELETE_PROFIT_SHARING_CASH_FLOWS' | 'CREATE_PROFIT_SHARING_POOLS' + | 'VIEW_PROFIT_SHARING_POOLS' | 'EDIT_PROFIT_SHARING_POOLS' | 'DELETE_PROFIT_SHARING_POOLS' - | 'VIEW_PROFIT_SHARING_INCOME_CATEGORIES' - | 'CREATE_PROFIT_SHARING_INCOME_CATEGORIES' - | 'EDIT_PROFIT_SHARING_INCOME_CATEGORIES' - | 'DELETE_PROFIT_SHARING_INCOME_CATEGORIES' - | 'VIEW_PROFIT_SHARING_PROPOSALS' - | 'EDIT_PROFIT_SHARING_PROPOSALS' - | 'CREATE_PROFIT_SHARING_PROPOSALS' - | 'APPROVE_PROFIT_SHARING_PROPOSALS' - | 'ADJUST_PROFIT_SHARING_PROPOSALS' - | 'TRIGGER_COMPUTATION' - | 'VIEW_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'CREATE_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'EDIT_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'DELETE_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'VIEW_PROFIT_SHARING_EXPENSES' - | 'CREATE_PROFIT_SHARING_EXPENSES' - | 'EDIT_PROFIT_SHARING_EXPENSES' - | 'DELETE_PROFIT_SHARING_EXPENSES' - | 'VIEW_PROFIT_SHARING_DEDUCTIONS' - | 'CREATE_PROFIT_SHARING_DEDUCTIONS' - | 'EDIT_PROFIT_SHARING_DEDUCTIONS' - | 'DELETE_PROFIT_SHARING_DEDUCTIONS' - | 'VIEW_PROFIT_SHARING_DEPOSIT_PRODUCTS' - | 'EDIT_PROFIT_SHARING_DEPOSIT_PRODUCT_LINK' - | 'VIEW_PROFIT_SHARING_ACCOUNTS_SETTINGS' - | 'CREATE_PROFIT_SHARING_ACCOUNT_SETTINGS' - | 'EDIT_PROFIT_SHARING_ACCOUNT_SETTINGS' - | 'VIEW_PROFIT_SHARING_GL_ACCOUNTS' - | 'VIEW_PROFIT_SHARING_BRANCHES' + | 'CREATE_PROFIT_SHARING_PRODUCT_SETTINGS' + | 'VIEW_PROFIT_SHARING_PRODUCT_SETTINGS' + | 'EDIT_PROFIT_SHARING_PRODUCT_SETTINGS' + | 'DELETE_PROFIT_SHARING_PRODUCT_SETTINGS' export interface RestError { errorCode?: number | undefined diff --git a/src/api-consumers/schemas/api-consumer.schema.js b/src/api-consumers/schemas/api-consumer.schema.js index 782daf4..5ac5916 100644 --- a/src/api-consumers/schemas/api-consumer.schema.js +++ b/src/api-consumers/schemas/api-consumer.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApiConsumer","type":"object","description":"Represents an API consumer.","properties":{"access":{"$ref":"#/$defs/ApiConsumerAccess"},"assignedBranchKey":{"type":"string","description":"The encoded key of the branch this API consumer is assigned to."},"creationDate":{"type":"string","description":"The date when the API consumer was created in UTC.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"id":{"type":"string","description":"The ID of the API consumer."},"lastModifiedDate":{"type":"string","description":"The last time the API consumer was modified in UTC.","format":"date-time"},"name":{"type":"string","description":"The API consumer name."},"role":{"$ref":"#/$defs/RoleIdentifier"},"transactionLimits":{"type":"object","description":"The API consumer transaction limits.","additionalProperties":{"type":"integer"}}},"required":["name"],"additionalProperties":true,"$defs":{"ApiConsumerAccess":{"type":"object","description":"Represents the API consumer permissions and access rights.","properties":{"administratorAccess":{"type":"boolean","description":"`TRUE` if the API consumer has the administrator user type, `FALSE` otherwise. Administrators (admins) have all permissions and can perform any action in Mambu."},"apiAccess":{"type":"boolean","description":"`TRUE` if the API consumer can authenticate and interact with Mambu APIs, `FALSE` otherwise. The API consumer may still require additional permissions for specific API requests."},"canManageAllBranches":{"type":"boolean","description":"`TRUE` if the API consumer permissions apply to all branches, `FALSE` if they only apply to specific branches."},"canManageEntitiesAssignedToOtherOfficers":{"type":"boolean","description":"`TRUE` if the API consumer (that has the credit officer access) can access entities (for example, clients or accounts) assigned to other credit officers, `FALSE` otherwise."},"creditOfficerAccess":{"type":"boolean","description":"`TRUE` if the API consumer has the credit officer user type, `FALSE` otherwise. Credit officers have the option of having clients and groups assigned to them."},"managedBranches":{"type":"array","description":"The list of branches that can be managed by the API consumer. If the API consumer has the `canManageAllBranches` property set to `TRUE`, this list does not apply.","items":{"$ref":"#/$defs/UserManagedBranch"}},"permissions":{"type":"array","description":"Permissions for the API consumer. The non-admin API consumers and users are authorized to do actions based a set of permissions in order to access Mambu features. Permissions may be relevant for the API and/or the Mambu UI.","items":{"enum":["AUDIT_TRANSACTIONS","VIEW_EXCHANGE_RATES","CREATE_EXCHANGE_RATE","VIEW_LOAN_ACCOUNT_DETAILS","CREATE_LOAN_ACCOUNT","EDIT_LOAN_ACCOUNT","APPROVE_LOANS","DIBURSE_LOANS","APPLY_LOAN_FEES","ENTER_REPAYMENT","EDIT_PLANNED_FEES","EDIT_REPAYMENT_SCHEDULE","APPLY_LOAN_ADJUSTMENTS","BACKDATE_LOAN_TRANSACTIONS","APPLY_ACCRUED_LOAN_INTEREST","POST_TRANSACTIONS_ON_LOCKED_LOAN_ACCOUNTS","EDIT_PENALTY_RATE","VIEW_INVESTOR_FUNDS_DETAILS","CREATE_INVESTOR_FUNDS","EDIT_INVESTOR_FUNDS","DELETE_INVESTOR_FUNDS","SELL_LOAN_FRACTION","REQUEST_LOAN_APPROVAL","EDIT_LOAN_TRANCHES","REJECT_LOANS","WRITE_OFF_LOAN_ACCOUNTS","PAY_OFF_LOAN","REVERSE_LOAN_ACCOUNT_WRITE_OFF","CLOSE_LOAN_ACCOUNTS","LOCK_LOAN_ACCOUNTS","WITHDRAW_LOAN_ACCOUNTS","DELETE_LOAN_ACCOUNT","SET_DISBURSEMENT_CONDITIONS","RESCHEDULE_LOAN_ACCOUNT","REFINANCE_LOAN_ACCOUNT","EDIT_LOAN_TRANSACTIONS","BULK_LOAN_CORRECTIONS","EDIT_INTEREST_RATE","EDIT_REPAYMENT_METHOD_VALUE","EDIT_PERIODIC_PAYMENT_FOR_ACTIVE_ACCOUNT","UNDO_LOAN_ACCOUNT_CLOSURE","UNDO_REJECT_LOANS","UNDO_WITHDRAW_LOAN_ACCOUNTS","LINK_ACCOUNTS","EDIT_PRINCIPAL_PAYMENT_ACTIVE_REVOLVING_CREDIT","PERFORM_REPAYMENTS_WITH_CUSTOM_AMOUNTS_ALLOCATION","MANAGE_LOAN_ASSOCIATION","MAKE_WITHDRAWAL_REDRAW","VIEW_SAVINGS_ACCOUNT_DETAILS","CREATE_SAVINGS_ACCOUNT","EDIT_SAVINGS_ACCOUNT","APPROVE_SAVINGS","MAKE_DEPOSIT","MAKE_BULK_DEPOSITS","MAKE_WITHDRAWAL","BACKDATE_SAVINGS_TRANSACTIONS","APPLY_SAVINGS_ADJUSTMENTS","MAKE_TRANSFER","MAKE_INTER_CLIENTS_TRANSFERS","CLOSE_SAVINGS_ACCOUNTS","REOPEN_SAVINGS_ACCOUNT","APPLY_SAVINGS_FEES","DELETE_SAVINGS_ACCOUNT","POST_TRANSACTIONS_ON_DORMANT_ACCOUNTS","EDIT_SAVINGS_TRANSACTIONS","BULK_DEPOSIT_CORRECTIONS","ACTIVATE_MATURITY","APPLY_ACCRUED_SAVINGS_INTEREST","LOCK_SAVINGS_ACCOUNT","UNLOCK_SAVINGS_ACCOUNT","UNDO_MATURITY","MAKE_EARLY_WITHDRAWALS","BLOCK_AND_SEIZE_FUNDS","WITHDRAW_BLOCKED_FUNDS","MAKE_BULK_CHANGE_INTEREST_AVAILABILITY","MANAGE_DEPOSIT_ACCOUNT_RECIPIENT","MANAGE_DEPOSIT_ASSOCIATION","CREATE_CARDS","VIEW_CARDS","DELETE_CARDS","REVERSE_CARD_WITHDRAWAL_TRANSACTION","CARD_BALANCE_INQUIRY","CREATE_AUTHORIZATION_HOLD","UPDATE_AUTHORIZATION_HOLD","VIEW_AUTHORIZATION_HOLD","CREATE_CARD_TRANSACTION","CREATE_ACCOUNT_HOLD","UPDATE_ACCOUNT_HOLD","VIEW_ACCOUNT_HOLD","VIEW_SECURITIES_DETAILS","CREATE_SECURITIES","EDIT_SECURITIES","DELETE_SECURITIES","CREATE_LINES_OF_CREDIT","EDIT_LINES_OF_CREDIT","VIEW_LINE_OF_CREDIT_DETAILS","ADD_ACCOUNTS_TO_LINE_OF_CREDIT","REMOVE_ACCOUNTS_FROM_LINE_OF_CREDIT","APPROVE_LINE_OF_CREDIT","UNDO_APPROVE_LINE_OF_CREDIT","WITHDRAW_LINE_OF_CREDIT","UNDO_WITHDRAW_LINE_OF_CREDIT","REJECT_LINE_OF_CREDIT","UNDO_REJECT_LINE_OF_CREDIT","CLOSE_LINES_OF_CREDIT","DELETE_LINES_OF_CREDIT","VIEW_LOAN_PRODUCT_DETAILS","CREATE_LOAN_PRODUCT","DELETE_LOAN_PRODUCTS","EDIT_LOAN_PRODUCT","VIEW_SAVINGS_PRODUCT_DETAILS","CREATE_SAVINGS_PRODUCT","EDIT_SAVINGS_PRODUCT","DELETE_SAVINGS_PRODUCT","VIEW_CLIENT_DETAILS","CREATE_CLIENT","EDIT_CLIENT","DELETE_CLIENTS","VIEW_GROUP_DETAILS","CREATE_GROUP","EDIT_GROUP","DELETE_GROUP","CHANGE_CLIENT_TYPE","CHANGE_GROUP_TYPE","APPROVE_CLIENT","REJECT_CLIENT","EXIT_CLIENT","BLACKLIST_CLIENT","UNDO_CLIENT_STATE_CHANGED","ANONYMIZE_CLIENT","MANAGE_CLIENT_ASSOCIATION","MANAGE_GROUP_ASSOCIATION","EDIT_CLIENT_ID","EDIT_GROUP_ID","EDIT_BLACKLISTED_CLIENT_CFV","VIEW_ACCOUNTING_REPORTS","LOG_JOURNAL_ENTRIES","BOOKING_DATE_LOANS_GL","BOOKING_DATE_SAVINGS_GL","RECTIFY_ADJUSTMENT","VIEW_ACCOUNTING_RATES","CREATE_ACCOUNTING_RATES","VIEW_DOCUMENTS","CREATE_DOCUMENTS","EDIT_DOCUMENTS","DELETE_DOCUMENTS","VIEW_TASK","CREATE_TASK","EDIT_TASK","DELETE_TASK","VIEW_USER_DETAILS","CREATE_USER","EDIT_USER","DELETE_USER","VIEW_ROLE","CREATE_ROLE","EDIT_ROLE","DELETE_ROLE","RESEND_FAILED_MESSAGES","SEND_MANUAL_SMS","SEND_MANUAL_EMAIL","GET_MANAGE_CONFIGURATION_AS_CODE","PUT_MANAGE_CONFIGURATION_AS_CODE","MANAGE_RISK_LEVELS","MANAGE_EOD_PROCESSING","MANAGE_CURRENCIES","VIEW_INTELLIGENCE","CREATE_INDEX_RATE","VIEW_COMMENTS","CREATE_COMMENTS","EDIT_COMMENTS","VIEW_COMMUNICATION_HISTORY","DOWNLOAD_BACKUPS","IMPORT_DATA","VIEW_TRANSACTION_CHANNELS","CREATE_TRANSACTION_CHANNELS","EDIT_TRANSACTION_CHANNELS","DELETE_TRANSACTION_CHANNELS","POST_TRANSACTIONS_WITHOUT_OPENED_TILL","VIEW_CUSTOM_FIELD","VIEW_BRANCH_DETAILS","CREATE_BRANCH","EDIT_BRANCH","VIEW_CENTRE_DETAILS","CREATE_CENTRE","EDIT_CENTRE","DELETE_CENTRE","MANAGE_HOLIDAYS","MANAGE_INDEX_RATES","MANAGE_EVENTS_STREAMING","MANAGE_AUDIT_TRAIL","MANAGE_PAYMENTS","MANAGE_CARDS_CAPABILITY","CREATE_API_CONSUMERS_AND_KEYS","DELETE_API_CONSUMERS_AND_KEYS","EDIT_API_CONSUMERS_AND_KEYS","VIEW_API_CONSUMERS_AND_KEYS","MANAGE_NOTIFICATIONS","VIEW_MAMBU_FUNCTIONS","CREATE_MAMBU_FUNCTIONS","EDIT_MAMBU_FUNCTIONS","DELETE_MAMBU_FUNCTIONS","VIEW_MAMBU_FUNCTIONS_SECRETS","CREATE_MAMBU_FUNCTIONS_SECRETS","EDIT_MAMBU_FUNCTIONS_SECRETS","DELETE_MAMBU_FUNCTIONS_SECRETS","VIEW_CURRENT_USER_DETAILS","VIEW_PROFIT_SHARING_CLASSES","CREATE_PROFIT_SHARING_CLASSES","EDIT_PROFIT_SHARING_CLASSES","DELETE_PROFIT_SHARING_CLASSES","VIEW_PROFIT_SHARING_POOLS","CREATE_PROFIT_SHARING_POOLS","EDIT_PROFIT_SHARING_POOLS","DELETE_PROFIT_SHARING_POOLS","VIEW_PROFIT_SHARING_INCOME_CATEGORIES","CREATE_PROFIT_SHARING_INCOME_CATEGORIES","EDIT_PROFIT_SHARING_INCOME_CATEGORIES","DELETE_PROFIT_SHARING_INCOME_CATEGORIES","VIEW_PROFIT_SHARING_PROPOSALS","EDIT_PROFIT_SHARING_PROPOSALS","CREATE_PROFIT_SHARING_PROPOSALS","APPROVE_PROFIT_SHARING_PROPOSALS","ADJUST_PROFIT_SHARING_PROPOSALS","TRIGGER_COMPUTATION","VIEW_PROFIT_SHARING_SYSTEM_OPTIONS","CREATE_PROFIT_SHARING_SYSTEM_OPTIONS","EDIT_PROFIT_SHARING_SYSTEM_OPTIONS","DELETE_PROFIT_SHARING_SYSTEM_OPTIONS","VIEW_PROFIT_SHARING_EXPENSES","CREATE_PROFIT_SHARING_EXPENSES","EDIT_PROFIT_SHARING_EXPENSES","DELETE_PROFIT_SHARING_EXPENSES","VIEW_PROFIT_SHARING_DEDUCTIONS","CREATE_PROFIT_SHARING_DEDUCTIONS","EDIT_PROFIT_SHARING_DEDUCTIONS","DELETE_PROFIT_SHARING_DEDUCTIONS","VIEW_PROFIT_SHARING_DEPOSIT_PRODUCTS","EDIT_PROFIT_SHARING_DEPOSIT_PRODUCT_LINK","VIEW_PROFIT_SHARING_ACCOUNTS_SETTINGS","CREATE_PROFIT_SHARING_ACCOUNT_SETTINGS","EDIT_PROFIT_SHARING_ACCOUNT_SETTINGS","VIEW_PROFIT_SHARING_GL_ACCOUNTS","VIEW_PROFIT_SHARING_BRANCHES"]}}},"additionalProperties":true},"UserManagedBranch":{"type":"object","description":"Represents a branch that can be managed by the user or API consumer.","properties":{"branchKey":{"type":"string","description":"The encoded key of the branch, it is automatically generated."}},"additionalProperties":true},"RoleIdentifier":{"type":"object","description":"Represents the role identifier.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated automatically, globally unique."},"id":{"type":"string","description":"The ID of the role, which can be generated and customized, but must be unique."}},"additionalProperties":true}}};const schema14 = {"type":"object","description":"Represents the role identifier.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated automatically, globally unique."},"id":{"type":"string","description":"The ID of the role, which can be generated and customized, but must be unique."}},"additionalProperties":true};const schema12 = {"type":"object","description":"Represents the API consumer permissions and access rights.","properties":{"administratorAccess":{"type":"boolean","description":"`TRUE` if the API consumer has the administrator user type, `FALSE` otherwise. Administrators (admins) have all permissions and can perform any action in Mambu."},"apiAccess":{"type":"boolean","description":"`TRUE` if the API consumer can authenticate and interact with Mambu APIs, `FALSE` otherwise. The API consumer may still require additional permissions for specific API requests."},"canManageAllBranches":{"type":"boolean","description":"`TRUE` if the API consumer permissions apply to all branches, `FALSE` if they only apply to specific branches."},"canManageEntitiesAssignedToOtherOfficers":{"type":"boolean","description":"`TRUE` if the API consumer (that has the credit officer access) can access entities (for example, clients or accounts) assigned to other credit officers, `FALSE` otherwise."},"creditOfficerAccess":{"type":"boolean","description":"`TRUE` if the API consumer has the credit officer user type, `FALSE` otherwise. Credit officers have the option of having clients and groups assigned to them."},"managedBranches":{"type":"array","description":"The list of branches that can be managed by the API consumer. If the API consumer has the `canManageAllBranches` property set to `TRUE`, this list does not apply.","items":{"$ref":"#/$defs/UserManagedBranch"}},"permissions":{"type":"array","description":"Permissions for the API consumer. The non-admin API consumers and users are authorized to do actions based a set of permissions in order to access Mambu features. Permissions may be relevant for the API and/or the Mambu UI.","items":{"enum":["AUDIT_TRANSACTIONS","VIEW_EXCHANGE_RATES","CREATE_EXCHANGE_RATE","VIEW_LOAN_ACCOUNT_DETAILS","CREATE_LOAN_ACCOUNT","EDIT_LOAN_ACCOUNT","APPROVE_LOANS","DIBURSE_LOANS","APPLY_LOAN_FEES","ENTER_REPAYMENT","EDIT_PLANNED_FEES","EDIT_REPAYMENT_SCHEDULE","APPLY_LOAN_ADJUSTMENTS","BACKDATE_LOAN_TRANSACTIONS","APPLY_ACCRUED_LOAN_INTEREST","POST_TRANSACTIONS_ON_LOCKED_LOAN_ACCOUNTS","EDIT_PENALTY_RATE","VIEW_INVESTOR_FUNDS_DETAILS","CREATE_INVESTOR_FUNDS","EDIT_INVESTOR_FUNDS","DELETE_INVESTOR_FUNDS","SELL_LOAN_FRACTION","REQUEST_LOAN_APPROVAL","EDIT_LOAN_TRANCHES","REJECT_LOANS","WRITE_OFF_LOAN_ACCOUNTS","PAY_OFF_LOAN","REVERSE_LOAN_ACCOUNT_WRITE_OFF","CLOSE_LOAN_ACCOUNTS","LOCK_LOAN_ACCOUNTS","WITHDRAW_LOAN_ACCOUNTS","DELETE_LOAN_ACCOUNT","SET_DISBURSEMENT_CONDITIONS","RESCHEDULE_LOAN_ACCOUNT","REFINANCE_LOAN_ACCOUNT","EDIT_LOAN_TRANSACTIONS","BULK_LOAN_CORRECTIONS","EDIT_INTEREST_RATE","EDIT_REPAYMENT_METHOD_VALUE","EDIT_PERIODIC_PAYMENT_FOR_ACTIVE_ACCOUNT","UNDO_LOAN_ACCOUNT_CLOSURE","UNDO_REJECT_LOANS","UNDO_WITHDRAW_LOAN_ACCOUNTS","LINK_ACCOUNTS","EDIT_PRINCIPAL_PAYMENT_ACTIVE_REVOLVING_CREDIT","PERFORM_REPAYMENTS_WITH_CUSTOM_AMOUNTS_ALLOCATION","MANAGE_LOAN_ASSOCIATION","MAKE_WITHDRAWAL_REDRAW","VIEW_SAVINGS_ACCOUNT_DETAILS","CREATE_SAVINGS_ACCOUNT","EDIT_SAVINGS_ACCOUNT","APPROVE_SAVINGS","MAKE_DEPOSIT","MAKE_BULK_DEPOSITS","MAKE_WITHDRAWAL","BACKDATE_SAVINGS_TRANSACTIONS","APPLY_SAVINGS_ADJUSTMENTS","MAKE_TRANSFER","MAKE_INTER_CLIENTS_TRANSFERS","CLOSE_SAVINGS_ACCOUNTS","REOPEN_SAVINGS_ACCOUNT","APPLY_SAVINGS_FEES","DELETE_SAVINGS_ACCOUNT","POST_TRANSACTIONS_ON_DORMANT_ACCOUNTS","EDIT_SAVINGS_TRANSACTIONS","BULK_DEPOSIT_CORRECTIONS","ACTIVATE_MATURITY","APPLY_ACCRUED_SAVINGS_INTEREST","LOCK_SAVINGS_ACCOUNT","UNLOCK_SAVINGS_ACCOUNT","UNDO_MATURITY","MAKE_EARLY_WITHDRAWALS","BLOCK_AND_SEIZE_FUNDS","WITHDRAW_BLOCKED_FUNDS","MAKE_BULK_CHANGE_INTEREST_AVAILABILITY","MANAGE_DEPOSIT_ACCOUNT_RECIPIENT","MANAGE_DEPOSIT_ASSOCIATION","CREATE_CARDS","VIEW_CARDS","DELETE_CARDS","REVERSE_CARD_WITHDRAWAL_TRANSACTION","CARD_BALANCE_INQUIRY","CREATE_AUTHORIZATION_HOLD","UPDATE_AUTHORIZATION_HOLD","VIEW_AUTHORIZATION_HOLD","CREATE_CARD_TRANSACTION","CREATE_ACCOUNT_HOLD","UPDATE_ACCOUNT_HOLD","VIEW_ACCOUNT_HOLD","VIEW_SECURITIES_DETAILS","CREATE_SECURITIES","EDIT_SECURITIES","DELETE_SECURITIES","CREATE_LINES_OF_CREDIT","EDIT_LINES_OF_CREDIT","VIEW_LINE_OF_CREDIT_DETAILS","ADD_ACCOUNTS_TO_LINE_OF_CREDIT","REMOVE_ACCOUNTS_FROM_LINE_OF_CREDIT","APPROVE_LINE_OF_CREDIT","UNDO_APPROVE_LINE_OF_CREDIT","WITHDRAW_LINE_OF_CREDIT","UNDO_WITHDRAW_LINE_OF_CREDIT","REJECT_LINE_OF_CREDIT","UNDO_REJECT_LINE_OF_CREDIT","CLOSE_LINES_OF_CREDIT","DELETE_LINES_OF_CREDIT","VIEW_LOAN_PRODUCT_DETAILS","CREATE_LOAN_PRODUCT","DELETE_LOAN_PRODUCTS","EDIT_LOAN_PRODUCT","VIEW_SAVINGS_PRODUCT_DETAILS","CREATE_SAVINGS_PRODUCT","EDIT_SAVINGS_PRODUCT","DELETE_SAVINGS_PRODUCT","VIEW_CLIENT_DETAILS","CREATE_CLIENT","EDIT_CLIENT","DELETE_CLIENTS","VIEW_GROUP_DETAILS","CREATE_GROUP","EDIT_GROUP","DELETE_GROUP","CHANGE_CLIENT_TYPE","CHANGE_GROUP_TYPE","APPROVE_CLIENT","REJECT_CLIENT","EXIT_CLIENT","BLACKLIST_CLIENT","UNDO_CLIENT_STATE_CHANGED","ANONYMIZE_CLIENT","MANAGE_CLIENT_ASSOCIATION","MANAGE_GROUP_ASSOCIATION","EDIT_CLIENT_ID","EDIT_GROUP_ID","EDIT_BLACKLISTED_CLIENT_CFV","VIEW_ACCOUNTING_REPORTS","LOG_JOURNAL_ENTRIES","BOOKING_DATE_LOANS_GL","BOOKING_DATE_SAVINGS_GL","RECTIFY_ADJUSTMENT","VIEW_ACCOUNTING_RATES","CREATE_ACCOUNTING_RATES","VIEW_DOCUMENTS","CREATE_DOCUMENTS","EDIT_DOCUMENTS","DELETE_DOCUMENTS","VIEW_TASK","CREATE_TASK","EDIT_TASK","DELETE_TASK","VIEW_USER_DETAILS","CREATE_USER","EDIT_USER","DELETE_USER","VIEW_ROLE","CREATE_ROLE","EDIT_ROLE","DELETE_ROLE","RESEND_FAILED_MESSAGES","SEND_MANUAL_SMS","SEND_MANUAL_EMAIL","GET_MANAGE_CONFIGURATION_AS_CODE","PUT_MANAGE_CONFIGURATION_AS_CODE","MANAGE_RISK_LEVELS","MANAGE_EOD_PROCESSING","MANAGE_CURRENCIES","VIEW_INTELLIGENCE","CREATE_INDEX_RATE","VIEW_COMMENTS","CREATE_COMMENTS","EDIT_COMMENTS","VIEW_COMMUNICATION_HISTORY","DOWNLOAD_BACKUPS","IMPORT_DATA","VIEW_TRANSACTION_CHANNELS","CREATE_TRANSACTION_CHANNELS","EDIT_TRANSACTION_CHANNELS","DELETE_TRANSACTION_CHANNELS","POST_TRANSACTIONS_WITHOUT_OPENED_TILL","VIEW_CUSTOM_FIELD","VIEW_BRANCH_DETAILS","CREATE_BRANCH","EDIT_BRANCH","VIEW_CENTRE_DETAILS","CREATE_CENTRE","EDIT_CENTRE","DELETE_CENTRE","MANAGE_HOLIDAYS","MANAGE_INDEX_RATES","MANAGE_EVENTS_STREAMING","MANAGE_AUDIT_TRAIL","MANAGE_PAYMENTS","MANAGE_CARDS_CAPABILITY","CREATE_API_CONSUMERS_AND_KEYS","DELETE_API_CONSUMERS_AND_KEYS","EDIT_API_CONSUMERS_AND_KEYS","VIEW_API_CONSUMERS_AND_KEYS","MANAGE_NOTIFICATIONS","VIEW_MAMBU_FUNCTIONS","CREATE_MAMBU_FUNCTIONS","EDIT_MAMBU_FUNCTIONS","DELETE_MAMBU_FUNCTIONS","VIEW_MAMBU_FUNCTIONS_SECRETS","CREATE_MAMBU_FUNCTIONS_SECRETS","EDIT_MAMBU_FUNCTIONS_SECRETS","DELETE_MAMBU_FUNCTIONS_SECRETS","VIEW_CURRENT_USER_DETAILS","VIEW_PROFIT_SHARING_CLASSES","CREATE_PROFIT_SHARING_CLASSES","EDIT_PROFIT_SHARING_CLASSES","DELETE_PROFIT_SHARING_CLASSES","VIEW_PROFIT_SHARING_POOLS","CREATE_PROFIT_SHARING_POOLS","EDIT_PROFIT_SHARING_POOLS","DELETE_PROFIT_SHARING_POOLS","VIEW_PROFIT_SHARING_INCOME_CATEGORIES","CREATE_PROFIT_SHARING_INCOME_CATEGORIES","EDIT_PROFIT_SHARING_INCOME_CATEGORIES","DELETE_PROFIT_SHARING_INCOME_CATEGORIES","VIEW_PROFIT_SHARING_PROPOSALS","EDIT_PROFIT_SHARING_PROPOSALS","CREATE_PROFIT_SHARING_PROPOSALS","APPROVE_PROFIT_SHARING_PROPOSALS","ADJUST_PROFIT_SHARING_PROPOSALS","TRIGGER_COMPUTATION","VIEW_PROFIT_SHARING_SYSTEM_OPTIONS","CREATE_PROFIT_SHARING_SYSTEM_OPTIONS","EDIT_PROFIT_SHARING_SYSTEM_OPTIONS","DELETE_PROFIT_SHARING_SYSTEM_OPTIONS","VIEW_PROFIT_SHARING_EXPENSES","CREATE_PROFIT_SHARING_EXPENSES","EDIT_PROFIT_SHARING_EXPENSES","DELETE_PROFIT_SHARING_EXPENSES","VIEW_PROFIT_SHARING_DEDUCTIONS","CREATE_PROFIT_SHARING_DEDUCTIONS","EDIT_PROFIT_SHARING_DEDUCTIONS","DELETE_PROFIT_SHARING_DEDUCTIONS","VIEW_PROFIT_SHARING_DEPOSIT_PRODUCTS","EDIT_PROFIT_SHARING_DEPOSIT_PRODUCT_LINK","VIEW_PROFIT_SHARING_ACCOUNTS_SETTINGS","CREATE_PROFIT_SHARING_ACCOUNT_SETTINGS","EDIT_PROFIT_SHARING_ACCOUNT_SETTINGS","VIEW_PROFIT_SHARING_GL_ACCOUNTS","VIEW_PROFIT_SHARING_BRANCHES"]}}},"additionalProperties":true};const schema13 = {"type":"object","description":"Represents a branch that can be managed by the user or API consumer.","properties":{"branchKey":{"type":"string","description":"The encoded key of the branch, it is automatically generated."}},"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.administratorAccess !== undefined){const _errs2 = errors;if(typeof data.administratorAccess !== "boolean"){validate11.errors = [{instancePath:instancePath+"/administratorAccess",schemaPath:"#/properties/administratorAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.apiAccess !== undefined){const _errs4 = errors;if(typeof data.apiAccess !== "boolean"){validate11.errors = [{instancePath:instancePath+"/apiAccess",schemaPath:"#/properties/apiAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.canManageAllBranches !== undefined){const _errs6 = errors;if(typeof data.canManageAllBranches !== "boolean"){validate11.errors = [{instancePath:instancePath+"/canManageAllBranches",schemaPath:"#/properties/canManageAllBranches/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.canManageEntitiesAssignedToOtherOfficers !== undefined){const _errs8 = errors;if(typeof data.canManageEntitiesAssignedToOtherOfficers !== "boolean"){validate11.errors = [{instancePath:instancePath+"/canManageEntitiesAssignedToOtherOfficers",schemaPath:"#/properties/canManageEntitiesAssignedToOtherOfficers/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.creditOfficerAccess !== undefined){const _errs10 = errors;if(typeof data.creditOfficerAccess !== "boolean"){validate11.errors = [{instancePath:instancePath+"/creditOfficerAccess",schemaPath:"#/properties/creditOfficerAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.managedBranches !== undefined){let data5 = data.managedBranches;const _errs12 = errors;if(errors === _errs12){if(Array.isArray(data5)){var valid1 = true;const len0 = data5.length;for(let i0=0; i0 Promise) @@ -30,21 +30,25 @@ export class MambuApiKeysRotation { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { secretkey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /apikey/rotation + * * Rotate API key */ public rotateKey({ @@ -60,7 +64,7 @@ export class MambuApiKeysRotation { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -72,9 +76,8 @@ export class MambuApiKeysRotation { return this.awaitResponse( this.buildClient(auth).post('apikey/rotation', { - json: body, + json: _body.right as ApiKey, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 200: ApiKeyRotationResult, @@ -82,6 +85,7 @@ export class MambuApiKeysRotation { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } @@ -106,58 +110,59 @@ export class MambuApiKeysRotation { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildSecretkeyClient(client: Got) { + protected buildSecretkeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const secretkey = this.auth.secretkey const key = typeof secretkey === 'function' ? await secretkey() : secretkey - options.headers.secretkey = key + options.headers.set('secretkey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/application/rest.client.ts b/src/application/rest.client.ts index ba4edff..a89696a 100644 --- a/src/application/rest.client.ts +++ b/src/application/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ApplicationStatus, ErrorResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { ApplicationStatus, ErrorResponse } from './rest.type.js' * application/status */ export class MambuApplication { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuApplication { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /application/status + * * Allows you to retrieve the state of application data access */ public getApplicationStatus({ @@ -59,7 +63,7 @@ export class MambuApplication { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -67,7 +71,6 @@ export class MambuApplication { return this.awaitResponse( this.buildClient(auth).get('application/status', { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: ApplicationStatus, @@ -75,50 +78,52 @@ export class MambuApplication { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -126,8 +131,7 @@ export class MambuApplication { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -135,21 +139,21 @@ export class MambuApplication { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/application/rest.type.ts b/src/application/rest.type.ts index 52f6d22..5e7d8f4 100644 --- a/src/application/rest.type.ts +++ b/src/application/rest.type.ts @@ -13,6 +13,9 @@ import { validate as ErrorResponseValidator } from './schemas/error-response.sch * Describes the application status regarding the data access */ export interface ApplicationStatus { + /** + * Data access state + */ dataAccessState?: 'READ_ONLY_STATE' | 'WRITE_READ_STATE' | undefined } diff --git a/src/application/schemas/application-status.schema.js b/src/application/schemas/application-status.schema.js index fc9771d..8adbda0 100644 --- a/src/application/schemas/application-status.schema.js +++ b/src/application/schemas/application-status.schema.js @@ -5,4 +5,4 @@ */ "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApplicationStatus","type":"object","description":"Describes the application status regarding the data access","properties":{"dataAccessState":{"enum":["READ_ONLY_STATE","WRITE_READ_STATE"]}},"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.dataAccessState !== undefined){let data0 = data.dataAccessState;if(!((data0 === "READ_ONLY_STATE") || (data0 === "WRITE_READ_STATE"))){validate10.errors = [{instancePath:instancePath+"/dataAccessState",schemaPath:"#/properties/dataAccessState/enum",keyword:"enum",params:{allowedValues: schema11.properties.dataAccessState.enum},message:"must be equal to one of the allowed values"}];return false;}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApplicationStatus","type":"object","description":"Describes the application status regarding the data access","properties":{"dataAccessState":{"description":"Data access state","enum":["READ_ONLY_STATE","WRITE_READ_STATE"]}},"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.dataAccessState !== undefined){let data0 = data.dataAccessState;if(!((data0 === "READ_ONLY_STATE") || (data0 === "WRITE_READ_STATE"))){validate10.errors = [{instancePath:instancePath+"/dataAccessState",schemaPath:"#/properties/dataAccessState/enum",keyword:"enum",params:{allowedValues: schema11.properties.dataAccessState.enum},message:"must be equal to one of the allowed values"}];return false;}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file diff --git a/src/authorization-holds-configuration/rest.client.ts b/src/authorization-holds-configuration/rest.client.ts index 427d540..c540ccb 100644 --- a/src/authorization-holds-configuration/rest.client.ts +++ b/src/authorization-holds-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/authorizationholds.yaml */ export class MambuAuthorizationHoldsConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuAuthorizationHoldsConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/authorizationholds.yaml + * * Get authorization holds configuration */ public get({ @@ -54,22 +58,24 @@ export class MambuAuthorizationHoldsConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/authorizationholds.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/authorizationholds.yaml + * * Update authorization holds configuration */ public update({ @@ -83,15 +89,13 @@ export class MambuAuthorizationHoldsConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/authorizationholds.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/authorizationholds.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -99,50 +103,52 @@ export class MambuAuthorizationHoldsConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -150,8 +156,7 @@ export class MambuAuthorizationHoldsConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -159,21 +164,21 @@ export class MambuAuthorizationHoldsConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/background-process/rest.client.ts b/src/background-process/rest.client.ts index a41ac3e..7fc12e5 100644 --- a/src/background-process/rest.client.ts +++ b/src/background-process/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { BackgroundProcess, ErrorResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { BackgroundProcess, ErrorResponse } from './rest.type.js' * backgroundprocess */ export class MambuBackgroundProcess { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuBackgroundProcess { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /backgroundprocess/latest + * * Get the latest manual or automatic end of day (EOD) process by specifying the type */ public getLatestByType({ @@ -57,23 +61,25 @@ export class MambuBackgroundProcess { | FailureResponse<'401', ErrorResponse, 'response:statuscode'> | FailureResponse<'403', ErrorResponse, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('backgroundprocess/latest', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: BackgroundProcess, 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /backgroundprocess/{encodedKey} + * * Cancel manual or automatic end of day (EOD) processes using the encoded key */ public update({ @@ -90,7 +96,7 @@ export class MambuBackgroundProcess { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '500'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -99,7 +105,6 @@ export class MambuBackgroundProcess { this.buildClient(auth).put(`backgroundprocess/${path.encodedKey}`, { body: body, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: BackgroundProcess, @@ -109,50 +114,52 @@ export class MambuBackgroundProcess { 404: ErrorResponse, 500: ErrorResponse, }, + 'json', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -160,8 +167,7 @@ export class MambuBackgroundProcess { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -169,21 +175,21 @@ export class MambuBackgroundProcess { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/base-streaming.client.ts b/src/base-streaming.client.ts index e1c6de7..47a3fff 100644 --- a/src/base-streaming.client.ts +++ b/src/base-streaming.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import type { KyInstance, Options, ResponsePromise } from 'ky' +import ky from 'ky' import { CommitSubscriptionCursorsRequest, @@ -24,7 +24,7 @@ import { * Mambu Streaming API */ export class BaseMambuStreaming { - public client: Got + public client: KyInstance public auth: { apiKeyAuth?: string | (() => Promise) @@ -38,21 +38,25 @@ export class BaseMambuStreaming { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl?: string | 'http://MYTENANT.mambu.com/api/v1' - options?: Options | OptionsInit + options?: Options auth: { apiKeyAuth?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /subscriptions/{subscription_id}/cursors + * * Commit Cursors * * This endpoint commits offsets of the subscription. @@ -81,7 +85,7 @@ export class BaseMambuStreaming { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '403' | '404' | '422'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -93,9 +97,8 @@ export class BaseMambuStreaming { return this.awaitResponse( this.buildClient().post(`subscriptions/${path.subscriptionId}/cursors`, { - json: body, + json: _body.right as CommitSubscriptionCursorsRequest, headers: headers, - responseType: 'json', }), { 200: CommitSubscriptionCursorsResponse200, @@ -104,10 +107,13 @@ export class BaseMambuStreaming { 404: Problem, 422: Problem, }, + 'json', ) as ReturnType } /** + * POST /subscriptions + * * Create a Subscription * * This endpoint creates a subscription for `event_types`. Event types must first be specified using the Mambu UI following the instructions in our [Event Streaming API](https://support.mambu.com/docs/streaming-api) article. @@ -128,7 +134,7 @@ export class BaseMambuStreaming { | FailureResponse<'422', Problem, 'response:statuscode'> | FailureResponse | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '400' | '422'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '400' | '422'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { const _body = this.validateRequestBody(Subscription, body) if ('left' in _body) { @@ -137,9 +143,8 @@ export class BaseMambuStreaming { return this.awaitResponse( this.buildClient().post('subscriptions', { - json: body, + json: _body.right as Subscription, headers: headers ?? {}, - responseType: 'json', }), { 200: Subscription, @@ -147,10 +152,13 @@ export class BaseMambuStreaming { 400: Problem, 422: Problem, }, + 'json', ) as ReturnType } /** + * DELETE /subscriptions/{subscription_id} + * * Delete a Subscription * * This endpoint deletes an existing subscription for event types. @@ -170,21 +178,23 @@ export class BaseMambuStreaming { | SuccessResponse<'204', unknown> | FailureResponse<'404', DeleteSubscriptionBySubscriptionIdResponse404, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '404'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '404'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient().delete(`subscriptions/${path.subscriptionId}`, { headers: headers ?? {}, - responseType: 'text', }), { 204: { parse: (x: unknown) => ({ right: x }) }, 404: DeleteSubscriptionBySubscriptionIdResponse404, }, + 'text', ) as ReturnType } /** + * GET /subscriptions/{subscription_id}/events + * * Start Event Stream * * This endpoint starts a new stream for reading events from this subscription. The data will be automatically rebalanced between streams of one subscription. @@ -235,7 +245,7 @@ export class BaseMambuStreaming { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -244,7 +254,6 @@ export class BaseMambuStreaming { this.buildClient().get(`subscriptions/${path.subscriptionId}/events`, { searchParams: query ?? {}, headers: headers ?? {}, - responseType: 'json', }), { 200: SubscriptionEventStreamBatch, @@ -253,10 +262,13 @@ export class BaseMambuStreaming { 404: Problem, 409: Problem, }, + 'json', ) as ReturnType } /** + * GET /subscriptions/{subscription_id}/stats + * * Get Statistics * * This endpoint exposes statistics of a specified subscription. An example use for the statistics provided could be monitoring lag in consumers. @@ -280,18 +292,18 @@ export class BaseMambuStreaming { | SuccessResponse<'200', GetSubscriptionStatsResponse> | FailureResponse<'404', Problem, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '404'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '404'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient().get(`subscriptions/${path.subscriptionId}/stats`, { searchParams: query ?? {}, headers: headers ?? {}, - responseType: 'json', }), { 200: GetSubscriptionStatsResponse, 404: Problem, }, + 'json', ) as ReturnType } @@ -316,58 +328,59 @@ export class BaseMambuStreaming { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildApiKeyAuthClient(client: Got) { + protected buildApiKeyAuthClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKeyAuth = this.auth.apiKeyAuth const key = typeof apiKeyAuth === 'function' ? await apiKeyAuth() : apiKeyAuth - options.headers.apikey = key + options.headers.set('apikey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/base-streaming.schema.ts b/src/base-streaming.schema.ts index f21b0e9..2f402b5 100644 --- a/src/base-streaming.schema.ts +++ b/src/base-streaming.schema.ts @@ -1,10 +1,10 @@ import { cloneDeep, omitUndefined, pick } from '@skyleague/axioms' -import { $restclient } from '@skyleague/therefore' import type { OpenapiV3 } from '@skyleague/therefore' +import { $restclient } from '@skyleague/therefore' import type { APIKeySecurityScheme, Operation, PathItem, Schema } from '@skyleague/therefore/src/types/openapi.type.js' -import got from 'got' +import ky from 'ky' -export const baseMambuStreaming = got +export const baseMambuStreaming = ky .get('https://api.mambu.com/streaming-api/mambu-streaming-api-spec-oas3.json') .json() .then((data) => { @@ -82,5 +82,6 @@ export const baseMambuStreaming = got return $restclient(data, { formats: false, strict: false, + client: 'ky', }) }) diff --git a/src/branches-configuration/rest.client.ts b/src/branches-configuration/rest.client.ts index f0535fc..88694c4 100644 --- a/src/branches-configuration/rest.client.ts +++ b/src/branches-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/branches.yaml */ export class MambuBranchesConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuBranchesConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/branches.yaml + * * Get branches configuration */ public get({ @@ -54,22 +58,24 @@ export class MambuBranchesConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/branches.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/branches.yaml + * * Update branch configuration */ public update({ @@ -83,15 +89,13 @@ export class MambuBranchesConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/branches.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/branches.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -99,50 +103,52 @@ export class MambuBranchesConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -150,8 +156,7 @@ export class MambuBranchesConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -159,21 +164,21 @@ export class MambuBranchesConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/branches/rest.client.ts b/src/branches/rest.client.ts index 9942c3b..f2eab93 100644 --- a/src/branches/rest.client.ts +++ b/src/branches/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { Branch, ErrorResponse, GetAllResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { Branch, ErrorResponse, GetAllResponse } from './rest.type.js' * branches */ export class MambuBranches { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuBranches { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /branches + * * Create branch */ public create({ @@ -63,7 +67,7 @@ export class MambuBranches { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -75,9 +79,8 @@ export class MambuBranches { return this.awaitResponse( this.buildClient(auth).post('branches', { - json: body, + json: _body.right as Branch, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -86,10 +89,13 @@ export class MambuBranches { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /branches + * * Get branches */ public getAll({ @@ -106,7 +112,7 @@ export class MambuBranches { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -115,7 +121,6 @@ export class MambuBranches { this.buildClient(auth).get('branches', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -123,10 +128,13 @@ export class MambuBranches { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /branches/{branchId} + * * Get branch */ public getById({ @@ -142,7 +150,7 @@ export class MambuBranches { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -151,7 +159,6 @@ export class MambuBranches { this.buildClient(auth).get(`branches/${path.branchId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Branch, @@ -160,6 +167,7 @@ export class MambuBranches { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -184,44 +192,45 @@ export class MambuBranches { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -229,8 +238,7 @@ export class MambuBranches { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -238,21 +246,21 @@ export class MambuBranches { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/bulks/rest.client.ts b/src/bulks/rest.client.ts index d0d0e78..cbba4cc 100644 --- a/src/bulks/rest.client.ts +++ b/src/bulks/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { BulkProcessStatus, ErrorResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { BulkProcessStatus, ErrorResponse } from './rest.type.js' * bulks */ export class MambuBulks { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,28 +31,37 @@ export class MambuBulks { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /bulks/{bulkProcessKey} + * * Allow retrieval the status of a bulk process via key */ public getBulkStatus({ path, + query, auth = [['apiKey'], ['basic']], - }: { path: { bulkProcessKey: string }; auth?: string[][] | string[] }): Promise< + }: { + path: { bulkProcessKey: string } + query?: { offset?: string; limit?: string; paginationDetails?: string } + auth?: string[][] | string[] + }): Promise< | SuccessResponse<'200', BulkProcessStatus> | FailureResponse<'401', ErrorResponse, 'response:statuscode'> | FailureResponse<'403', ErrorResponse, 'response:statuscode'> @@ -60,15 +69,15 @@ export class MambuBulks { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( this.buildClient(auth).get(`bulks/${path.bulkProcessKey}`, { + searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: BulkProcessStatus, @@ -76,50 +85,52 @@ export class MambuBulks { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -127,8 +138,7 @@ export class MambuBulks { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -136,21 +146,21 @@ export class MambuBulks { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/cards/rest.client.ts b/src/cards/rest.client.ts index 643c71e..8901e58 100644 --- a/src/cards/rest.client.ts +++ b/src/cards/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { AccountBalances, @@ -27,7 +27,7 @@ import { * cards */ export class MambuCards { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -42,22 +42,26 @@ export class MambuCards { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /cards/{cardReferenceToken}/authorizationholds + * * Create an authorization hold corresponding to a given card. */ public createAuthorizationHold({ @@ -82,7 +86,7 @@ export class MambuCards { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -94,9 +98,8 @@ export class MambuCards { return this.awaitResponse( this.buildClient(auth).post(`cards/${path.cardReferenceToken}/authorizationholds`, { - json: body, + json: _body.right as AuthorizationHold, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -107,10 +110,13 @@ export class MambuCards { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /cards/{cardReferenceToken}/financialtransactions + * * Create a financial transaction corresponding to a given card */ public createCardTransaction({ @@ -135,7 +141,7 @@ export class MambuCards { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -147,9 +153,8 @@ export class MambuCards { return this.awaitResponse( this.buildClient(auth).post(`cards/${path.cardReferenceToken}/financialtransactions`, { - json: body, + json: _body.right as CardTransactionInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -160,10 +165,13 @@ export class MambuCards { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /cards/{cardReferenceToken}/authorizationholds/{authorizationHoldExternalReferenceId}:decrease + * * Decreases the amount of an authorization hold. If the amount is greater or equal to the authorization hold amount, then the authorization hold is reversed. */ public decreaseAuthorizationHold({ @@ -188,7 +196,7 @@ export class MambuCards { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -202,9 +210,8 @@ export class MambuCards { this.buildClient(auth).post( `cards/${path.cardReferenceToken}/authorizationholds/${path.authorizationHoldExternalReferenceId}:decrease`, { - json: body, + json: _body.right as AuthorizationHoldAmountAdjustmentRequest, headers: headers ?? {}, - responseType: 'text', }, ), { @@ -216,10 +223,13 @@ export class MambuCards { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /cards/{cardReferenceToken}/balanceInquiry + * * Get account balances using card tokens */ public getAccountBalances({ @@ -233,7 +243,7 @@ export class MambuCards { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -241,7 +251,6 @@ export class MambuCards { return this.awaitResponse( this.buildClient(auth).get(`cards/${path.cardReferenceToken}/balanceInquiry`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: AccountBalances, @@ -249,10 +258,13 @@ export class MambuCards { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /cards/{cardReferenceToken}/authorizationholds/{authorizationHoldExternalReferenceId} + * * Get card authorization hold */ public getAuthorizationHoldById({ @@ -270,7 +282,7 @@ export class MambuCards { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -280,7 +292,6 @@ export class MambuCards { `cards/${path.cardReferenceToken}/authorizationholds/${path.authorizationHoldExternalReferenceId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }, ), { @@ -290,10 +301,13 @@ export class MambuCards { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /cards/{cardReferenceToken}/financialtransactions/{cardTransactionExternalReferenceId} + * * Get card transaction */ public getCardTransaction({ @@ -313,7 +327,7 @@ export class MambuCards { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -324,7 +338,6 @@ export class MambuCards { { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }, ), { @@ -334,10 +347,13 @@ export class MambuCards { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /cards/{cardReferenceToken}/authorizationholds/{authorizationHoldExternalReferenceId}:increase + * * Increase authorization hold amount */ public increaseAuthorizationHold({ @@ -362,7 +378,7 @@ export class MambuCards { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -376,9 +392,8 @@ export class MambuCards { this.buildClient(auth).post( `cards/${path.cardReferenceToken}/authorizationholds/${path.authorizationHoldExternalReferenceId}:increase`, { - json: body, + json: _body.right as AuthorizationHoldAmountAdjustmentRequest, headers: headers ?? {}, - responseType: 'text', }, ), { @@ -390,10 +405,13 @@ export class MambuCards { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PATCH /cards/{cardReferenceToken}/authorizationholds/{authorizationHoldExternalReferenceId} + * * Partially update an authorization hold */ public patchAuthorizationHold({ @@ -417,7 +435,7 @@ export class MambuCards { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -431,9 +449,8 @@ export class MambuCards { this.buildClient(auth).patch( `cards/${path.cardReferenceToken}/authorizationholds/${path.authorizationHoldExternalReferenceId}`, { - json: body, + json: _body.right as PatchAuthorizationHoldRequest, headers: headers ?? {}, - responseType: 'text', }, ), { @@ -444,10 +461,13 @@ export class MambuCards { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * DELETE /cards/{cardReferenceToken}/authorizationholds/{authorizationHoldExternalReferenceId} + * * Reverse a card authorization hold. */ public reverseAuthorizationHold({ @@ -466,7 +486,7 @@ export class MambuCards { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -474,9 +494,7 @@ export class MambuCards { return this.awaitResponse( this.buildClient(auth).delete( `cards/${path.cardReferenceToken}/authorizationholds/${path.authorizationHoldExternalReferenceId}`, - { - responseType: 'text', - }, + {}, ), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -486,10 +504,13 @@ export class MambuCards { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /cards/{cardReferenceToken}/financialtransactions/{cardTransactionExternalReferenceId}:decrease + * * Reverse card transaction */ public reverseCardTransaction({ @@ -514,7 +535,7 @@ export class MambuCards { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -528,9 +549,8 @@ export class MambuCards { this.buildClient(auth).post( `cards/${path.cardReferenceToken}/financialtransactions/${path.cardTransactionExternalReferenceId}:decrease`, { - json: body, + json: _body.right as CardTransactionReversal, headers: headers ?? {}, - responseType: 'text', }, ), { @@ -542,6 +562,7 @@ export class MambuCards { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } @@ -566,44 +587,45 @@ export class MambuCards { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -611,8 +633,7 @@ export class MambuCards { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -620,21 +641,21 @@ export class MambuCards { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/cards/rest.type.ts b/src/cards/rest.type.ts index b16f083..ad6b981 100644 --- a/src/cards/rest.type.ts +++ b/src/cards/rest.type.ts @@ -928,6 +928,7 @@ export interface GetCardTransaction { | 'OVERDRAFT_INTEREST_RATE_CHANGED' | 'OVERDRAFT_LIMIT_CHANGED' | 'BRANCH_CHANGED' + | 'ACCOUNT_HOLDER_CHANGED' | 'LOAN_FUNDED' | 'LOAN_FUNDED_ADJUSTMENT' | 'LOAN_REPAID' diff --git a/src/cards/schemas/get-card-transaction.schema.js b/src/cards/schemas/get-card-transaction.schema.js index cc66a8b..12a7e99 100644 --- a/src/cards/schemas/get-card-transaction.schema.js +++ b/src/cards/schemas/get-card-transaction.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"GetCardTransaction","type":"object","description":"Details for retrieving a card financial transaction.","properties":{"accountBalances":{"$ref":"#/$defs/DepositTransactionBalances"},"adjustmentTransactionKey":{"type":"string","description":"The key of the deposit transaction where the adjustment for this transaction was made (if any adjustment was involved)"},"affectedAmounts":{"$ref":"#/$defs/DepositAffectedAmounts"},"amount":{"type":"number","description":"How much was added/removed in account"},"blockId":{"type":"string","description":"The block fund id associated with the transaction"},"bookingDate":{"type":"string","description":"The date when corresponding JE is booked (as Organization Time)","format":"date-time"},"branchKey":{"type":"string","description":"The branch where the transaction was performed"},"cardTransaction":{"$ref":"#/$defs/CardTransaction"},"cardTransactionReversals":{"type":"array","description":"Object containing all the associated reversal transactions.","items":{"$ref":"#/$defs/CardTransactionReversal"}},"centreKey":{"type":"string","description":"The center where the transaction was performed"},"creationDate":{"type":"string","description":"The date when this deposit transaction was created","format":"date-time"},"currencyCode":{"type":"string","description":"The currency in which this transaction was posted"},"encodedKey":{"type":"string","description":"The encoded key of the deposit transaction, auto generated, unique"},"externalId":{"type":"string","description":"The external id of the deposit transaction, customizable, unique"},"fees":{"type":"array","description":"All the amounts that have been applied or paid within this transaction and involved predefined fees","items":{"$ref":"#/$defs/DepositFee"}},"holdExternalReferenceId":{"type":"string","description":"The external id of an account authorization hold"},"id":{"type":"string","description":"The id of the deposit transaction, auto generated, unique"},"interestAccruedAmounts":{"$ref":"#/$defs/DepositInterestAccruedAmounts"},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this deposit account. If this account was imported, track which 'migration event' they came from"},"notes":{"type":"string","description":"Extra notes about this deposit transaction"},"originalTransactionKey":{"type":"string","description":"The encodedKey of the transaction that was adjusted as part of this one. Available only for adjustment transactions"},"parentAccountKey":{"type":"string","description":"The key of the parent deposit account"},"paymentDetails":{"$ref":"#/$defs/PaymentDetails"},"paymentOrderId":{"type":"string","description":"The payment order id of the deposit transaction, customizable"},"taxes":{"$ref":"#/$defs/DepositTaxes"},"terms":{"$ref":"#/$defs/DepositTerms"},"tillKey":{"type":"string","description":"The till key associated with this transaction"},"transactionDetails":{"$ref":"#/$defs/TransactionDetails"},"transferDetails":{"$ref":"#/$defs/TransferDetails"},"type":{"description":"The type of the deposit transaction","enum":["IMPORT","WRITE_OFF","WRITE_OFF_ADJUSTMENT","DEPOSIT","ADJUSTMENT","WITHDRAWAL","WITHDRAWAL_ADJUSTMENT","CARD_TRANSACTION_REVERSAL","CARD_TRANSACTION_REVERSAL_ADJUSTMENT","TRANSFER","TRANSFER_ADJUSTMENT","FEE_APPLIED","FEE_ADJUSTED","FEES_DUE_REDUCED","INTEREST_APPLIED","INTEREST_APPLIED_ADJUSTMENT","NET_DIFF_INTEREST","FEE_REDUCTION_ADJUSTMENT","WITHHOLDING_TAX","WITHHOLDING_TAX_ADJUSTMENT","INTEREST_RATE_CHANGED","OVERDRAFT_INTEREST_RATE_CHANGED","OVERDRAFT_LIMIT_CHANGED","BRANCH_CHANGED","LOAN_FUNDED","LOAN_FUNDED_ADJUSTMENT","LOAN_REPAID","LOAN_REPAID_ADJUSTMENT","LOAN_FRACTION_BOUGHT","LOAN_FRACTION_BOUGHT_ADJUSTMENT","LOAN_FRACTION_SOLD","LOAN_FRACTION_SOLD_ADJUSTMENT","SEIZED_AMOUNT"]},"userKey":{"type":"string","description":"The person that performed the transaction"},"valueDate":{"type":"string","description":"Date of the entry (eg date of repayment or disbursal, etc.) (as Organization Time)","format":"date-time"}},"additionalProperties":true,"$defs":{"DepositTransactionBalances":{"type":"object","description":"The balances changed within a transaction.","properties":{"totalBalance":{"type":"number","description":"The running balance owed by deposit"}},"additionalProperties":true},"DepositAffectedAmounts":{"type":"object","description":"The amounts affected after completing the deposit transaction","properties":{"feesAmount":{"type":"number","description":"Amount of fees involved in a transaction that affects an account with positive balance"},"fractionAmount":{"type":"number","description":"In the case of an LOAN_FRACTION_BOUGHT this represent the fraction amount which was bought from another investor"},"fundsAmount":{"type":"number","description":"Balance change amount involved in a transaction that affects an account with positive balance"},"interestAmount":{"type":"number","description":"Amount of interest involved in a transaction that affects an account with positive balance"},"overdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as overdraft"},"overdraftFeesAmount":{"type":"number","description":"Fees amount involved in a transaction that affects an overdraft"},"overdraftInterestAmount":{"type":"number","description":"Interest amount involved in a transaction that affects an overdraft"},"technicalOverdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft"},"technicalOverdraftInterestAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft interest"}},"additionalProperties":true},"CardTransaction":{"type":"object","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true},"CardAcceptor":{"type":"object","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","description":"The city in which the card acceptor has the business."},"country":{"type":"string","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","description":"The name of the card acceptor."},"state":{"type":"string","description":"The state in which the card acceptor has the business."},"street":{"type":"string","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true},"CardTransactionReversal":{"type":"object","description":"A full or partial reversal of a card transaction.","properties":{"amount":{"type":"number","description":"The amount of money to be credited in the client's account from the original card transaction."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card reversal transaction in subsequent requests."},"id":{"type":"integer","description":"The id of the Deposit Transaction"},"transactionChannelId":{"type":"string","description":"The ID of the channel through which the payment is done. If the value is not present, the value from the source card transaction is copied."}},"required":["amount","externalReferenceId"],"additionalProperties":true},"DepositFee":{"type":"object","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MONTHLY_FEE","ARBITRARY"]}},"required":["predefinedFeeKey"],"additionalProperties":true},"DepositInterestAccruedAmounts":{"type":"object","description":"Represents the accrued interest amounts for an Interest Applied deposit transaction.","properties":{"interestAccrued":{"type":"number","description":"The amount of positive interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"negativeInterestAccrued":{"type":"number","description":"The amount of negative interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"overdraftInterestAccrued":{"type":"number","description":"The amount of overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"technicalOverdraftInterestAccrued":{"type":"number","description":"The amount of technical overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"}},"additionalProperties":true},"PaymentDetails":{"type":"object","description":"The payment information including account identification details","properties":{"creditor":{"$ref":"#/$defs/Party"},"creditorAccount":{"$ref":"#/$defs/AccountDetails"},"creditorAgent":{"$ref":"#/$defs/Agent"},"debtor":{"$ref":"#/$defs/Party"},"debtorAccount":{"$ref":"#/$defs/AccountDetails"},"debtorAgent":{"$ref":"#/$defs/Agent"},"paymentIdentification":{"$ref":"#/$defs/PaymentIdentification"},"paymentTypeInformation":{"$ref":"#/$defs/PaymentTypeInformation"},"remittanceInformation":{"$ref":"#/$defs/RemittanceInformation"}},"additionalProperties":true},"Party":{"type":"object","description":"The details of the party for a transaction","properties":{"name":{"type":"string","description":"The name of the party"}},"additionalProperties":true},"AccountDetails":{"type":"object","description":"The account currency and identification","properties":{"currency":{"type":"string","description":"The currency of the account"},"identification":{"$ref":"#/$defs/AccountIdentification"}},"additionalProperties":true},"AccountIdentification":{"type":"object","description":"The account identification details","properties":{"iban":{"type":"string","description":"The account unique identifier"},"other":{"$ref":"#/$defs/OtherAccountIdentification"}},"additionalProperties":true},"OtherAccountIdentification":{"type":"object","description":"Represents other way of identification for the account.","properties":{"identification":{"type":"string","description":"The identification of the payer/payee"},"scheme":{"type":"string","description":"The identification scheme"}},"additionalProperties":true},"Agent":{"type":"object","description":"The agent details for a party","properties":{"financialInstitutionIdentification":{"$ref":"#/$defs/FinancialInstitutionIdentification"}},"additionalProperties":true},"FinancialInstitutionIdentification":{"type":"object","description":"The identification of the financial institution","properties":{"bic":{"type":"string","description":"Business identifier code"}},"additionalProperties":true},"PaymentIdentification":{"type":"object","description":"The payment identification details","properties":{"endToEndIdentification":{"type":"string","description":"Identifier assigned by the initiating party to the transaction"},"instructionIdentification":{"type":"string","description":"Identifier of a payment instruction"},"transactionIdentification":{"type":"string","description":"Identifier unique for a period assigned by the first initiating party to the transaction"}},"additionalProperties":true},"PaymentTypeInformation":{"type":"object","description":"The information specifying the type of transaction","properties":{"serviceLevel":{"$ref":"#/$defs/ServiceLevel"}},"additionalProperties":true},"ServiceLevel":{"type":"object","description":"The rules under which the transaction should be processed","properties":{"code":{"type":"string","description":"The code for a pre-agreed service or level of service between the parties"}},"additionalProperties":true},"RemittanceInformation":{"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"structured":{"$ref":"#/$defs/Structured"},"unstructured":{"type":"string","description":"Information supplied to match the items of the payment in an unstructured form"}},"additionalProperties":true},"Structured":{"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"creditorReferenceInformation":{"$ref":"#/$defs/CreditorReferenceInformation"}},"additionalProperties":true},"CreditorReferenceInformation":{"type":"object","description":"Represents the reference to the underlying documents of the payment.","properties":{"reference":{"type":"string","description":"The reference information of the creditor's underlying documents"},"referenceIssuer":{"type":"string","description":"The entity that assigns the reference type"},"referenceType":{"type":"string","description":"The type of creditor reference"}},"additionalProperties":true},"DepositTaxes":{"type":"object","description":"The taxes applied within a transaction","properties":{"taxRate":{"type":"number","description":"The tax rate that was set or changed in this transaction"}},"additionalProperties":true},"DepositTerms":{"type":"object","description":"The deposit transaction terms","properties":{"interestSettings":{"$ref":"#/$defs/DepositTransactionInterestSettings"},"overdraftInterestSettings":{"$ref":"#/$defs/DepositOverdraftInterestSettings"},"overdraftSettings":{"$ref":"#/$defs/DepositOverdraftSettings"}},"additionalProperties":true},"DepositTransactionInterestSettings":{"type":"object","description":"The interest settings, holds all the properties regarding interests for the deposit account","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate for the deposit account"}},"additionalProperties":true},"DepositOverdraftInterestSettings":{"type":"object","description":"Holds the deposit overdraft interest settings","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate that was set or changed in this transaction. Used on product interest rate changes or interest tier switches"}},"additionalProperties":true},"DepositOverdraftSettings":{"type":"object","description":"Holds the deposit overdraft settings for a transaction","properties":{"overdraftLimit":{"type":"number","description":"The overdraft limit that was set or changed in this transaction"}},"additionalProperties":true},"TransactionDetails":{"type":"object","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true},"TransferDetails":{"type":"object","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","description":"The key of the related loan transaction"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"The balances changed within a transaction.","properties":{"totalBalance":{"type":"number","description":"The running balance owed by deposit"}},"additionalProperties":true};const schema13 = {"type":"object","description":"The amounts affected after completing the deposit transaction","properties":{"feesAmount":{"type":"number","description":"Amount of fees involved in a transaction that affects an account with positive balance"},"fractionAmount":{"type":"number","description":"In the case of an LOAN_FRACTION_BOUGHT this represent the fraction amount which was bought from another investor"},"fundsAmount":{"type":"number","description":"Balance change amount involved in a transaction that affects an account with positive balance"},"interestAmount":{"type":"number","description":"Amount of interest involved in a transaction that affects an account with positive balance"},"overdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as overdraft"},"overdraftFeesAmount":{"type":"number","description":"Fees amount involved in a transaction that affects an overdraft"},"overdraftInterestAmount":{"type":"number","description":"Interest amount involved in a transaction that affects an overdraft"},"technicalOverdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft"},"technicalOverdraftInterestAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft interest"}},"additionalProperties":true};const schema16 = {"type":"object","description":"A full or partial reversal of a card transaction.","properties":{"amount":{"type":"number","description":"The amount of money to be credited in the client's account from the original card transaction."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card reversal transaction in subsequent requests."},"id":{"type":"integer","description":"The id of the Deposit Transaction"},"transactionChannelId":{"type":"string","description":"The ID of the channel through which the payment is done. If the value is not present, the value from the source card transaction is copied."}},"required":["amount","externalReferenceId"],"additionalProperties":true};const schema17 = {"type":"object","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MONTHLY_FEE","ARBITRARY"]}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema18 = {"type":"object","description":"Represents the accrued interest amounts for an Interest Applied deposit transaction.","properties":{"interestAccrued":{"type":"number","description":"The amount of positive interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"negativeInterestAccrued":{"type":"number","description":"The amount of negative interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"overdraftInterestAccrued":{"type":"number","description":"The amount of overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"technicalOverdraftInterestAccrued":{"type":"number","description":"The amount of technical overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"}},"additionalProperties":true};const schema33 = {"type":"object","description":"The taxes applied within a transaction","properties":{"taxRate":{"type":"number","description":"The tax rate that was set or changed in this transaction"}},"additionalProperties":true};const schema38 = {"type":"object","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};const schema39 = {"type":"object","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","description":"The key of the related loan transaction"}},"additionalProperties":true};const schema14 = {"type":"object","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true};const schema15 = {"type":"object","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","description":"The city in which the card acceptor has the business."},"country":{"type":"string","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","description":"The name of the card acceptor."},"state":{"type":"string","description":"The state in which the card acceptor has the business."},"street":{"type":"string","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true};function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((((data.advice === undefined) && (missing0 = "advice")) || ((data.amount === undefined) && (missing0 = "amount"))) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.advice !== undefined){const _errs2 = errors;if(typeof data.advice !== "boolean"){validate11.errors = [{instancePath:instancePath+"/advice",schemaPath:"#/properties/advice/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data1 = data.amount;const _errs4 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate11.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.cardAcceptor !== undefined){let data2 = data.cardAcceptor;const _errs6 = errors;const _errs7 = errors;if(errors === _errs7){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.city !== undefined){const _errs10 = errors;if(typeof data2.city !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptor/properties/city/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data2.country !== undefined){const _errs12 = errors;if(typeof data2.country !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptor/properties/country/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data2.mcc !== undefined){let data5 = data2.mcc;const _errs14 = errors;if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptor/properties/mcc/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data2.name !== undefined){const _errs16 = errors;if(typeof data2.name !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptor/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}if(valid2){if(data2.state !== undefined){const _errs18 = errors;if(typeof data2.state !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptor/properties/state/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs18 === errors;}else {var valid2 = true;}if(valid2){if(data2.street !== undefined){const _errs20 = errors;if(typeof data2.street !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptor/properties/street/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}if(valid2){if(data2.zip !== undefined){const _errs22 = errors;if(typeof data2.zip !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptor/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs22 === errors;}else {var valid2 = true;}}}}}}}}else {validate11.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptor/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.cardToken !== undefined){const _errs24 = errors;if(typeof data.cardToken !== "string"){validate11.errors = [{instancePath:instancePath+"/cardToken",schemaPath:"#/properties/cardToken/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs26 = errors;if(typeof data.currencyCode !== "string"){validate11.errors = [{instancePath:instancePath+"/currencyCode",schemaPath:"#/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs28 = errors;if(typeof data.encodedKey !== "string"){validate11.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs28 === errors;}else {var valid0 = true;}if(valid0){if(data.externalAuthorizationReferenceId !== undefined){const _errs30 = errors;if(typeof data.externalAuthorizationReferenceId !== "string"){validate11.errors = [{instancePath:instancePath+"/externalAuthorizationReferenceId",schemaPath:"#/properties/externalAuthorizationReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs30 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs32 = errors;if(typeof data.externalReferenceId !== "string"){validate11.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs32 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs34 = errors;if(typeof data.userTransactionTime !== "string"){validate11.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs34 === errors;}else {var valid0 = true;}}}}}}}}}}}else {validate11.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11.errors = vErrors;return errors === 0;}const schema19 = {"type":"object","description":"The payment information including account identification details","properties":{"creditor":{"$ref":"#/$defs/Party"},"creditorAccount":{"$ref":"#/$defs/AccountDetails"},"creditorAgent":{"$ref":"#/$defs/Agent"},"debtor":{"$ref":"#/$defs/Party"},"debtorAccount":{"$ref":"#/$defs/AccountDetails"},"debtorAgent":{"$ref":"#/$defs/Agent"},"paymentIdentification":{"$ref":"#/$defs/PaymentIdentification"},"paymentTypeInformation":{"$ref":"#/$defs/PaymentTypeInformation"},"remittanceInformation":{"$ref":"#/$defs/RemittanceInformation"}},"additionalProperties":true};const schema20 = {"type":"object","description":"The details of the party for a transaction","properties":{"name":{"type":"string","description":"The name of the party"}},"additionalProperties":true};const schema27 = {"type":"object","description":"The payment identification details","properties":{"endToEndIdentification":{"type":"string","description":"Identifier assigned by the initiating party to the transaction"},"instructionIdentification":{"type":"string","description":"Identifier of a payment instruction"},"transactionIdentification":{"type":"string","description":"Identifier unique for a period assigned by the first initiating party to the transaction"}},"additionalProperties":true};const schema21 = {"type":"object","description":"The account currency and identification","properties":{"currency":{"type":"string","description":"The currency of the account"},"identification":{"$ref":"#/$defs/AccountIdentification"}},"additionalProperties":true};const schema22 = {"type":"object","description":"The account identification details","properties":{"iban":{"type":"string","description":"The account unique identifier"},"other":{"$ref":"#/$defs/OtherAccountIdentification"}},"additionalProperties":true};const schema23 = {"type":"object","description":"Represents other way of identification for the account.","properties":{"identification":{"type":"string","description":"The identification of the payer/payee"},"scheme":{"type":"string","description":"The identification scheme"}},"additionalProperties":true};function validate15(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.iban !== undefined){const _errs2 = errors;if(typeof data.iban !== "string"){validate15.errors = [{instancePath:instancePath+"/iban",schemaPath:"#/properties/iban/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.other !== undefined){let data1 = data.other;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.identification !== undefined){const _errs8 = errors;if(typeof data1.identification !== "string"){validate15.errors = [{instancePath:instancePath+"/other/identification",schemaPath:"#/$defs/OtherAccountIdentification/properties/identification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data1.scheme !== undefined){const _errs10 = errors;if(typeof data1.scheme !== "string"){validate15.errors = [{instancePath:instancePath+"/other/scheme",schemaPath:"#/$defs/OtherAccountIdentification/properties/scheme/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}else {validate15.errors = [{instancePath:instancePath+"/other",schemaPath:"#/$defs/OtherAccountIdentification/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}}}else {validate15.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate15.errors = vErrors;return errors === 0;}function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.currency !== undefined){const _errs2 = errors;if(typeof data.currency !== "string"){validate14.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/properties/currency/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.identification !== undefined){const _errs4 = errors;if(!(validate15(data.identification, {instancePath:instancePath+"/identification",parentData:data,parentDataProperty:"identification",rootData}))){vErrors = vErrors === null ? validate15.errors : vErrors.concat(validate15.errors);errors = vErrors.length;}var valid0 = _errs4 === errors;}else {var valid0 = true;}}}else {validate14.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate14.errors = vErrors;return errors === 0;}const schema24 = {"type":"object","description":"The agent details for a party","properties":{"financialInstitutionIdentification":{"$ref":"#/$defs/FinancialInstitutionIdentification"}},"additionalProperties":true};const schema25 = {"type":"object","description":"The identification of the financial institution","properties":{"bic":{"type":"string","description":"Business identifier code"}},"additionalProperties":true};function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.financialInstitutionIdentification !== undefined){let data0 = data.financialInstitutionIdentification;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.bic !== undefined){if(typeof data0.bic !== "string"){validate18.errors = [{instancePath:instancePath+"/financialInstitutionIdentification/bic",schemaPath:"#/$defs/FinancialInstitutionIdentification/properties/bic/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate18.errors = [{instancePath:instancePath+"/financialInstitutionIdentification",schemaPath:"#/$defs/FinancialInstitutionIdentification/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate18.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate18.errors = vErrors;return errors === 0;}const schema28 = {"type":"object","description":"The information specifying the type of transaction","properties":{"serviceLevel":{"$ref":"#/$defs/ServiceLevel"}},"additionalProperties":true};const schema29 = {"type":"object","description":"The rules under which the transaction should be processed","properties":{"code":{"type":"string","description":"The code for a pre-agreed service or level of service between the parties"}},"additionalProperties":true};function validate22(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.serviceLevel !== undefined){let data0 = data.serviceLevel;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.code !== undefined){if(typeof data0.code !== "string"){validate22.errors = [{instancePath:instancePath+"/serviceLevel/code",schemaPath:"#/$defs/ServiceLevel/properties/code/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate22.errors = [{instancePath:instancePath+"/serviceLevel",schemaPath:"#/$defs/ServiceLevel/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate22.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate22.errors = vErrors;return errors === 0;}const schema30 = {"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"structured":{"$ref":"#/$defs/Structured"},"unstructured":{"type":"string","description":"Information supplied to match the items of the payment in an unstructured form"}},"additionalProperties":true};const schema31 = {"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"creditorReferenceInformation":{"$ref":"#/$defs/CreditorReferenceInformation"}},"additionalProperties":true};const schema32 = {"type":"object","description":"Represents the reference to the underlying documents of the payment.","properties":{"reference":{"type":"string","description":"The reference information of the creditor's underlying documents"},"referenceIssuer":{"type":"string","description":"The entity that assigns the reference type"},"referenceType":{"type":"string","description":"The type of creditor reference"}},"additionalProperties":true};function validate25(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.creditorReferenceInformation !== undefined){let data0 = data.creditorReferenceInformation;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.reference !== undefined){const _errs6 = errors;if(typeof data0.reference !== "string"){validate25.errors = [{instancePath:instancePath+"/creditorReferenceInformation/reference",schemaPath:"#/$defs/CreditorReferenceInformation/properties/reference/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.referenceIssuer !== undefined){const _errs8 = errors;if(typeof data0.referenceIssuer !== "string"){validate25.errors = [{instancePath:instancePath+"/creditorReferenceInformation/referenceIssuer",schemaPath:"#/$defs/CreditorReferenceInformation/properties/referenceIssuer/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.referenceType !== undefined){const _errs10 = errors;if(typeof data0.referenceType !== "string"){validate25.errors = [{instancePath:instancePath+"/creditorReferenceInformation/referenceType",schemaPath:"#/$defs/CreditorReferenceInformation/properties/referenceType/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}else {validate25.errors = [{instancePath:instancePath+"/creditorReferenceInformation",schemaPath:"#/$defs/CreditorReferenceInformation/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate25.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate25.errors = vErrors;return errors === 0;}function validate24(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.structured !== undefined){const _errs2 = errors;if(!(validate25(data.structured, {instancePath:instancePath+"/structured",parentData:data,parentDataProperty:"structured",rootData}))){vErrors = vErrors === null ? validate25.errors : vErrors.concat(validate25.errors);errors = vErrors.length;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.unstructured !== undefined){const _errs3 = errors;if(typeof data.unstructured !== "string"){validate24.errors = [{instancePath:instancePath+"/unstructured",schemaPath:"#/properties/unstructured/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs3 === errors;}else {var valid0 = true;}}}else {validate24.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate24.errors = vErrors;return errors === 0;}function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.creditor !== undefined){let data0 = data.creditor;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.name !== undefined){if(typeof data0.name !== "string"){validate13.errors = [{instancePath:instancePath+"/creditor/name",schemaPath:"#/$defs/Party/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate13.errors = [{instancePath:instancePath+"/creditor",schemaPath:"#/$defs/Party/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.creditorAccount !== undefined){const _errs8 = errors;if(!(validate14(data.creditorAccount, {instancePath:instancePath+"/creditorAccount",parentData:data,parentDataProperty:"creditorAccount",rootData}))){vErrors = vErrors === null ? validate14.errors : vErrors.concat(validate14.errors);errors = vErrors.length;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.creditorAgent !== undefined){const _errs9 = errors;if(!(validate18(data.creditorAgent, {instancePath:instancePath+"/creditorAgent",parentData:data,parentDataProperty:"creditorAgent",rootData}))){vErrors = vErrors === null ? validate18.errors : vErrors.concat(validate18.errors);errors = vErrors.length;}var valid0 = _errs9 === errors;}else {var valid0 = true;}if(valid0){if(data.debtor !== undefined){let data4 = data.debtor;const _errs10 = errors;const _errs11 = errors;if(errors === _errs11){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){if(data4.name !== undefined){if(typeof data4.name !== "string"){validate13.errors = [{instancePath:instancePath+"/debtor/name",schemaPath:"#/$defs/Party/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate13.errors = [{instancePath:instancePath+"/debtor",schemaPath:"#/$defs/Party/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.debtorAccount !== undefined){const _errs16 = errors;if(!(validate14(data.debtorAccount, {instancePath:instancePath+"/debtorAccount",parentData:data,parentDataProperty:"debtorAccount",rootData}))){vErrors = vErrors === null ? validate14.errors : vErrors.concat(validate14.errors);errors = vErrors.length;}var valid0 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.debtorAgent !== undefined){const _errs17 = errors;if(!(validate18(data.debtorAgent, {instancePath:instancePath+"/debtorAgent",parentData:data,parentDataProperty:"debtorAgent",rootData}))){vErrors = vErrors === null ? validate18.errors : vErrors.concat(validate18.errors);errors = vErrors.length;}var valid0 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentIdentification !== undefined){let data8 = data.paymentIdentification;const _errs18 = errors;const _errs19 = errors;if(errors === _errs19){if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.endToEndIdentification !== undefined){const _errs22 = errors;if(typeof data8.endToEndIdentification !== "string"){validate13.errors = [{instancePath:instancePath+"/paymentIdentification/endToEndIdentification",schemaPath:"#/$defs/PaymentIdentification/properties/endToEndIdentification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs22 === errors;}else {var valid6 = true;}if(valid6){if(data8.instructionIdentification !== undefined){const _errs24 = errors;if(typeof data8.instructionIdentification !== "string"){validate13.errors = [{instancePath:instancePath+"/paymentIdentification/instructionIdentification",schemaPath:"#/$defs/PaymentIdentification/properties/instructionIdentification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs24 === errors;}else {var valid6 = true;}if(valid6){if(data8.transactionIdentification !== undefined){const _errs26 = errors;if(typeof data8.transactionIdentification !== "string"){validate13.errors = [{instancePath:instancePath+"/paymentIdentification/transactionIdentification",schemaPath:"#/$defs/PaymentIdentification/properties/transactionIdentification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs26 === errors;}else {var valid6 = true;}}}}else {validate13.errors = [{instancePath:instancePath+"/paymentIdentification",schemaPath:"#/$defs/PaymentIdentification/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentTypeInformation !== undefined){const _errs28 = errors;if(!(validate22(data.paymentTypeInformation, {instancePath:instancePath+"/paymentTypeInformation",parentData:data,parentDataProperty:"paymentTypeInformation",rootData}))){vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors);errors = vErrors.length;}var valid0 = _errs28 === errors;}else {var valid0 = true;}if(valid0){if(data.remittanceInformation !== undefined){const _errs29 = errors;if(!(validate24(data.remittanceInformation, {instancePath:instancePath+"/remittanceInformation",parentData:data,parentDataProperty:"remittanceInformation",rootData}))){vErrors = vErrors === null ? validate24.errors : vErrors.concat(validate24.errors);errors = vErrors.length;}var valid0 = _errs29 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate13.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate13.errors = vErrors;return errors === 0;}const schema34 = {"type":"object","description":"The deposit transaction terms","properties":{"interestSettings":{"$ref":"#/$defs/DepositTransactionInterestSettings"},"overdraftInterestSettings":{"$ref":"#/$defs/DepositOverdraftInterestSettings"},"overdraftSettings":{"$ref":"#/$defs/DepositOverdraftSettings"}},"additionalProperties":true};const schema35 = {"type":"object","description":"The interest settings, holds all the properties regarding interests for the deposit account","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate for the deposit account"}},"additionalProperties":true};const schema36 = {"type":"object","description":"Holds the deposit overdraft interest settings","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate that was set or changed in this transaction. Used on product interest rate changes or interest tier switches"}},"additionalProperties":true};const schema37 = {"type":"object","description":"Holds the deposit overdraft settings for a transaction","properties":{"overdraftLimit":{"type":"number","description":"The overdraft limit that was set or changed in this transaction"}},"additionalProperties":true};function validate29(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.interestSettings !== undefined){let data0 = data.interestSettings;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.indexInterestRate !== undefined){let data1 = data0.indexInterestRate;const _errs6 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate29.errors = [{instancePath:instancePath+"/interestSettings/indexInterestRate",schemaPath:"#/$defs/DepositTransactionInterestSettings/properties/indexInterestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.interestRate !== undefined){let data2 = data0.interestRate;const _errs8 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate29.errors = [{instancePath:instancePath+"/interestSettings/interestRate",schemaPath:"#/$defs/DepositTransactionInterestSettings/properties/interestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}}}else {validate29.errors = [{instancePath:instancePath+"/interestSettings",schemaPath:"#/$defs/DepositTransactionInterestSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.overdraftInterestSettings !== undefined){let data3 = data.overdraftInterestSettings;const _errs10 = errors;const _errs11 = errors;if(errors === _errs11){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){if(data3.indexInterestRate !== undefined){let data4 = data3.indexInterestRate;const _errs14 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate29.errors = [{instancePath:instancePath+"/overdraftInterestSettings/indexInterestRate",schemaPath:"#/$defs/DepositOverdraftInterestSettings/properties/indexInterestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs14 === errors;}else {var valid4 = true;}if(valid4){if(data3.interestRate !== undefined){let data5 = data3.interestRate;const _errs16 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate29.errors = [{instancePath:instancePath+"/overdraftInterestSettings/interestRate",schemaPath:"#/$defs/DepositOverdraftInterestSettings/properties/interestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs16 === errors;}else {var valid4 = true;}}}else {validate29.errors = [{instancePath:instancePath+"/overdraftInterestSettings",schemaPath:"#/$defs/DepositOverdraftInterestSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.overdraftSettings !== undefined){let data6 = data.overdraftSettings;const _errs18 = errors;const _errs19 = errors;if(errors === _errs19){if(data6 && typeof data6 == "object" && !Array.isArray(data6)){if(data6.overdraftLimit !== undefined){let data7 = data6.overdraftLimit;if(!((typeof data7 == "number") && (isFinite(data7)))){validate29.errors = [{instancePath:instancePath+"/overdraftSettings/overdraftLimit",schemaPath:"#/$defs/DepositOverdraftSettings/properties/overdraftLimit/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}}else {validate29.errors = [{instancePath:instancePath+"/overdraftSettings",schemaPath:"#/$defs/DepositOverdraftSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs18 === errors;}else {var valid0 = true;}}}}else {validate29.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate29.errors = vErrors;return errors === 0;}const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountBalances !== undefined){let data0 = data.accountBalances;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.totalBalance !== undefined){let data1 = data0.totalBalance;if(!((typeof data1 == "number") && (isFinite(data1)))){validate10.errors = [{instancePath:instancePath+"/accountBalances/totalBalance",schemaPath:"#/$defs/DepositTransactionBalances/properties/totalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}}else {validate10.errors = [{instancePath:instancePath+"/accountBalances",schemaPath:"#/$defs/DepositTransactionBalances/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.adjustmentTransactionKey !== undefined){const _errs8 = errors;if(typeof data.adjustmentTransactionKey !== "string"){validate10.errors = [{instancePath:instancePath+"/adjustmentTransactionKey",schemaPath:"#/properties/adjustmentTransactionKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.affectedAmounts !== undefined){let data3 = data.affectedAmounts;const _errs10 = errors;const _errs11 = errors;if(errors === _errs11){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){if(data3.feesAmount !== undefined){let data4 = data3.feesAmount;const _errs14 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/feesAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/feesAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs14 === errors;}else {var valid4 = true;}if(valid4){if(data3.fractionAmount !== undefined){let data5 = data3.fractionAmount;const _errs16 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/fractionAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/fractionAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs16 === errors;}else {var valid4 = true;}if(valid4){if(data3.fundsAmount !== undefined){let data6 = data3.fundsAmount;const _errs18 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/fundsAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/fundsAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs18 === errors;}else {var valid4 = true;}if(valid4){if(data3.interestAmount !== undefined){let data7 = data3.interestAmount;const _errs20 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/interestAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/interestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs20 === errors;}else {var valid4 = true;}if(valid4){if(data3.overdraftAmount !== undefined){let data8 = data3.overdraftAmount;const _errs22 = errors;if(!((typeof data8 == "number") && (isFinite(data8)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/overdraftAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/overdraftAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs22 === errors;}else {var valid4 = true;}if(valid4){if(data3.overdraftFeesAmount !== undefined){let data9 = data3.overdraftFeesAmount;const _errs24 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/overdraftFeesAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/overdraftFeesAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs24 === errors;}else {var valid4 = true;}if(valid4){if(data3.overdraftInterestAmount !== undefined){let data10 = data3.overdraftInterestAmount;const _errs26 = errors;if(!((typeof data10 == "number") && (isFinite(data10)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/overdraftInterestAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/overdraftInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs26 === errors;}else {var valid4 = true;}if(valid4){if(data3.technicalOverdraftAmount !== undefined){let data11 = data3.technicalOverdraftAmount;const _errs28 = errors;if(!((typeof data11 == "number") && (isFinite(data11)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/technicalOverdraftAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/technicalOverdraftAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs28 === errors;}else {var valid4 = true;}if(valid4){if(data3.technicalOverdraftInterestAmount !== undefined){let data12 = data3.technicalOverdraftInterestAmount;const _errs30 = errors;if(!((typeof data12 == "number") && (isFinite(data12)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/technicalOverdraftInterestAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/technicalOverdraftInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs30 === errors;}else {var valid4 = true;}}}}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/affectedAmounts",schemaPath:"#/$defs/DepositAffectedAmounts/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data13 = data.amount;const _errs32 = errors;if(!((typeof data13 == "number") && (isFinite(data13)))){validate10.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs32 === errors;}else {var valid0 = true;}if(valid0){if(data.blockId !== undefined){const _errs34 = errors;if(typeof data.blockId !== "string"){validate10.errors = [{instancePath:instancePath+"/blockId",schemaPath:"#/properties/blockId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs34 === errors;}else {var valid0 = true;}if(valid0){if(data.bookingDate !== undefined){const _errs36 = errors;if(errors === _errs36){if(errors === _errs36){if(!(typeof data.bookingDate === "string")){validate10.errors = [{instancePath:instancePath+"/bookingDate",schemaPath:"#/properties/bookingDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs36 === errors;}else {var valid0 = true;}if(valid0){if(data.branchKey !== undefined){const _errs38 = errors;if(typeof data.branchKey !== "string"){validate10.errors = [{instancePath:instancePath+"/branchKey",schemaPath:"#/properties/branchKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs38 === errors;}else {var valid0 = true;}if(valid0){if(data.cardTransaction !== undefined){const _errs40 = errors;if(!(validate11(data.cardTransaction, {instancePath:instancePath+"/cardTransaction",parentData:data,parentDataProperty:"cardTransaction",rootData}))){vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors);errors = vErrors.length;}var valid0 = _errs40 === errors;}else {var valid0 = true;}if(valid0){if(data.cardTransactionReversals !== undefined){let data18 = data.cardTransactionReversals;const _errs41 = errors;if(errors === _errs41){if(Array.isArray(data18)){var valid5 = true;const len0 = data18.length;for(let i0=0; i0 Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuCentresConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/centres.yaml + * * Get centres configuration */ public get({ @@ -54,22 +58,24 @@ export class MambuCentresConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/centres.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/centres.yaml + * * Update centres configuration */ public update({ @@ -83,15 +89,13 @@ export class MambuCentresConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/centres.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/centres.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -99,50 +103,52 @@ export class MambuCentresConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -150,8 +156,7 @@ export class MambuCentresConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -159,21 +164,21 @@ export class MambuCentresConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/centres/rest.client.ts b/src/centres/rest.client.ts index 67a7bb4..10a0434 100644 --- a/src/centres/rest.client.ts +++ b/src/centres/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { Centre, ErrorResponse, GetAllResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { Centre, ErrorResponse, GetAllResponse } from './rest.type.js' * centres */ export class MambuCentres { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuCentres { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /centres + * * Get centres */ public getAll({ @@ -70,7 +74,7 @@ export class MambuCentres { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -79,7 +83,6 @@ export class MambuCentres { this.buildClient(auth).get('centres', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -87,10 +90,13 @@ export class MambuCentres { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /centres/{centreId} + * * Get centre */ public getById({ @@ -106,7 +112,7 @@ export class MambuCentres { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -115,7 +121,6 @@ export class MambuCentres { this.buildClient(auth).get(`centres/${path.centreId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Centre, @@ -124,50 +129,52 @@ export class MambuCentres { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -175,8 +182,7 @@ export class MambuCentres { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -184,21 +190,21 @@ export class MambuCentres { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/client-documents/rest.client.ts b/src/client-documents/rest.client.ts index 9f4ccc7..8059ce8 100644 --- a/src/client-documents/rest.client.ts +++ b/src/client-documents/rest.client.ts @@ -7,16 +7,16 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' -import { Document, ErrorResponse, GetDocumentsByClientIdResponse } from './rest.type.js' +import { CreateDocumentRequest, Document, ErrorResponse, GetDocumentsByClientIdResponse } from './rest.type.js' /** * clients/documents */ export class MambuClientDocuments { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,46 +31,70 @@ export class MambuClientDocuments { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /clients/{clientId}/documents + * * Create client document */ public createDocument({ + body, path, headers, auth = [['apiKey'], ['basic']], - }: { path: { clientId: string }; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + }: { + body: CreateDocumentRequest + path: { clientId: string } + headers?: { 'Idempotency-Key'?: string } + auth?: string[][] | string[] + }): Promise< | SuccessResponse<'201', Document> | FailureResponse<'400', ErrorResponse, 'response:statuscode'> | FailureResponse<'401', ErrorResponse, 'response:statuscode'> | FailureResponse<'403', ErrorResponse, 'response:statuscode'> | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { + const _body = this.validateRequestBody(CreateDocumentRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } + + const _form = new FormData() + for (const [key, value] of Object.entries(_body.right as CreateDocumentRequest)) { + if (value instanceof Blob || value instanceof File) { + _form.append(key, value) + } else if (value !== null && value !== undefined) { + _form.append(key, value as string) + } + } return this.awaitResponse( this.buildClient(auth).post(`clients/${path.clientId}/documents`, { + body: _form, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 201: Document, @@ -79,10 +103,13 @@ export class MambuClientDocuments { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /clients/documents/{documentId}/metadata + * * Get client document */ public getClientDocumentById({ @@ -97,7 +124,7 @@ export class MambuClientDocuments { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -105,7 +132,6 @@ export class MambuClientDocuments { return this.awaitResponse( this.buildClient(auth).get(`clients/documents/${path.documentId}/metadata`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Document, @@ -114,10 +140,13 @@ export class MambuClientDocuments { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /clients/documents/{documentId} + * * Download client document */ public getClientDocumentFileById({ @@ -132,15 +161,13 @@ export class MambuClientDocuments { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).get(`clients/documents/${path.documentId}`, { - responseType: 'text', - }), + this.buildClient(auth).get(`clients/documents/${path.documentId}`, {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -148,10 +175,13 @@ export class MambuClientDocuments { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * GET /clients/{clientId}/documentsMetadata + * * Get all client documents */ public getDocumentsByClientId({ @@ -171,7 +201,7 @@ export class MambuClientDocuments { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -180,7 +210,6 @@ export class MambuClientDocuments { this.buildClient(auth).get(`clients/${path.clientId}/documentsMetadata`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetDocumentsByClientIdResponse, @@ -189,50 +218,70 @@ export class MambuClientDocuments { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } + public validateRequestBody { left: DefinedError[] } | { right: Body } }, Body>( + parser: Parser, + body: unknown, + ) { + const _body = parser.parse(body) + if ('left' in _body) { + return { + statusCode: undefined, + status: undefined, + headers: undefined, + left: body, + validationErrors: _body.left, + where: 'request:body', + } satisfies FailureResponse + } + return _body + } + public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -240,8 +289,7 @@ export class MambuClientDocuments { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -249,21 +297,21 @@ export class MambuClientDocuments { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/client-documents/rest.type.ts b/src/client-documents/rest.type.ts index 8dd3f8c..b3a7e2c 100644 --- a/src/client-documents/rest.type.ts +++ b/src/client-documents/rest.type.ts @@ -6,10 +6,43 @@ import type { DefinedError, ValidateFunction } from 'ajv' +import { validate as CreateDocumentRequestValidator } from './schemas/create-document-request.schema.js' import { validate as DocumentValidator } from './schemas/document.schema.js' import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' import { validate as GetDocumentsByClientIdResponseValidator } from './schemas/get-documents-by-client-id-response.schema.js' +export interface CreateDocumentRequest { + /** + * The file to be attached for a client. + */ + file: string + /** + * The name (title) of the attached file. + */ + name?: string | undefined + /** + * The description of the attached file. + */ + notes?: string | undefined +} + +export const CreateDocumentRequest = { + validate: CreateDocumentRequestValidator as ValidateFunction, + get schema() { + return CreateDocumentRequest.validate.schema + }, + get errors() { + return CreateDocumentRequest.validate.errors ?? undefined + }, + is: (o: unknown): o is CreateDocumentRequest => CreateDocumentRequest.validate(o) === true, + parse: (o: unknown): { right: CreateDocumentRequest } | { left: DefinedError[] } => { + if (CreateDocumentRequest.is(o)) { + return { right: o } + } + return { left: (CreateDocumentRequest.errors ?? []) as DefinedError[] } + }, +} as const + /** * Holds information regarding the documents uploaded as attachments */ diff --git a/src/client-documents/schemas/create-document-request.schema.js b/src/client-documents/schemas/create-document-request.schema.js new file mode 100644 index 0000000..e1b54f4 --- /dev/null +++ b/src/client-documents/schemas/create-document-request.schema.js @@ -0,0 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck +/** + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code + */ +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CreateDocumentRequest","type":"object","properties":{"file":{"type":"string","description":"The file to be attached for a client."},"name":{"type":"string","description":"The name (title) of the attached file."},"notes":{"type":"string","description":"The description of the attached file."}},"required":["file"],"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.file === undefined) && (missing0 = "file")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.file !== undefined){const _errs2 = errors;if(typeof data.file !== "string"){validate10.errors = [{instancePath:instancePath+"/file",schemaPath:"#/properties/file/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs4 = errors;if(typeof data.name !== "string"){validate10.errors = [{instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs6 = errors;if(typeof data.notes !== "string"){validate10.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file diff --git a/src/client-roles-configuration/rest.client.ts b/src/client-roles-configuration/rest.client.ts index 8ab57d5..1991eec 100644 --- a/src/client-roles-configuration/rest.client.ts +++ b/src/client-roles-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/clientroles.yaml */ export class MambuClientRolesConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuClientRolesConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/clientroles.yaml + * * Get client roles configuration */ public get({ @@ -58,7 +62,7 @@ export class MambuClientRolesConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -67,7 +71,6 @@ export class MambuClientRolesConfiguration { this.buildClient(auth).get('configuration/clientroles.yaml', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -75,10 +78,13 @@ export class MambuClientRolesConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/clientroles.yaml + * * Update client roles configuration */ public update({ @@ -92,15 +98,13 @@ export class MambuClientRolesConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/clientroles.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/clientroles.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -108,50 +112,52 @@ export class MambuClientRolesConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -159,8 +165,7 @@ export class MambuClientRolesConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -168,21 +173,21 @@ export class MambuClientRolesConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/clients.schema.ts b/src/clients.schema.ts index d259606..01bcfe8 100644 --- a/src/clients.schema.ts +++ b/src/clients.schema.ts @@ -3,18 +3,20 @@ import type { OpenapiV3 } from '@skyleague/therefore' import { $restclient } from '@skyleague/therefore' import type { PathItem } from '@skyleague/therefore/src/types/openapi.type.js' import camelCase from 'camelcase' -import got from 'got' +import ky from 'ky' export interface Clients { items: { jsonPath: string; label: string; hashValue: string; index?: number }[] } const baseUrl = 'https://demotenant.dev.mambucloud.com/api/swagger/' -const client = got.extend({ prefixUrl: baseUrl }) +const client = ky.extend({ prefixUrl: baseUrl }) const clients = await client.get('resources').json() const clientList = [ - ...clients.items.filter((i) => !i.jsonPath.includes('{') && i.hashValue !== 'Loan_Accounts'), + ...clients.items.filter( + (i) => !i.jsonPath.includes('{') && i.hashValue !== 'Loan_Accounts' && i.hashValue !== 'Archived_Deposits', + ), { jsonPath: 'json/loans_v2_swagger.json', label: 'Loan Accounts', hashValue: 'Loan_Accounts' }, { jsonPath: 'json/loans_schedule_v2_swagger.json', label: 'Loan Account Schedule', hashValue: 'Loan_Account_Schedule' }, ] @@ -54,6 +56,7 @@ for (const item of clientList) { filename: `${clientName}/rest.client.ts`, strict: false, formats: false, + client: 'ky', transformOpenapi: (api: OpenapiV3) => { const securitySchemes = api.components?.securitySchemes const injectApiKey = diff --git a/src/clients/rest.client.ts b/src/clients/rest.client.ts index c61c55c..ac85319 100644 --- a/src/clients/rest.client.ts +++ b/src/clients/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { Client, @@ -25,7 +25,7 @@ import { * clients */ export class MambuClients { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -40,22 +40,26 @@ export class MambuClients { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /clients + * * Create client */ public create({ @@ -72,7 +76,7 @@ export class MambuClients { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -84,9 +88,8 @@ export class MambuClients { return this.awaitResponse( this.buildClient(auth).post('clients', { - json: body, + json: _body.right as Client, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -95,10 +98,13 @@ export class MambuClients { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /clients/{clientId} + * * Delete client */ public delete({ @@ -113,15 +119,13 @@ export class MambuClients { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`clients/${path.clientId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`clients/${path.clientId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -129,10 +133,13 @@ export class MambuClients { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /clients + * * Get clients */ public getAll({ @@ -163,7 +170,7 @@ export class MambuClients { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -172,7 +179,6 @@ export class MambuClients { this.buildClient(auth).get('clients', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -180,10 +186,13 @@ export class MambuClients { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /clients/{clientId} + * * Get client */ public getById({ @@ -199,7 +208,7 @@ export class MambuClients { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -208,7 +217,6 @@ export class MambuClients { this.buildClient(auth).get(`clients/${path.clientId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Client, @@ -217,10 +225,13 @@ export class MambuClients { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /clients/{clientId}/creditarrangements + * * Credit arrangements list returned. */ public getCreditArrangementsByClientIdOrKey({ @@ -240,7 +251,7 @@ export class MambuClients { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -249,7 +260,6 @@ export class MambuClients { this.buildClient(auth).get(`clients/${path.clientId}/creditarrangements`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetCreditArrangementsByClientIdOrKeyResponse, @@ -258,10 +268,13 @@ export class MambuClients { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /clients/{clientId}/role + * * Get client role for client */ public getRoleByClientId({ @@ -275,7 +288,7 @@ export class MambuClients { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -283,7 +296,6 @@ export class MambuClients { return this.awaitResponse( this.buildClient(auth).get(`clients/${path.clientId}/role`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: ClientRole, @@ -291,17 +303,26 @@ export class MambuClients { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /clients/{clientId} + * * Partially update client */ public patch({ body, path, + query, auth = [['apiKey'], ['basic']], - }: { body: PatchRequest; path: { clientId: string }; auth?: string[][] | string[] }): Promise< + }: { + body: PatchRequest + path: { clientId: string } + query?: { keepAssociationForAccounts?: string } + auth?: string[][] | string[] + }): Promise< | SuccessResponse<'204', unknown> | FailureResponse<'400', ErrorResponse, 'response:statuscode'> | FailureResponse<'401', ErrorResponse, 'response:statuscode'> @@ -311,7 +332,7 @@ export class MambuClients { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -323,8 +344,8 @@ export class MambuClients { return this.awaitResponse( this.buildClient(auth).patch(`clients/${path.clientId}`, { - json: body, - responseType: 'text', + json: _body.right as PatchRequest, + searchParams: query ?? {}, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -333,10 +354,13 @@ export class MambuClients { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /clients:search + * * Search clients */ public search({ @@ -356,7 +380,7 @@ export class MambuClients { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -368,10 +392,9 @@ export class MambuClients { return this.awaitResponse( this.buildClient(auth).post('clients:search', { - json: body, + json: _body.right as ClientSearchCriteria, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: SearchResponse, @@ -379,17 +402,26 @@ export class MambuClients { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /clients/{clientId} + * * Update client */ public update({ body, path, + query, auth = [['apiKey'], ['basic']], - }: { body: Client; path: { clientId: string }; auth?: string[][] | string[] }): Promise< + }: { + body: Client + path: { clientId: string } + query?: { keepAssociationForAccounts?: string } + auth?: string[][] | string[] + }): Promise< | SuccessResponse<'200', Client> | FailureResponse<'400', ErrorResponse, 'response:statuscode'> | FailureResponse<'401', ErrorResponse, 'response:statuscode'> @@ -399,7 +431,7 @@ export class MambuClients { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -411,9 +443,9 @@ export class MambuClients { return this.awaitResponse( this.buildClient(auth).put(`clients/${path.clientId}`, { - json: body, + json: _body.right as Client, + searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Client, @@ -422,6 +454,7 @@ export class MambuClients { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -446,44 +479,45 @@ export class MambuClients { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -491,8 +525,7 @@ export class MambuClients { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -500,21 +533,21 @@ export class MambuClients { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/comments/rest.client.ts b/src/comments/rest.client.ts index 5177ca5..8500348 100644 --- a/src/comments/rest.client.ts +++ b/src/comments/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { Comment, ErrorResponse, GetCommentsResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { Comment, ErrorResponse, GetCommentsResponse } from './rest.type.js' * comments */ export class MambuComments { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuComments { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /comments + * * Create a new comment for an entity. */ public createComment({ @@ -63,7 +67,7 @@ export class MambuComments { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -75,9 +79,8 @@ export class MambuComments { return this.awaitResponse( this.buildClient(auth).post('comments', { - json: body, + json: _body.right as Comment, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -86,10 +89,13 @@ export class MambuComments { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /comments + * * Get comments for an entity */ public getComments({ @@ -107,7 +113,7 @@ export class MambuComments { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -116,7 +122,6 @@ export class MambuComments { this.buildClient(auth).get('comments', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetCommentsResponse, @@ -125,6 +130,7 @@ export class MambuComments { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -149,44 +155,45 @@ export class MambuComments { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -194,8 +201,7 @@ export class MambuComments { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -203,21 +209,21 @@ export class MambuComments { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/communications/rest.client.ts b/src/communications/rest.client.ts index cf05fc6..b2bb026 100644 --- a/src/communications/rest.client.ts +++ b/src/communications/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { CommunicationMessage, @@ -25,7 +25,7 @@ import { * communications/messages */ export class MambuCommunications { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -40,22 +40,26 @@ export class MambuCommunications { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /communications/messages:resendAsyncByDate + * * Resend failed communication message(s) asynchronously by date */ public enqueueByDate({ @@ -77,7 +81,7 @@ export class MambuCommunications { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -89,9 +93,8 @@ export class MambuCommunications { return this.awaitResponse( this.buildClient(auth).post('communications/messages:resendAsyncByDate', { - json: body, + json: _body.right as CommunicationMessageEnqueueAction, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -101,10 +104,13 @@ export class MambuCommunications { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /communications/messages:resendAsyncByKeys + * * Resend failed communication message(s) asynchronously using keys */ public enqueueByKeys({ @@ -122,7 +128,7 @@ export class MambuCommunications { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -134,9 +140,8 @@ export class MambuCommunications { return this.awaitResponse( this.buildClient(auth).post('communications/messages:resendAsyncByKeys', { - json: body, + json: _body.right as CommunicationMessageAction, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -146,10 +151,13 @@ export class MambuCommunications { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /communications/messages/{encodedKey} + * * Get communication message */ public getByEncodedKey({ @@ -165,7 +173,7 @@ export class MambuCommunications { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -174,7 +182,6 @@ export class MambuCommunications { this.buildClient(auth).get(`communications/messages/${path.encodedKey}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: CommunicationMessage, @@ -183,10 +190,13 @@ export class MambuCommunications { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /communications/messages:resend + * * Resend failed communication message(s) */ public resend({ @@ -204,7 +214,7 @@ export class MambuCommunications { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -216,9 +226,8 @@ export class MambuCommunications { return this.awaitResponse( this.buildClient(auth).post('communications/messages:resend', { - json: body, + json: _body.right as CommunicationMessageAction, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -228,10 +237,13 @@ export class MambuCommunications { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /communications/messages:search + * * Searching communication messages */ public search({ @@ -251,7 +263,7 @@ export class MambuCommunications { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -263,10 +275,9 @@ export class MambuCommunications { return this.awaitResponse( this.buildClient(auth).post('communications/messages:search', { - json: body, + json: _body.right as SearchRequest, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: SearchResponse, @@ -274,10 +285,13 @@ export class MambuCommunications { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /communications/messages:searchSorted + * * Searching sorted communication messages */ public search1({ @@ -297,7 +311,7 @@ export class MambuCommunications { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -309,10 +323,9 @@ export class MambuCommunications { return this.awaitResponse( this.buildClient(auth).post('communications/messages:searchSorted', { - json: body, + json: _body.right as CommunicationMessagesSearchSortCriteria, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Search1Response, @@ -320,10 +333,13 @@ export class MambuCommunications { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /communications/messages + * * Send communication message */ public send({ @@ -340,7 +356,7 @@ export class MambuCommunications { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -352,9 +368,8 @@ export class MambuCommunications { return this.awaitResponse( this.buildClient(auth).post('communications/messages', { - json: body, + json: _body.right as CommunicationMessage, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -363,6 +378,7 @@ export class MambuCommunications { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } @@ -387,44 +403,45 @@ export class MambuCommunications { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -432,8 +449,7 @@ export class MambuCommunications { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -441,21 +457,21 @@ export class MambuCommunications { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/credit-arrangements/rest.client.ts b/src/credit-arrangements/rest.client.ts index c5edbf6..57c88f6 100644 --- a/src/credit-arrangements/rest.client.ts +++ b/src/credit-arrangements/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { AddCreditArrangementAccountInput, @@ -28,7 +28,7 @@ import { * creditarrangements */ export class MambuCreditArrangements { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -43,22 +43,26 @@ export class MambuCreditArrangements { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /creditarrangements/{creditArrangementId}:addAccount + * * Add account to credit arrangement */ public addAccount({ @@ -82,7 +86,7 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -94,9 +98,8 @@ export class MambuCreditArrangements { return this.awaitResponse( this.buildClient(auth).post(`creditarrangements/${path.creditArrangementId}:addAccount`, { - json: body, + json: _body.right as AddCreditArrangementAccountInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -106,10 +109,13 @@ export class MambuCreditArrangements { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /creditarrangements/{creditArrangementId}:changeState + * * Change credit arrangement state */ public changeState({ @@ -133,7 +139,7 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -145,9 +151,8 @@ export class MambuCreditArrangements { return this.awaitResponse( this.buildClient(auth).post(`creditarrangements/${path.creditArrangementId}:changeState`, { - json: body, + json: _body.right as CreditArrangementAction, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -157,10 +162,13 @@ export class MambuCreditArrangements { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /creditarrangements + * * Create credit arrangement */ public create({ @@ -177,7 +185,7 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -189,9 +197,8 @@ export class MambuCreditArrangements { return this.awaitResponse( this.buildClient(auth).post('creditarrangements', { - json: body, + json: _body.right as CreditArrangement, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -200,10 +207,13 @@ export class MambuCreditArrangements { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /creditarrangements/{creditArrangementId} + * * Delete credit arrangement */ public delete({ @@ -218,15 +228,13 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`creditarrangements/${path.creditArrangementId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`creditarrangements/${path.creditArrangementId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -234,10 +242,13 @@ export class MambuCreditArrangements { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /creditarrangements + * * Get credit arrangements */ public getAll({ @@ -254,7 +265,7 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -263,7 +274,6 @@ export class MambuCreditArrangements { this.buildClient(auth).get('creditarrangements', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -271,10 +281,13 @@ export class MambuCreditArrangements { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /creditarrangements/{creditArrangementId}/accounts + * * Get all loan and deposit accounts linked to credit arrangement */ public getAllAccounts({ @@ -288,7 +301,7 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -296,7 +309,6 @@ export class MambuCreditArrangements { return this.awaitResponse( this.buildClient(auth).get(`creditarrangements/${path.creditArrangementId}/accounts`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: CreditArrangementAccounts, @@ -304,10 +316,13 @@ export class MambuCreditArrangements { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /creditarrangements/{creditArrangementId} + * * Get credit arrangement */ public getById({ @@ -323,7 +338,7 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -332,7 +347,6 @@ export class MambuCreditArrangements { this.buildClient(auth).get(`creditarrangements/${path.creditArrangementId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: CreditArrangement, @@ -341,10 +355,13 @@ export class MambuCreditArrangements { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /creditarrangements/{creditArrangementId}/schedule + * * Get credit arrangement schedule */ public getSchedule({ @@ -360,7 +377,7 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -369,7 +386,6 @@ export class MambuCreditArrangements { this.buildClient(auth).get(`creditarrangements/${path.creditArrangementId}/schedule`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: CreditArrangementSchedule, @@ -378,10 +394,13 @@ export class MambuCreditArrangements { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /creditarrangements/{creditArrangementId} + * * Partially update credit arrangement */ public patch({ @@ -398,7 +417,7 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -410,8 +429,7 @@ export class MambuCreditArrangements { return this.awaitResponse( this.buildClient(auth).patch(`creditarrangements/${path.creditArrangementId}`, { - json: body, - responseType: 'text', + json: _body.right as PatchRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -420,10 +438,13 @@ export class MambuCreditArrangements { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /creditarrangements/{creditArrangementId}:removeAccount + * * Remove account from credit arrangement */ public removeAccount({ @@ -447,7 +468,7 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -459,9 +480,8 @@ export class MambuCreditArrangements { return this.awaitResponse( this.buildClient(auth).post(`creditarrangements/${path.creditArrangementId}:removeAccount`, { - json: body, + json: _body.right as RemoveCreditArrangementAccountInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -471,10 +491,13 @@ export class MambuCreditArrangements { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /creditarrangements:search + * * Search credit arrangements */ public search({ @@ -494,7 +517,7 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -506,10 +529,9 @@ export class MambuCreditArrangements { return this.awaitResponse( this.buildClient(auth).post('creditarrangements:search', { - json: body, + json: _body.right as CreditArrangementSearchCriteria, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: SearchResponse, @@ -517,10 +539,13 @@ export class MambuCreditArrangements { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /creditarrangements/{creditArrangementId} + * * Update credit arrangement */ public update({ @@ -537,7 +562,7 @@ export class MambuCreditArrangements { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -549,9 +574,8 @@ export class MambuCreditArrangements { return this.awaitResponse( this.buildClient(auth).put(`creditarrangements/${path.creditArrangementId}`, { - json: body, + json: _body.right as CreditArrangement, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: CreditArrangement, @@ -560,6 +584,7 @@ export class MambuCreditArrangements { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -584,44 +609,45 @@ export class MambuCreditArrangements { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -629,8 +655,7 @@ export class MambuCreditArrangements { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -638,21 +663,21 @@ export class MambuCreditArrangements { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/credit-arrangements/rest.type.ts b/src/credit-arrangements/rest.type.ts index d8a2c9a..6d9b80c 100644 --- a/src/credit-arrangements/rest.type.ts +++ b/src/credit-arrangements/rest.type.ts @@ -957,6 +957,10 @@ export interface DepositAccount { notes?: string | undefined overdraftInterestSettings?: DepositAccountOverdraftInterestSettings | undefined overdraftSettings?: DepositAccountOverdraftSettings | undefined + /** + * The history of deposit account ownership + */ + ownershipHistory?: DepositAccountOwnershipHistory[] | undefined /** * The key to the product type that this account is based on. */ @@ -1247,6 +1251,20 @@ export interface DepositAccountOverdraftSettings { overdraftLimit?: number | undefined } +/** + * The history of deposit account ownership + */ +export interface DepositAccountOwnershipHistory { + /** + * They key of the previous account holder + */ + previousOwnerKey?: string | undefined + /** + * The transfer date of the account ownership + */ + transferDate?: string | undefined +} + /** * The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees. */ @@ -1479,6 +1497,10 @@ export interface InterestSettings { * Indicates whether late interest is accrued for this loan account */ accrueLateInterest?: boolean | undefined + /** + * The effective interest rate. Represents the interest rate for the loan accounts with semi-annually compounding product. + */ + effectiveInterestRate?: number | undefined interestApplicationDays?: DaysInMonth | undefined /** * The interest application method. Represents the interest application method that determines whether the interest gets applied on the account's disbursement or on each repayment. diff --git a/src/credit-arrangements/schemas/credit-arrangement-accounts.schema.js b/src/credit-arrangements/schemas/credit-arrangement-accounts.schema.js index 54fff5b..e1fd073 100644 --- a/src/credit-arrangements/schemas/credit-arrangement-accounts.schema.js +++ b/src/credit-arrangements/schemas/credit-arrangement-accounts.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CreditArrangementAccounts","type":"object","description":"Represents loan and deposit accounts linked to a credit arrangement.","properties":{"depositAccounts":{"type":"array","description":"List of the deposit accounts linked to the credit arrangement.","items":{"$ref":"#/$defs/DepositAccount"}},"loanAccounts":{"type":"array","description":"List of loan accounts linked to the credit arrangement.","items":{"$ref":"#/$defs/LoanAccount"}}},"additionalProperties":true,"$defs":{"DepositAccount":{"type":"object","description":"Represents information about a deposit account.","properties":{"accountHolderKey":{"type":"string","description":"The encoded key of the account holder, which is an individual client or group."},"accountHolderType":{"description":"The account holder type.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the deposit account.","enum":["PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","MATURED","LOCKED","DORMANT","CLOSED","CLOSED_WRITTEN_OFF","WITHDRAWN","CLOSED_REJECTED"]},"accountType":{"description":"The deposit account type and the product that it belongs to.","enum":["CURRENT_ACCOUNT","REGULAR_SAVINGS","FIXED_DEPOSIT","SAVINGS_PLAN","INVESTOR_ACCOUNT"]},"accruedAmounts":{"$ref":"#/$defs/DepositAccountAccruedAmounts"},"activationDate":{"type":"string","description":"The date when the deposit account was activated, in the organization's timezone and time format.","format":"date-time"},"approvedDate":{"type":"string","description":"The date when the deposit account was approved, in the organization's timezone and time format.","format":"date-time"},"assignedBranchKey":{"type":"string","description":"The key of the branch that this deposit account is assigned to."},"assignedCentreKey":{"type":"string","description":"The key of the centre that this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user that this deposit is assigned to."},"balances":{"$ref":"#/$defs/DepositAccountBalances"},"closedDate":{"type":"string","description":"The date when the deposit account was closed, in UTC.","format":"date-time"},"creationDate":{"type":"string","description":"The date this deposit account was created, in UTC.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the credit arrangement where this account is registered."},"currencyCode":{"type":"string","description":"The currency code."},"encodedKey":{"type":"string","description":"The encoded key of the deposit account, which is auto-generated and unique."},"id":{"type":"string","description":"The ID of the deposit account, which can be generated and customized - but must be unique."},"interestSettings":{"$ref":"#/$defs/DepositAccountInterestSettings"},"internalControls":{"$ref":"#/$defs/DepositAccountInternalControls"},"lastAccountAppraisalDate":{"type":"string","description":"The date when the account was last evaluated for interest calculations and maturity, in the organization's timezone and time format.","format":"date-time"},"lastInterestCalculationDate":{"type":"string","description":"The date when interest was last calculated for the account, in the organization's timezone and time format.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date when regular interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastInterestStoredDate":{"type":"string","description":"The date when interest was last applied on the account, in the organization's timezone and time format.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last update date for the deposit account, in UTC.","format":"date-time"},"lastOverdraftInterestReviewDate":{"type":"string","description":"The date when the overdraft interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the deposit account was set to In Arrears, or null if the account is not In Arrears. The date is in the organization's timezone and time format.","format":"date-time"},"linkedSettlementAccountKeys":{"type":"array","description":"Lists all loan account keys on which the deposit account is used as the settlement account.","items":{"type":"string"}},"lockedDate":{"type":"string","description":"The date when the deposit account was locked, in the organization's timezone and time format.","format":"date-time"},"maturityDate":{"type":"string","description":"The date when the account matures, for fixed or compulsory savings plans, in the organization's timezone and time format.","format":"date-time"},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this deposit account. If this account was imported, you can track which migration event it came from."},"name":{"type":"string","description":"The deposit account name."},"notes":{"type":"string","description":"The notes or description attached to this object."},"overdraftInterestSettings":{"$ref":"#/$defs/DepositAccountOverdraftInterestSettings"},"overdraftSettings":{"$ref":"#/$defs/DepositAccountOverdraftSettings"},"productTypeKey":{"type":"string","description":"The key to the product type that this account is based on."},"withholdingTaxSourceKey":{"type":"string","description":"The tax source where the account withholding taxes will be updated."}},"required":["accountHolderKey","accountHolderType","name","productTypeKey"],"additionalProperties":true},"DepositAccountAccruedAmounts":{"type":"object","description":"Represents information about the accrued amounts of deposit accounts.","properties":{"interestAccrued":{"type":"number","description":"The amount of positive interest that has been accrued in the account."},"negativeInterestAccrued":{"type":"number","description":"The amount of negative interest that has been accrued in the account."},"overdraftInterestAccrued":{"type":"number","description":"The amount of overdraft interest that has been accrued in the account."},"technicalOverdraftInterestAccrued":{"type":"number","description":"The amount of technical overdraft interest that has been accrued in the account."}},"additionalProperties":true},"DepositAccountBalances":{"type":"object","description":"Represents information about the balances of a deposit account.","properties":{"availableBalance":{"type":"number","description":"The current available balance for deposit transactions."},"blockedBalance":{"type":"number","description":"The sum of all the blocked amounts on an account."},"feesDue":{"type":"number","description":"The amount of fees due to be paid on this account."},"forwardAvailableBalance":{"type":"number","description":"The sum of all the authorization hold amounts that have `CRDT` as the `creditDebitIndicator` for an account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts that have `DBIT` as the `creditDebitIndicator` for an account."},"lockedBalance":{"type":"number","description":"The locked amount that is not available for withdrawal in the account. For more information, see [Deposit Account Overview Details](https://support.mambu.com/docs/deposit-account-overview-details)."},"overdraftAmount":{"type":"number","description":"The overdraft amount that has been taken out in the account. For more information, see [Overdraft Products](https://support.mambu.com/docs/en/overdraft-products)."},"overdraftInterestDue":{"type":"number","description":"The amount of interest due to be paid on an account as a result of an authorized overdraft."},"technicalOverdraftAmount":{"type":"number","description":"The technical overdraft amount that has been taken out in the account. For more information, see [Technical Overdraft](https://support.mambu.com/docs/en/overdraft-products#technical-overdraft)."},"technicalOverdraftInterestDue":{"type":"number","description":"The amount of interest due to be paid on an account as a result of a technical overdraft."},"totalBalance":{"type":"number","description":"The current balance of the account."}},"additionalProperties":true},"DepositAccountInterestSettings":{"type":"object","description":"Represents information about the deposit account's interest settings.","properties":{"interestPaymentSettings":{"$ref":"#/$defs/DepositAccountInterestPaymentSettings"},"interestRateSettings":{"$ref":"#/$defs/DepositAccountInterestRateSettings"}},"additionalProperties":true},"DepositAccountInterestPaymentSettings":{"type":"object","description":"Represents information about the interest payment settings.","properties":{"interestPaymentDates":{"type":"array","description":"The list of all dates when the interest is paid into the deposit account.","items":{"$ref":"#/$defs/MonthAndDay"}},"interestPaymentPoint":{"description":"The interest payment point, which specifies when the interest should be paid to the account.","enum":["FIRST_DAY_OF_MONTH","EVERY_WEEK","EVERY_OTHER_WEEK","EVERY_MONTH","EVERY_3_MONTHS","ON_FIXED_DATES","DAILY","ANNUALLY","BI_ANNUALLY","ON_ACCOUNT_MATURITY"]}},"additionalProperties":true},"MonthAndDay":{"type":"object","description":"Wrapper for month and day for instances where the year isn't needed","properties":{"day":{"type":"integer","description":"The day in the month"},"month":{"type":"integer","description":"The month of the year"}},"additionalProperties":true},"DepositAccountInterestRateSettings":{"type":"object","description":"Represents information about the interest rate settings for deposit accounts.","properties":{"encodedKey":{"type":"string","description":"The encoded key for the set of interest settings, which is auto-generated and unique."},"interestChargeFrequency":{"description":"The interest charge frequency, which shows how often interest is charged on loan or deposit accounts.","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestChargeFrequencyCount":{"type":"integer","description":"The number of times to apply interest in a time period."},"interestRate":{"type":"number","description":"The interest rate for the deposit account."},"interestRateReviewCount":{"type":"integer","description":"The number of times to review the interest rate in a time period."},"interestRateReviewUnit":{"description":"The time unit to use to determine the frequency of interest rate reviews.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"The interest calculation method used.","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"description":"The terms for how interest rate is determined when accruing for an account.","enum":["FIXED","TIERED","TIERED_PERIOD","TIERED_BAND"]},"interestRateTiers":{"type":"array","description":"The list of interest rate tiers, which hold the values to define how interest is calculated.","items":{"$ref":"#/$defs/DepositAccountInterestRateTier"}},"interestSpread":{"type":"number","description":"The index interest rate that is used to calculate the interest rate that is applied to accounts."}},"additionalProperties":true},"DepositAccountInterestRateTier":{"type":"object","description":"Represents information about how interest rate is calculated.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"endingDay":{"type":"integer","description":"The end date for the account period. Used to determine if this interest rate tier is used or not."},"interestRate":{"type":"number","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true},"DepositAccountInternalControls":{"type":"object","description":"Represents information about internal controls.","properties":{"maxDepositBalance":{"type":"number","description":"The maximum deposit balance of the account."},"maxWithdrawalAmount":{"type":"number","description":"The maximum amount allowed for a withdrawal."},"recommendedDepositAmount":{"type":"number","description":"The recommended amount for a deposit."},"targetAmount":{"type":"number","description":"The target amount for a deposit made towards a savings goal."}},"additionalProperties":true},"DepositAccountOverdraftInterestSettings":{"type":"object","description":"Represents information about a deposit account's overdraft interest settings.","properties":{"interestRateSettings":{"$ref":"#/$defs/DepositAccountOverdraftInterestRateSettings"}},"additionalProperties":true},"DepositAccountOverdraftInterestRateSettings":{"type":"object","description":"Represents information about overdraft interest rate settings for deposit accounts.","properties":{"encodedKey":{"type":"string","description":"The encoded key for the set of interest settings, which is auto-generated and unique."},"interestChargeFrequency":{"description":"The interest charge frequency, which shows how often interest is charged on loan or deposit accounts.","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestChargeFrequencyCount":{"type":"integer","description":"The number of times to apply interest in a time period."},"interestRate":{"type":"number","description":"The interest rate for the deposit account."},"interestRateReviewCount":{"type":"integer","description":"The number of times to review the interest rate in a time period."},"interestRateReviewUnit":{"description":"The time unit to use to determine the frequency of interest rate reviews.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"The interest calculation method used.","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"description":"The terms for how interest rate is determined when accruing for an account.","enum":["FIXED","TIERED","TIERED_PERIOD","TIERED_BAND"]},"interestRateTiers":{"type":"array","description":"The list of interest rate tiers, which hold the values to define how interest is calculated.","items":{"$ref":"#/$defs/DepositAccountInterestRateTier"}},"interestSpread":{"type":"number","description":"The index interest rate that is used to calculate the interest rate that is applied to accounts."}},"additionalProperties":true},"DepositAccountOverdraftSettings":{"type":"object","description":"Represents information about a deposit account's overdraft settings.","properties":{"allowOverdraft":{"type":"boolean","description":"`TRUE` if this account supports overdraft, `FALSE` otherwise."},"overdraftExpiryDate":{"type":"string","description":"The expiration date of an overdraft.","format":"date-time"},"overdraftLimit":{"type":"number","description":"The limit amount that may be taken out as overdraft, where null means 0."}},"additionalProperties":true},"LoanAccount":{"type":"object","description":"Represents a loan account. A loan account defines the amount that your organization lends to a client. The terms and conditions of a loan account are defined by a loan product. In a loan account, Mambu stores all the information related to disbursements, repayments, interest rates, and withdrawals.","properties":{"accountArrearsSettings":{"$ref":"#/$defs/AccountArrearsSettings"},"accountHolderKey":{"type":"string","description":"The encoded key of the account holder."},"accountHolderType":{"description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"description":"A second state for the loan account. Beside the account state, a second substate is sometimes necessary to provide more information about the exact lifecycle state of a loan account.For example, even if the account state of a loan account is `ACTIVE`, it can also have a substate of `LOCKED`.","enum":["PARTIALLY_DISBURSED","LOCKED","LOCKED_CAPPING","REFINANCED","RESCHEDULED","WITHDRAWN","REPAID","REJECTED","WRITTEN_OFF","TERMINATED"]},"accruedInterest":{"type":"number","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Asset"}},"assignedBranchKey":{"type":"string","description":"The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set."},"assignedCentreKey":{"type":"string","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user this loan account is assigned to."},"balances":{"$ref":"#/$defs/Balances"},"closedDate":{"type":"string","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the line of credit where this account is registered to."},"currency":{"$ref":"#/$defs/Currency"},"daysInArrears":{"type":"integer","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"$ref":"#/$defs/DisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFund"}},"futurePaymentsAcceptance":{"description":"Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account.","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"guarantors":{"type":"array","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantor"}},"id":{"type":"string","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","description":"The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled."},"interestFromArrearsAccrued":{"type":"number","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"$ref":"#/$defs/InterestSettings"},"lastAccountAppraisalDate":{"type":"string","description":"The date the loan account has last been evaluated for interest, principal, fees, and penalties calculations expressed in the organization time format and time zone.","format":"date-time"},"lastInterestAppliedDate":{"type":"string","description":"The date of the last time the loan account had interest applied (stored to interest balance), expressed in the organization time format and time zone.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","description":"The date when the loan account was set for the last time in the `LOCKED` state expressed in the organization time format and time zone. If null, the account is not locked anymore.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the loan account was set to last standing or null; if never set, it is expressed in your organization time format and time zone.","format":"date-time"},"lastTaxRateReviewDate":{"type":"string","description":"The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone.","format":"date-time"},"latePaymentsRecalculationMethod":{"description":"The overdue payments recalculation method inherited from the loan product on which this loan account is based.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"loanAmount":{"type":"number","description":"The loan amount."},"loanName":{"type":"string","description":"The name of the loan account."},"lockedAccountTotalDueType":{"description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","description":"A list with operations which are locked when the account is in the AccountState.LOCKED substate.","items":{"enum":["APPLY_INTEREST","APPLY_FEES","APPLY_PENALTIES"]}},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from."},"modifyInterestForFirstInstallment":{"type":"boolean","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"description":"The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account).","enum":["HORIZONTAL","VERTICAL"]},"penaltySettings":{"$ref":"#/$defs/PenaltySettings"},"plannedInstallmentFees":{"type":"array","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFee"}},"prepaymentSettings":{"$ref":"#/$defs/PrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentAccountSettings"},"productTypeKey":{"type":"string","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"$ref":"#/$defs/LoanAccountRedrawSettings"},"rescheduledAccountKey":{"type":"string","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"$ref":"#/$defs/ScheduleSettings"},"settlementAccountKey":{"type":"string","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","description":"The tax rate."},"terminationDate":{"type":"string","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTranche"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true},"AccountArrearsSettings":{"type":"object","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","description":"Defines the arrears tolerance period value."}},"additionalProperties":true},"Asset":{"type":"object","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"$ref":"#/$defs/Currency"}},"required":["amount","assetName"],"additionalProperties":true},"Currency":{"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true},"Balances":{"type":"object","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","description":"The interest from arrears balance. Indicates interest from arrears owned by the client, from now on. (total interest from arrears accrued for account - interest from arrears paid)."},"interestFromArrearsDue":{"type":"number","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true},"DisbursementDetails":{"type":"object","description":"The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees.","properties":{"disbursementDate":{"type":"string","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"firstRepaymentDate":{"type":"string","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"$ref":"#/$defs/LoanTransactionDetails"}},"additionalProperties":true},"CustomPredefinedFee":{"type":"object","description":"The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement.","properties":{"amount":{"type":"number","description":"The amount of the custom fee."},"encodedKey":{"type":"string","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","description":"The encoded key of the predefined fee"}},"additionalProperties":true},"LoanTransactionDetails":{"type":"object","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","description":"In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made."},"transactionChannelId":{"type":"string","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true},"InvestorFund":{"type":"object","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","description":"The constraint minimum value"},"sharePercentage":{"type":"number","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true},"Guarantor":{"type":"object","description":"Guarantor, holds information about a client guaranty entry. It can be defined based on another client which guarantees (including or not a savings account whether it is a client of the organization using Mambu or not) or based on a value the client holds (an asset)","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true},"InterestSettings":{"type":"object","description":"The interest settings, holds all the properties regarding interests for the loan account.","properties":{"accountInterestRateSettings":{"type":"array","description":"Adjustable interest rates settings for loan account","items":{"$ref":"#/$defs/AccountInterestRateSettings"}},"accrueInterestAfterMaturity":{"type":"boolean","description":"The accrue interest after maturity. If the product support this option, specify if the interest should be accrued after the account maturity date."},"accrueLateInterest":{"type":"boolean","description":"Indicates whether late interest is accrued for this loan account"},"interestApplicationDays":{"$ref":"#/$defs/DaysInMonth"},"interestApplicationMethod":{"description":"The interest application method. Represents the interest application method that determines whether the interest gets applied on the account's disbursement or on each repayment.","enum":["AFTER_DISBURSEMENT","REPAYMENT_DUE_DATE","FIXED_DAYS_OF_MONTH"]},"interestBalanceCalculationMethod":{"description":"The interest balance calculation method. Represents the option which determines the way the balance for the account's interest is computed.","enum":["ONLY_PRINCIPAL","PRINCIPAL_AND_INTEREST"]},"interestCalculationMethod":{"description":"The interest calculation method. Holds the type of interest calculation method.","enum":["FLAT","DECLINING_BALANCE","DECLINING_BALANCE_DISCOUNTED","EQUAL_INSTALLMENTS"]},"interestChargeFrequency":{"description":"The interest change frequency. Holds the possible values for how often is interest charged on loan or deposit accounts","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestRate":{"type":"number","description":"The interest rate. Represents the interest rate for the loan account. The interest on loans is accrued on a daily basis, which allows charging the clients only for the days they actually used the loan amount."},"interestRateReviewCount":{"type":"integer","description":"Interest rate update frequency unit count."},"interestRateReviewUnit":{"description":"The interest rate review unit. Defines the interest rate update frequency measurement unit.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"The interest rate source. Represents the interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestSpread":{"type":"number","description":"Interest to be added to active organization index interest rate in order to find out actual interest rate"},"interestType":{"description":"The possible values for how we compute and apply the interest","enum":["SIMPLE_INTEREST","CAPITALIZED_INTEREST","COMPOUNDING_INTEREST"]},"pmtAdjustmentThreshold":{"$ref":"#/$defs/PMTAdjustmentThreshold"}},"additionalProperties":true},"AccountInterestRateSettings":{"type":"object","description":"Adjustable interest rates settings for loan account","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate settings, auto generated, unique"},"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestRate":{"type":"number","description":"Interest rate value."},"interestRateCeilingValue":{"type":"number","description":"Maximum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateFloorValue":{"type":"number","description":"Minimum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count. Valid only for index interest rate."},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit. Valid only for index interest rate.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or indexed(interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestSpread":{"type":"number","description":"Interest spread value."},"validFrom":{"type":"string","description":"Date since an interest rate is valid","format":"date-time"}},"required":["interestRateSource","validFrom"],"additionalProperties":true},"DaysInMonth":{"type":"object","description":"Enumeration for days of month and method of handling shorter months.","properties":{"daysInMonth":{"type":"array","description":" Specifies the day(s) of the month when the interest application dates should be. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH. Currently only 1 value can be specified.","items":{"type":"integer"}},"shortMonthHandlingMethod":{"description":"Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents information about a deposit account.","properties":{"accountHolderKey":{"type":"string","description":"The encoded key of the account holder, which is an individual client or group."},"accountHolderType":{"description":"The account holder type.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the deposit account.","enum":["PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","MATURED","LOCKED","DORMANT","CLOSED","CLOSED_WRITTEN_OFF","WITHDRAWN","CLOSED_REJECTED"]},"accountType":{"description":"The deposit account type and the product that it belongs to.","enum":["CURRENT_ACCOUNT","REGULAR_SAVINGS","FIXED_DEPOSIT","SAVINGS_PLAN","INVESTOR_ACCOUNT"]},"accruedAmounts":{"$ref":"#/$defs/DepositAccountAccruedAmounts"},"activationDate":{"type":"string","description":"The date when the deposit account was activated, in the organization's timezone and time format.","format":"date-time"},"approvedDate":{"type":"string","description":"The date when the deposit account was approved, in the organization's timezone and time format.","format":"date-time"},"assignedBranchKey":{"type":"string","description":"The key of the branch that this deposit account is assigned to."},"assignedCentreKey":{"type":"string","description":"The key of the centre that this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user that this deposit is assigned to."},"balances":{"$ref":"#/$defs/DepositAccountBalances"},"closedDate":{"type":"string","description":"The date when the deposit account was closed, in UTC.","format":"date-time"},"creationDate":{"type":"string","description":"The date this deposit account was created, in UTC.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the credit arrangement where this account is registered."},"currencyCode":{"type":"string","description":"The currency code."},"encodedKey":{"type":"string","description":"The encoded key of the deposit account, which is auto-generated and unique."},"id":{"type":"string","description":"The ID of the deposit account, which can be generated and customized - but must be unique."},"interestSettings":{"$ref":"#/$defs/DepositAccountInterestSettings"},"internalControls":{"$ref":"#/$defs/DepositAccountInternalControls"},"lastAccountAppraisalDate":{"type":"string","description":"The date when the account was last evaluated for interest calculations and maturity, in the organization's timezone and time format.","format":"date-time"},"lastInterestCalculationDate":{"type":"string","description":"The date when interest was last calculated for the account, in the organization's timezone and time format.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date when regular interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastInterestStoredDate":{"type":"string","description":"The date when interest was last applied on the account, in the organization's timezone and time format.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last update date for the deposit account, in UTC.","format":"date-time"},"lastOverdraftInterestReviewDate":{"type":"string","description":"The date when the overdraft interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the deposit account was set to In Arrears, or null if the account is not In Arrears. The date is in the organization's timezone and time format.","format":"date-time"},"linkedSettlementAccountKeys":{"type":"array","description":"Lists all loan account keys on which the deposit account is used as the settlement account.","items":{"type":"string"}},"lockedDate":{"type":"string","description":"The date when the deposit account was locked, in the organization's timezone and time format.","format":"date-time"},"maturityDate":{"type":"string","description":"The date when the account matures, for fixed or compulsory savings plans, in the organization's timezone and time format.","format":"date-time"},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this deposit account. If this account was imported, you can track which migration event it came from."},"name":{"type":"string","description":"The deposit account name."},"notes":{"type":"string","description":"The notes or description attached to this object."},"overdraftInterestSettings":{"$ref":"#/$defs/DepositAccountOverdraftInterestSettings"},"overdraftSettings":{"$ref":"#/$defs/DepositAccountOverdraftSettings"},"productTypeKey":{"type":"string","description":"The key to the product type that this account is based on."},"withholdingTaxSourceKey":{"type":"string","description":"The tax source where the account withholding taxes will be updated."}},"required":["accountHolderKey","accountHolderType","name","productTypeKey"],"additionalProperties":true};const schema13 = {"type":"object","description":"Represents information about the accrued amounts of deposit accounts.","properties":{"interestAccrued":{"type":"number","description":"The amount of positive interest that has been accrued in the account."},"negativeInterestAccrued":{"type":"number","description":"The amount of negative interest that has been accrued in the account."},"overdraftInterestAccrued":{"type":"number","description":"The amount of overdraft interest that has been accrued in the account."},"technicalOverdraftInterestAccrued":{"type":"number","description":"The amount of technical overdraft interest that has been accrued in the account."}},"additionalProperties":true};const schema14 = {"type":"object","description":"Represents information about the balances of a deposit account.","properties":{"availableBalance":{"type":"number","description":"The current available balance for deposit transactions."},"blockedBalance":{"type":"number","description":"The sum of all the blocked amounts on an account."},"feesDue":{"type":"number","description":"The amount of fees due to be paid on this account."},"forwardAvailableBalance":{"type":"number","description":"The sum of all the authorization hold amounts that have `CRDT` as the `creditDebitIndicator` for an account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts that have `DBIT` as the `creditDebitIndicator` for an account."},"lockedBalance":{"type":"number","description":"The locked amount that is not available for withdrawal in the account. For more information, see [Deposit Account Overview Details](https://support.mambu.com/docs/deposit-account-overview-details)."},"overdraftAmount":{"type":"number","description":"The overdraft amount that has been taken out in the account. For more information, see [Overdraft Products](https://support.mambu.com/docs/en/overdraft-products)."},"overdraftInterestDue":{"type":"number","description":"The amount of interest due to be paid on an account as a result of an authorized overdraft."},"technicalOverdraftAmount":{"type":"number","description":"The technical overdraft amount that has been taken out in the account. For more information, see [Technical Overdraft](https://support.mambu.com/docs/en/overdraft-products#technical-overdraft)."},"technicalOverdraftInterestDue":{"type":"number","description":"The amount of interest due to be paid on an account as a result of a technical overdraft."},"totalBalance":{"type":"number","description":"The current balance of the account."}},"additionalProperties":true};const schema20 = {"type":"object","description":"Represents information about internal controls.","properties":{"maxDepositBalance":{"type":"number","description":"The maximum deposit balance of the account."},"maxWithdrawalAmount":{"type":"number","description":"The maximum amount allowed for a withdrawal."},"recommendedDepositAmount":{"type":"number","description":"The recommended amount for a deposit."},"targetAmount":{"type":"number","description":"The target amount for a deposit made towards a savings goal."}},"additionalProperties":true};const schema24 = {"type":"object","description":"Represents information about a deposit account's overdraft settings.","properties":{"allowOverdraft":{"type":"boolean","description":"`TRUE` if this account supports overdraft, `FALSE` otherwise."},"overdraftExpiryDate":{"type":"string","description":"The expiration date of an overdraft.","format":"date-time"},"overdraftLimit":{"type":"number","description":"The limit amount that may be taken out as overdraft, where null means 0."}},"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema15 = {"type":"object","description":"Represents information about the deposit account's interest settings.","properties":{"interestPaymentSettings":{"$ref":"#/$defs/DepositAccountInterestPaymentSettings"},"interestRateSettings":{"$ref":"#/$defs/DepositAccountInterestRateSettings"}},"additionalProperties":true};const schema16 = {"type":"object","description":"Represents information about the interest payment settings.","properties":{"interestPaymentDates":{"type":"array","description":"The list of all dates when the interest is paid into the deposit account.","items":{"$ref":"#/$defs/MonthAndDay"}},"interestPaymentPoint":{"description":"The interest payment point, which specifies when the interest should be paid to the account.","enum":["FIRST_DAY_OF_MONTH","EVERY_WEEK","EVERY_OTHER_WEEK","EVERY_MONTH","EVERY_3_MONTHS","ON_FIXED_DATES","DAILY","ANNUALLY","BI_ANNUALLY","ON_ACCOUNT_MATURITY"]}},"additionalProperties":true};const schema17 = {"type":"object","description":"Wrapper for month and day for instances where the year isn't needed","properties":{"day":{"type":"integer","description":"The day in the month"},"month":{"type":"integer","description":"The month of the year"}},"additionalProperties":true};function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.interestPaymentDates !== undefined){let data0 = data.interestPaymentDates;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema39 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate28(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema46 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema47 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema48 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate30(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate30.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate30.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate30.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate30.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate30.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate30.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents information about a deposit account.","properties":{"accountHolderKey":{"type":"string","description":"The encoded key of the account holder, which is an individual client or group."},"accountHolderType":{"description":"The account holder type.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the deposit account.","enum":["PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","MATURED","LOCKED","DORMANT","CLOSED","CLOSED_WRITTEN_OFF","WITHDRAWN","CLOSED_REJECTED"]},"accountType":{"description":"The deposit account type and the product that it belongs to.","enum":["CURRENT_ACCOUNT","REGULAR_SAVINGS","FIXED_DEPOSIT","SAVINGS_PLAN","INVESTOR_ACCOUNT"]},"accruedAmounts":{"$ref":"#/$defs/DepositAccountAccruedAmounts"},"activationDate":{"type":"string","description":"The date when the deposit account was activated, in the organization's timezone and time format.","format":"date-time"},"approvedDate":{"type":"string","description":"The date when the deposit account was approved, in the organization's timezone and time format.","format":"date-time"},"assignedBranchKey":{"type":"string","description":"The key of the branch that this deposit account is assigned to."},"assignedCentreKey":{"type":"string","description":"The key of the centre that this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user that this deposit is assigned to."},"balances":{"$ref":"#/$defs/DepositAccountBalances"},"closedDate":{"type":"string","description":"The date when the deposit account was closed, in UTC.","format":"date-time"},"creationDate":{"type":"string","description":"The date this deposit account was created, in UTC.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the credit arrangement where this account is registered."},"currencyCode":{"type":"string","description":"The currency code."},"encodedKey":{"type":"string","description":"The encoded key of the deposit account, which is auto-generated and unique."},"id":{"type":"string","description":"The ID of the deposit account, which can be generated and customized - but must be unique."},"interestSettings":{"$ref":"#/$defs/DepositAccountInterestSettings"},"internalControls":{"$ref":"#/$defs/DepositAccountInternalControls"},"lastAccountAppraisalDate":{"type":"string","description":"The date when the account was last evaluated for interest calculations and maturity, in the organization's timezone and time format.","format":"date-time"},"lastInterestCalculationDate":{"type":"string","description":"The date when interest was last calculated for the account, in the organization's timezone and time format.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date when regular interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastInterestStoredDate":{"type":"string","description":"The date when interest was last applied on the account, in the organization's timezone and time format.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last update date for the deposit account, in UTC.","format":"date-time"},"lastOverdraftInterestReviewDate":{"type":"string","description":"The date when the overdraft interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the deposit account was set to In Arrears, or null if the account is not In Arrears. The date is in the organization's timezone and time format.","format":"date-time"},"linkedSettlementAccountKeys":{"type":"array","description":"Lists all loan account keys on which the deposit account is used as the settlement account.","items":{"type":"string"}},"lockedDate":{"type":"string","description":"The date when the deposit account was locked, in the organization's timezone and time format.","format":"date-time"},"maturityDate":{"type":"string","description":"The date when the account matures, for fixed or compulsory savings plans, in the organization's timezone and time format.","format":"date-time"},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this deposit account. If this account was imported, you can track which migration event it came from."},"name":{"type":"string","description":"The deposit account name."},"notes":{"type":"string","description":"The notes or description attached to this object."},"overdraftInterestSettings":{"$ref":"#/$defs/DepositAccountOverdraftInterestSettings"},"overdraftSettings":{"$ref":"#/$defs/DepositAccountOverdraftSettings"},"ownershipHistory":{"type":"array","description":"The history of deposit account ownership","items":{"$ref":"#/$defs/DepositAccountOwnershipHistory"}},"productTypeKey":{"type":"string","description":"The key to the product type that this account is based on."},"withholdingTaxSourceKey":{"type":"string","description":"The tax source where the account withholding taxes will be updated."}},"required":["accountHolderKey","accountHolderType","name","productTypeKey"],"additionalProperties":true};const schema13 = {"type":"object","description":"Represents information about the accrued amounts of deposit accounts.","properties":{"interestAccrued":{"type":"number","description":"The amount of positive interest that has been accrued in the account."},"negativeInterestAccrued":{"type":"number","description":"The amount of negative interest that has been accrued in the account."},"overdraftInterestAccrued":{"type":"number","description":"The amount of overdraft interest that has been accrued in the account."},"technicalOverdraftInterestAccrued":{"type":"number","description":"The amount of technical overdraft interest that has been accrued in the account."}},"additionalProperties":true};const schema14 = {"type":"object","description":"Represents information about the balances of a deposit account.","properties":{"availableBalance":{"type":"number","description":"The current available balance for deposit transactions."},"blockedBalance":{"type":"number","description":"The sum of all the blocked amounts on an account."},"feesDue":{"type":"number","description":"The amount of fees due to be paid on this account."},"forwardAvailableBalance":{"type":"number","description":"The sum of all the authorization hold amounts that have `CRDT` as the `creditDebitIndicator` for an account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts that have `DBIT` as the `creditDebitIndicator` for an account."},"lockedBalance":{"type":"number","description":"The locked amount that is not available for withdrawal in the account. For more information, see [Deposit Account Overview Details](https://support.mambu.com/docs/deposit-account-overview-details)."},"overdraftAmount":{"type":"number","description":"The overdraft amount that has been taken out in the account. For more information, see [Overdraft Products](https://support.mambu.com/docs/en/overdraft-products)."},"overdraftInterestDue":{"type":"number","description":"The amount of interest due to be paid on an account as a result of an authorized overdraft."},"technicalOverdraftAmount":{"type":"number","description":"The technical overdraft amount that has been taken out in the account. For more information, see [Technical Overdraft](https://support.mambu.com/docs/en/overdraft-products#technical-overdraft)."},"technicalOverdraftInterestDue":{"type":"number","description":"The amount of interest due to be paid on an account as a result of a technical overdraft."},"totalBalance":{"type":"number","description":"The current balance of the account."}},"additionalProperties":true};const schema20 = {"type":"object","description":"Represents information about internal controls.","properties":{"maxDepositBalance":{"type":"number","description":"The maximum deposit balance of the account."},"maxWithdrawalAmount":{"type":"number","description":"The maximum amount allowed for a withdrawal."},"recommendedDepositAmount":{"type":"number","description":"The recommended amount for a deposit."},"targetAmount":{"type":"number","description":"The target amount for a deposit made towards a savings goal."}},"additionalProperties":true};const schema24 = {"type":"object","description":"Represents information about a deposit account's overdraft settings.","properties":{"allowOverdraft":{"type":"boolean","description":"`TRUE` if this account supports overdraft, `FALSE` otherwise."},"overdraftExpiryDate":{"type":"string","description":"The expiration date of an overdraft.","format":"date-time"},"overdraftLimit":{"type":"number","description":"The limit amount that may be taken out as overdraft, where null means 0."}},"additionalProperties":true};const schema25 = {"type":"object","description":"The history of deposit account ownership","properties":{"previousOwnerKey":{"type":"string","description":"They key of the previous account holder"},"transferDate":{"type":"string","description":"The transfer date of the account ownership","format":"date-time"}},"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema15 = {"type":"object","description":"Represents information about the deposit account's interest settings.","properties":{"interestPaymentSettings":{"$ref":"#/$defs/DepositAccountInterestPaymentSettings"},"interestRateSettings":{"$ref":"#/$defs/DepositAccountInterestRateSettings"}},"additionalProperties":true};const schema16 = {"type":"object","description":"Represents information about the interest payment settings.","properties":{"interestPaymentDates":{"type":"array","description":"The list of all dates when the interest is paid into the deposit account.","items":{"$ref":"#/$defs/MonthAndDay"}},"interestPaymentPoint":{"description":"The interest payment point, which specifies when the interest should be paid to the account.","enum":["FIRST_DAY_OF_MONTH","EVERY_WEEK","EVERY_OTHER_WEEK","EVERY_MONTH","EVERY_3_MONTHS","ON_FIXED_DATES","DAILY","ANNUALLY","BI_ANNUALLY","ON_ACCOUNT_MATURITY"]}},"additionalProperties":true};const schema17 = {"type":"object","description":"Wrapper for month and day for instances where the year isn't needed","properties":{"day":{"type":"integer","description":"The day in the month"},"month":{"type":"integer","description":"The month of the year"}},"additionalProperties":true};function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.interestPaymentDates !== undefined){let data0 = data.interestPaymentDates;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema40 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate28(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema47 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema48 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema49 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate30(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate30.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate30.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate30.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate30.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate30.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate30.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuCrons { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /crons/eod:run + * * Trigger hourly and end of day Processing */ public runHourlyAndEndOfDayCrons({ @@ -60,7 +64,7 @@ export class MambuCrons { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '500'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -68,7 +72,6 @@ export class MambuCrons { return this.awaitResponse( this.buildClient(auth).post('crons/eod:run', { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 202: TriggerHourlyAndEndOfDayProcessingResponse, @@ -77,50 +80,52 @@ export class MambuCrons { 403: ErrorResponse, 500: ErrorResponse, }, + 'json', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -128,8 +133,7 @@ export class MambuCrons { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -137,21 +141,21 @@ export class MambuCrons { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/currencies-configuration/rest.client.ts b/src/currencies-configuration/rest.client.ts index 4d9a216..65747cc 100644 --- a/src/currencies-configuration/rest.client.ts +++ b/src/currencies-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/currencies.yaml */ export class MambuCurrenciesConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuCurrenciesConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/currencies.yaml + * * Get currencies configuration */ public get({ @@ -58,7 +62,7 @@ export class MambuCurrenciesConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -67,7 +71,6 @@ export class MambuCurrenciesConfiguration { this.buildClient(auth).get('configuration/currencies.yaml', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -75,10 +78,13 @@ export class MambuCurrenciesConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/currencies.yaml + * * Update currencies configuration */ public update({ @@ -92,15 +98,13 @@ export class MambuCurrenciesConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/currencies.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/currencies.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -108,50 +112,52 @@ export class MambuCurrenciesConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -159,8 +165,7 @@ export class MambuCurrenciesConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -168,21 +173,21 @@ export class MambuCurrenciesConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/currencies/rest.client.ts b/src/currencies/rest.client.ts index 4e7b365..bb55b13 100644 --- a/src/currencies/rest.client.ts +++ b/src/currencies/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { CurrencyDetails, ErrorResponse, GetAllResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { CurrencyDetails, ErrorResponse, GetAllResponse } from './rest.type.js' * currencies */ export class MambuCurrencies { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuCurrencies { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /currencies + * * Create currency */ public create({ @@ -63,7 +67,7 @@ export class MambuCurrencies { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -75,9 +79,8 @@ export class MambuCurrencies { return this.awaitResponse( this.buildClient(auth).post('currencies', { - json: body, + json: _body.right as CurrencyDetails, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -86,10 +89,13 @@ export class MambuCurrencies { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /currencies/{currencyCode} + * * Delete currency by code */ public delete({ @@ -104,15 +110,13 @@ export class MambuCurrencies { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`currencies/${path.currencyCode}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`currencies/${path.currencyCode}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -120,10 +124,13 @@ export class MambuCurrencies { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /currencies/{currencyCode} + * * Get currency by code */ public get({ @@ -138,7 +145,7 @@ export class MambuCurrencies { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -147,7 +154,6 @@ export class MambuCurrencies { this.buildClient(auth).get(`currencies/${path.currencyCode}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: CurrencyDetails, @@ -155,10 +161,13 @@ export class MambuCurrencies { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /currencies + * * Get all currencies */ public getAll({ @@ -175,7 +184,7 @@ export class MambuCurrencies { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -184,7 +193,6 @@ export class MambuCurrencies { this.buildClient(auth).get('currencies', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -192,10 +200,13 @@ export class MambuCurrencies { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /currencies/{currencyCode} + * * Update currency by code */ public update({ @@ -212,7 +223,7 @@ export class MambuCurrencies { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -224,9 +235,8 @@ export class MambuCurrencies { return this.awaitResponse( this.buildClient(auth).put(`currencies/${path.currencyCode}`, { - json: body, + json: _body.right as CurrencyDetails, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: CurrencyDetails, @@ -235,6 +245,7 @@ export class MambuCurrencies { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -259,44 +270,45 @@ export class MambuCurrencies { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -304,8 +316,7 @@ export class MambuCurrencies { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -313,21 +324,21 @@ export class MambuCurrencies { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/custom-field-sets/rest.client.ts b/src/custom-field-sets/rest.client.ts index 554d01b..a7bd885 100644 --- a/src/custom-field-sets/rest.client.ts +++ b/src/custom-field-sets/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, GetAllBySetIdResponse, GetAllResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, GetAllBySetIdResponse, GetAllResponse } from './rest.typ * customfieldsets */ export class MambuCustomFieldSets { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuCustomFieldSets { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /customfieldsets + * * Get custom field sets */ public getAll({ @@ -70,7 +74,7 @@ export class MambuCustomFieldSets { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -79,7 +83,6 @@ export class MambuCustomFieldSets { this.buildClient(auth).get('customfieldsets', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -87,10 +90,13 @@ export class MambuCustomFieldSets { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /customfieldsets/{customFieldSetId}/customfields + * * Get custom field definitions by custom field set */ public getAllBySetId({ @@ -110,7 +116,7 @@ export class MambuCustomFieldSets { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -119,7 +125,6 @@ export class MambuCustomFieldSets { this.buildClient(auth).get(`customfieldsets/${path.customFieldSetId}/customfields`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllBySetIdResponse, @@ -128,50 +133,52 @@ export class MambuCustomFieldSets { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -179,8 +186,7 @@ export class MambuCustomFieldSets { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -188,21 +194,21 @@ export class MambuCustomFieldSets { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/custom-fields-configuration/rest.client.ts b/src/custom-fields-configuration/rest.client.ts index 018ff73..3afe697 100644 --- a/src/custom-fields-configuration/rest.client.ts +++ b/src/custom-fields-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/customfields */ export class MambuCustomFieldsConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuCustomFieldsConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/customfields.yaml + * * Get custom field definitions configuration */ public get({ @@ -55,23 +59,25 @@ export class MambuCustomFieldsConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/customfields.yaml', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * GET /configuration/customfields/template.yaml + * * Get custom field definitions configuration template */ public getTemplate({ @@ -81,22 +87,24 @@ export class MambuCustomFieldsConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/customfields/template.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/customfields.yaml + * * Update custom field definitions configuration */ public update({ @@ -112,7 +120,7 @@ export class MambuCustomFieldsConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -120,7 +128,6 @@ export class MambuCustomFieldsConfiguration { return this.awaitResponse( this.buildClient(auth).put('configuration/customfields.yaml', { headers: headers ?? {}, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -130,50 +137,52 @@ export class MambuCustomFieldsConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -181,8 +190,7 @@ export class MambuCustomFieldsConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -190,21 +198,21 @@ export class MambuCustomFieldsConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/custom-fields/rest.client.ts b/src/custom-fields/rest.client.ts index b3d94ae..fb0e452 100644 --- a/src/custom-fields/rest.client.ts +++ b/src/custom-fields/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { CustomFieldMeta, ErrorResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { CustomFieldMeta, ErrorResponse } from './rest.type.js' * customfields */ export class MambuCustomFields { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuCustomFields { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /customfields/{customfieldId} + * * Get custom field definition */ public getById({ @@ -62,7 +66,7 @@ export class MambuCustomFields { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -71,7 +75,6 @@ export class MambuCustomFields { this.buildClient(auth).get(`customfields/${path.customfieldId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: CustomFieldMeta, @@ -80,50 +83,52 @@ export class MambuCustomFields { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -131,8 +136,7 @@ export class MambuCustomFields { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -140,21 +144,21 @@ export class MambuCustomFields { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/data-import/rest.client.ts b/src/data-import/rest.client.ts index aeabd12..ef96714 100644 --- a/src/data-import/rest.client.ts +++ b/src/data-import/rest.client.ts @@ -7,16 +7,16 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' -import { DataImportAction, DataImportResponse, DataImportStatus, ErrorResponse } from './rest.type.js' +import { DataImportAction, DataImportRequest, DataImportResponse, DataImportStatus, ErrorResponse } from './rest.type.js' /** * data/import */ export class MambuDataImport { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuDataImport { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /data/import/events/{eventKey}:action + * * Allows you to approve or reject a data import event */ public action({ @@ -70,7 +74,7 @@ export class MambuDataImport { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -82,9 +86,8 @@ export class MambuDataImport { return this.awaitResponse( this.buildClient(auth).post(`data/import/events/${path.eventKey}:action`, { - json: body, + json: _body.right as DataImportAction, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -94,31 +97,49 @@ export class MambuDataImport { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /data/import + * * Allows you to import data */ public dataImport({ + body, auth = [['apiKey'], ['basic']], - }: { auth?: string[][] | string[] } = {}): Promise< + }: { body: DataImportRequest; auth?: string[][] | string[] }): Promise< | SuccessResponse<'202', DataImportResponse> | FailureResponse<'400', ErrorResponse, 'response:statuscode'> | FailureResponse<'401', ErrorResponse, 'response:statuscode'> | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { + const _body = this.validateRequestBody(DataImportRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } + + const _form = new FormData() + for (const [key, value] of Object.entries(_body.right as DataImportRequest)) { + if (value instanceof Blob || value instanceof File) { + _form.append(key, value) + } else if (value !== null && value !== undefined) { + _form.append(key, value as string) + } + } return this.awaitResponse( this.buildClient(auth).post('data/import', { + body: _form, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 202: DataImportResponse, @@ -126,10 +147,13 @@ export class MambuDataImport { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /data/import/{importKey} + * * Allows you to retrieve a data import response */ public getImport({ @@ -144,7 +168,7 @@ export class MambuDataImport { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -152,7 +176,6 @@ export class MambuDataImport { return this.awaitResponse( this.buildClient(auth).get(`data/import/${path.importKey}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: DataImportStatus, @@ -161,6 +184,7 @@ export class MambuDataImport { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -185,44 +209,45 @@ export class MambuDataImport { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -230,8 +255,7 @@ export class MambuDataImport { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -239,21 +263,21 @@ export class MambuDataImport { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/data-import/rest.type.ts b/src/data-import/rest.type.ts index b524503..2b8b42b 100644 --- a/src/data-import/rest.type.ts +++ b/src/data-import/rest.type.ts @@ -7,6 +7,7 @@ import type { DefinedError, ValidateFunction } from 'ajv' import { validate as DataImportActionValidator } from './schemas/data-import-action.schema.js' +import { validate as DataImportRequestValidator } from './schemas/data-import-request.schema.js' import { validate as DataImportResponseValidator } from './schemas/data-import-response.schema.js' import { validate as DataImportStatusValidator } from './schemas/data-import-status.schema.js' import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' @@ -71,6 +72,30 @@ export interface DataImportErrorColumn { name?: string | undefined } +export interface DataImportRequest { + /** + * The file to import + */ + file: string +} + +export const DataImportRequest = { + validate: DataImportRequestValidator as ValidateFunction, + get schema() { + return DataImportRequest.validate.schema + }, + get errors() { + return DataImportRequest.validate.errors ?? undefined + }, + is: (o: unknown): o is DataImportRequest => DataImportRequest.validate(o) === true, + parse: (o: unknown): { right: DataImportRequest } | { left: DefinedError[] } => { + if (DataImportRequest.is(o)) { + return { right: o } + } + return { left: (DataImportRequest.errors ?? []) as DefinedError[] } + }, +} as const + /** * Holds information about the response of the data import action */ diff --git a/src/data-import/schemas/data-import-request.schema.js b/src/data-import/schemas/data-import-request.schema.js new file mode 100644 index 0000000..8130fec --- /dev/null +++ b/src/data-import/schemas/data-import-request.schema.js @@ -0,0 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck +/** + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code + */ +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DataImportRequest","type":"object","properties":{"file":{"type":"string","description":"The file to import"}},"required":["file"],"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.file === undefined) && (missing0 = "file")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.file !== undefined){if(typeof data.file !== "string"){validate10.errors = [{instancePath:instancePath+"/file",schemaPath:"#/properties/file/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file diff --git a/src/database-backup/rest.client.ts b/src/database-backup/rest.client.ts index 0e4fc75..b05e81e 100644 --- a/src/database-backup/rest.client.ts +++ b/src/database-backup/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, TriggerDatabaseBackupRequest, TriggerDatabaseBackupResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, TriggerDatabaseBackupRequest, TriggerDatabaseBackupRespo * database/backup */ export class MambuDatabaseBackup { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuDatabaseBackup { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /database/backup/{databaseBackupVersion} + * * Download database backup */ public downloadBackup({ @@ -60,25 +64,26 @@ export class MambuDatabaseBackup { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).get(`database/backup/${path.databaseBackupVersion}`, { - responseType: 'text', - }), + this.buildClient(auth).get(`database/backup/${path.databaseBackupVersion}`, {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * POST /database/backup + * * Trigger database backup */ public triggerBackup({ @@ -95,7 +100,7 @@ export class MambuDatabaseBackup { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -107,9 +112,8 @@ export class MambuDatabaseBackup { return this.awaitResponse( this.buildClient(auth).post('database/backup', { - json: body, + json: _body.right as TriggerDatabaseBackupRequest, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -118,6 +122,7 @@ export class MambuDatabaseBackup { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } @@ -142,44 +147,45 @@ export class MambuDatabaseBackup { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -187,8 +193,7 @@ export class MambuDatabaseBackup { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -196,21 +201,21 @@ export class MambuDatabaseBackup { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/deposit-accounts/rest.client.ts b/src/deposit-accounts/rest.client.ts index 174e1ca..6f44299 100644 --- a/src/deposit-accounts/rest.client.ts +++ b/src/deposit-accounts/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { AccountAuthorizationHold, @@ -39,6 +39,7 @@ import { ReopenDepositAction, SearchResponse, StartMaturityAction, + TransferOwnershipAction, UndoMaturityAction, } from './rest.type.js' @@ -46,7 +47,7 @@ import { * deposits */ export class MambuDepositAccounts { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -61,22 +62,26 @@ export class MambuDepositAccounts { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /deposits/{depositAccountId}:applyInterest + * * Represents information to apply accrued interest. */ public applyInterest({ @@ -97,11 +102,12 @@ export class MambuDepositAccounts { | FailureResponse<'403', ErrorResponse, 'response:statuscode'> | FailureResponse<'404', ErrorResponse, 'response:statuscode'> | FailureResponse<'409', ErrorResponse, 'response:statuscode'> + | FailureResponse<'429', ErrorResponse, 'response:statuscode'> | FailureResponse | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< - Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + Exclude, '102' | '400' | '401' | '403' | '404' | '409' | '429'>, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -113,9 +119,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:applyInterest`, { - json: body, + json: _body.right as ApplyInterestInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -125,11 +130,15 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, + 429: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /deposits/{depositAccountId}:changeInterestRate + * * Change deposit account interest rate */ public changeInterestRate({ @@ -154,7 +163,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -166,9 +175,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:changeInterestRate`, { - json: body, + json: _body.right as ChangeInterestRateAction, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -179,10 +187,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /deposits/{depositAccountId}:changeState + * * Represents the information to post an action, such as approving a deposit account. */ public changeState({ @@ -207,7 +218,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -219,9 +230,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:changeState`, { - json: body, + json: _body.right as DepositAccountAction, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -232,10 +242,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/{depositAccountId}:changeWithholdingTax + * * Change deposit account withholding tax rate */ public changeWithholdingTax({ @@ -259,7 +272,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -271,9 +284,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:changeWithholdingTax`, { - json: body, + json: _body.right as ChangeWithholdingTaxAction, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -283,10 +295,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /deposits + * * Create deposit account */ public create({ @@ -304,7 +319,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -316,9 +331,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post('deposits', { - json: body, + json: _body.right as DepositAccount, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -328,10 +342,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/{depositAccountId}/authorizationholds + * * Create an authorization hold corresponding to a given account */ public createAuthorizationHold({ @@ -356,7 +373,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -368,9 +385,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/authorizationholds`, { - json: body, + json: _body.right as AccountAuthorizationHold, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -381,10 +397,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/{depositAccountId}/blocks + * * Create a block fund for the account */ public createBlockFund({ @@ -409,7 +428,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -421,9 +440,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/blocks`, { - json: body, + json: _body.right as BlockFund, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -434,10 +452,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/{depositAccountId}/cards + * * Represents the information needed to create and associate a new card to an account. */ public createCard({ @@ -462,7 +483,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -474,9 +495,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/cards`, { - json: body, + json: _body.right as Card, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -487,10 +507,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /deposits/{depositAccountId}/interest-availabilities + * * Create Interest Availability */ public createInterestAvailability({ @@ -514,7 +537,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -526,9 +549,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/interest-availabilities`, { - json: body, + json: _body.right as InterestAccountSettingsAvailability, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -538,10 +560,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /deposits/{depositAccountId} + * * Delete inactive deposit account */ public delete({ @@ -557,15 +582,13 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`deposits/${path.depositAccountId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`deposits/${path.depositAccountId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -574,10 +597,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * DELETE /deposits/{depositAccountId}/cards/{cardReferenceToken} + * * Represents the information needed to delete a card associated to an account using its reference token. */ public deleteCard({ @@ -592,15 +618,13 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`deposits/${path.depositAccountId}/cards/${path.cardReferenceToken}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`deposits/${path.depositAccountId}/cards/${path.cardReferenceToken}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -608,10 +632,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * DELETE /deposits/{depositAccountId}/interest-availabilities/{interestAvailabilityKey} + * * Delete Interest Availability */ public deleteInterestAvailability({ @@ -627,7 +654,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -635,9 +662,7 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).delete( `deposits/${path.depositAccountId}/interest-availabilities/${path.interestAvailabilityKey}`, - { - responseType: 'text', - }, + {}, ), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -647,10 +672,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /deposits + * * Get deposit accounts */ public getAll({ @@ -679,7 +707,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -688,7 +716,6 @@ export class MambuDepositAccounts { this.buildClient(auth).get('deposits', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -697,10 +724,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/authorizationholds + * * Get authorization holds related to a deposit account, ordered from newest to oldest by creation date */ public getAllAuthorizationHolds({ @@ -720,7 +750,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -729,7 +759,6 @@ export class MambuDepositAccounts { this.buildClient(auth).get(`deposits/${path.depositAccountId}/authorizationholds`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllAuthorizationHoldsResponse, @@ -738,10 +767,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/blocks + * * Get all block funds for a deposit account */ public getAllBlocks({ @@ -761,7 +793,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -770,7 +802,6 @@ export class MambuDepositAccounts { this.buildClient(auth).get(`deposits/${path.depositAccountId}/blocks`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllBlocksResponse, @@ -779,10 +810,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/cards + * * Get cards associated with an account */ public getAllCards({ @@ -797,7 +831,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -805,7 +839,6 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/cards`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllCardsResponse, @@ -814,10 +847,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/authorizationholds/{authorizationHoldExternalReferenceId} + * * Get account authorization hold */ public getAuthorizationHoldById({ @@ -835,7 +871,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -845,7 +881,6 @@ export class MambuDepositAccounts { `deposits/${path.depositAccountId}/authorizationholds/${path.authorizationHoldExternalReferenceId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }, ), { @@ -855,10 +890,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/{depositAccountId} + * * Get deposit account */ public getById({ @@ -874,7 +912,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -883,7 +921,6 @@ export class MambuDepositAccounts { this.buildClient(auth).get(`deposits/${path.depositAccountId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: DepositAccount, @@ -892,10 +929,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/templates/{templateId} + * * Get deposit account document */ public getDepositAccountDocument({ @@ -915,7 +955,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -924,7 +964,6 @@ export class MambuDepositAccounts { this.buildClient(auth).get(`deposits/${path.depositAccountId}/templates/${path.templateId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetDepositAccountDocumentResponse, @@ -933,10 +972,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/funding + * * Get all loan accounts funded by the deposit account with the given ID or encoded key */ public getFundedLoans({ @@ -951,7 +993,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -959,7 +1001,6 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/funding`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetFundedLoansResponse, @@ -968,10 +1009,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/interest-availabilities + * * Get Interest Availabilities */ public getInterestAvailabilitiesList({ @@ -991,7 +1035,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1000,7 +1044,6 @@ export class MambuDepositAccounts { this.buildClient(auth).get(`deposits/${path.depositAccountId}/interest-availabilities`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetInterestAvailabilitiesListResponse, @@ -1009,10 +1052,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/interest-availabilities/{interestAvailabilityKey} + * * Get Interest Availability */ public getInterestAvailabilityById({ @@ -1027,7 +1073,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1037,7 +1083,6 @@ export class MambuDepositAccounts { `deposits/${path.depositAccountId}/interest-availabilities/${path.interestAvailabilityKey}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }, ), { @@ -1047,10 +1092,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/templates/{templateId}/pdf + * * Download deposit account document PDF */ public getPdfDocument({ @@ -1070,7 +1118,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1078,7 +1126,6 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/templates/${path.templateId}/pdf`, { searchParams: query ?? {}, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -1087,10 +1134,13 @@ export class MambuDepositAccounts { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/funding/{loanAccountId}/schedule + * * Allows retrieval of the loan account schedule for a loan account with the given id or encodedKey and funded by the deposit account with the given id or encodedKey. */ public getScheduleForFundedAccount({ @@ -1105,7 +1155,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1113,7 +1163,6 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/funding/${path.loanAccountId}/schedule`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: LoanAccountSchedule, @@ -1122,10 +1171,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/withholdingtaxes + * * Get deposit account withholding tax history */ public getWithholdingTaxHistory({ @@ -1141,7 +1193,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1150,7 +1202,6 @@ export class MambuDepositAccounts { this.buildClient(auth).get(`deposits/${path.depositAccountId}/withholdingtaxes`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetWithholdingTaxHistoryResponse, @@ -1159,10 +1210,13 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/interest-availabilities:bulk + * * Create Interest Availabilities for a group of accounts */ public makeBulkInterestAccountSettingsAvailabilities({ @@ -1183,7 +1237,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1195,9 +1249,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post('deposits/interest-availabilities:bulk', { - json: body, + json: _body.right as BulkInterestAccountSettingsAvailabilityInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1206,10 +1259,13 @@ export class MambuDepositAccounts { 401: ErrorResponse, 403: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PATCH /deposits/{depositAccountId} + * * Partially update deposit account */ public patch({ @@ -1227,7 +1283,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1239,8 +1295,7 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).patch(`deposits/${path.depositAccountId}`, { - json: body, - responseType: 'text', + json: _body.right as PatchRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -1250,10 +1305,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PATCH /deposits/{depositAccountId}/blocks/{externalReferenceId} + * * Updates the amount of an existing blocked fund on a deposit account. If the new amount equals the seized amount the block fund will transition to a seized state. */ public patchBlockFund({ @@ -1275,7 +1333,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1287,8 +1345,7 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).patch(`deposits/${path.depositAccountId}/blocks/${path.externalReferenceId}`, { - json: body, - responseType: 'text', + json: _body.right as PatchBlockFundRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -1298,10 +1355,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /deposits/{depositAccountId}:reopen + * * Reopen a deposit account */ public reopen({ @@ -1326,7 +1386,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1338,9 +1398,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:reopen`, { - json: body, + json: _body.right as ReopenDepositAction, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1351,10 +1410,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /deposits/{depositAccountId}/authorizationholds/{authorizationHoldExternalReferenceId} + * * Reverse account authorization hold */ public reverseAuthorizationHold({ @@ -1373,7 +1435,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1381,9 +1443,7 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).delete( `deposits/${path.depositAccountId}/authorizationholds/${path.authorizationHoldExternalReferenceId}`, - { - responseType: 'text', - }, + {}, ), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -1393,10 +1453,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /deposits:search + * * Search deposit accounts */ public search({ @@ -1405,7 +1468,7 @@ export class MambuDepositAccounts { auth = [['apiKey'], ['basic']], }: { body: DepositAccountSearchCriteria - query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } + query?: { offset?: string; limit?: string; paginationDetails?: string; cursor?: string; detailsLevel?: string } auth?: string[][] | string[] }): Promise< | SuccessResponse<'200', SearchResponse> @@ -1416,7 +1479,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1428,10 +1491,9 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post('deposits:search', { - json: body, + json: _body.right as DepositAccountSearchCriteria, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: SearchResponse, @@ -1439,10 +1501,13 @@ export class MambuDepositAccounts { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/{depositAccountId}:startMaturity + * * Represents information to start the maturity period for the specified deposit account. */ public startMaturity({ @@ -1467,7 +1532,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1479,9 +1544,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:startMaturity`, { - json: body, + json: _body.right as StartMaturityAction, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1492,10 +1556,68 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/{depositAccountId}:transferOwnership + * + * Transfer the account ownership from current account holder to a new one (client/group). + */ + public transferOwnership({ + body, + path, + headers, + auth = [['apiKey'], ['basic']], + }: { + body: TransferOwnershipAction + path: { depositAccountId: string } + headers?: { 'Idempotency-Key'?: string } + auth?: string[][] | string[] + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse<'409', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, + unknown, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(TransferOwnershipAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } + + return this.awaitResponse( + this.buildClient(auth).post(`deposits/${path.depositAccountId}:transferOwnership`, { + json: _body.right as TransferOwnershipAction, + headers: headers ?? {}, + }), + { + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, + 400: ErrorResponse, + 401: ErrorResponse, + 403: ErrorResponse, + 404: ErrorResponse, + 409: ErrorResponse, + }, + 'text', + ) as ReturnType + } + + /** + * DELETE /deposits/{depositAccountId}/blocks/{externalReferenceId} + * * Unblock a previously blocked fund for a deposit account */ public unblockFund({ @@ -1511,15 +1633,13 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`deposits/${path.depositAccountId}/blocks/${path.externalReferenceId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`deposits/${path.depositAccountId}/blocks/${path.externalReferenceId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -1528,10 +1648,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /deposits/{depositAccountId}:undoMaturity + * * Represents the action to undo the maturity period for the specified deposit account. */ public undoMaturity({ @@ -1556,7 +1679,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1568,9 +1691,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:undoMaturity`, { - json: body, + json: _body.right as UndoMaturityAction, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1581,10 +1703,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PUT /deposits/{depositAccountId} + * * Update deposit account */ public update({ @@ -1602,7 +1727,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1614,9 +1739,8 @@ export class MambuDepositAccounts { return this.awaitResponse( this.buildClient(auth).put(`deposits/${path.depositAccountId}`, { - json: body, + json: _body.right as DepositAccount, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: DepositAccount, @@ -1626,10 +1750,13 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /deposits/{depositAccountId}/interest-availabilities/{interestAvailabilityKey} + * * Update Interest Availability */ public updateInterestAvailability({ @@ -1651,7 +1778,7 @@ export class MambuDepositAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1665,9 +1792,8 @@ export class MambuDepositAccounts { this.buildClient(auth).put( `deposits/${path.depositAccountId}/interest-availabilities/${path.interestAvailabilityKey}`, { - json: body, + json: _body.right as InterestAccountSettingsAvailabilityUpdate, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }, ), { @@ -1678,6 +1804,7 @@ export class MambuDepositAccounts { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } @@ -1702,44 +1829,45 @@ export class MambuDepositAccounts { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -1747,8 +1875,7 @@ export class MambuDepositAccounts { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -1756,21 +1883,21 @@ export class MambuDepositAccounts { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/deposit-accounts/rest.type.ts b/src/deposit-accounts/rest.type.ts index 102ae51..19a8466 100644 --- a/src/deposit-accounts/rest.type.ts +++ b/src/deposit-accounts/rest.type.ts @@ -34,6 +34,7 @@ import { validate as PatchRequestValidator } from './schemas/patch-request.schem import { validate as ReopenDepositActionValidator } from './schemas/reopen-deposit-action.schema.js' import { validate as SearchResponseValidator } from './schemas/search-response.schema.js' import { validate as StartMaturityActionValidator } from './schemas/start-maturity-action.schema.js' +import { validate as TransferOwnershipActionValidator } from './schemas/transfer-ownership-action.schema.js' import { validate as UndoMaturityActionValidator } from './schemas/undo-maturity-action.schema.js' /** @@ -314,6 +315,10 @@ export interface ApplyInterestInput { * The date up to which interest is to be posted */ interestApplicationDate: string + /** + * Whether the interest amount to apply should be the regular one or interest from arrears. If nothing specified it will be the regular one. + */ + isInterestFromArrears?: boolean | undefined /** * Whether the interest amount to apply should be the regular one or the one accrued during the Payment Holidays. If nothing specified it will be the regular one. */ @@ -1057,6 +1062,10 @@ export interface DepositAccount { notes?: string | undefined overdraftInterestSettings?: DepositAccountOverdraftInterestSettings | undefined overdraftSettings?: DepositAccountOverdraftSettings | undefined + /** + * The history of deposit account ownership + */ + ownershipHistory?: DepositAccountOwnershipHistory[] | undefined /** * The key to the product type that this account is based on. */ @@ -1538,6 +1547,20 @@ export interface DepositAccountOverdraftSettings { overdraftLimit?: number | undefined } +/** + * The history of deposit account ownership + */ +export interface DepositAccountOwnershipHistory { + /** + * They key of the previous account holder + */ + previousOwnerKey?: string | undefined + /** + * The transfer date of the account ownership + */ + transferDate?: string | undefined +} + /** * Represents the filtering criteria list and the sorting criteria for searching deposit accounts. */ @@ -2181,6 +2204,10 @@ export interface InterestSettings { * Indicates whether late interest is accrued for this loan account */ accrueLateInterest?: boolean | undefined + /** + * The effective interest rate. Represents the interest rate for the loan accounts with semi-annually compounding product. + */ + effectiveInterestRate?: number | undefined interestApplicationDays?: DaysInMonth | undefined /** * The interest application method. Represents the interest application method that determines whether the interest gets applied on the account's disbursement or on each repayment. @@ -3026,6 +3053,33 @@ export interface TrancheDisbursementDetails { expectedDisbursementDate?: string | undefined } +/** + * Transfer the account ownership from current account holder to a new one (client/group). + */ +export interface TransferOwnershipAction { + /** + * The ID or encoded key of the new account holder. + */ + targetHolderKey: string +} + +export const TransferOwnershipAction = { + validate: TransferOwnershipActionValidator as ValidateFunction, + get schema() { + return TransferOwnershipAction.validate.schema + }, + get errors() { + return TransferOwnershipAction.validate.errors ?? undefined + }, + is: (o: unknown): o is TransferOwnershipAction => TransferOwnershipAction.validate(o) === true, + parse: (o: unknown): { right: TransferOwnershipAction } | { left: DefinedError[] } => { + if (TransferOwnershipAction.is(o)) { + return { right: o } + } + return { left: (TransferOwnershipAction.errors ?? []) as DefinedError[] } + }, +} as const + /** * The action to undo the maturity period for a deposit account */ diff --git a/src/deposit-accounts/schemas/apply-interest-input.schema.js b/src/deposit-accounts/schemas/apply-interest-input.schema.js index 1efa2d8..f80ad72 100644 --- a/src/deposit-accounts/schemas/apply-interest-input.schema.js +++ b/src/deposit-accounts/schemas/apply-interest-input.schema.js @@ -5,4 +5,4 @@ */ "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApplyInterestInput","type":"object","description":"Represents a request for applying the accrued interest ","properties":{"interestApplicationDate":{"type":"string","description":"The date up to which interest is to be posted","format":"date-time"},"isPaymentHolidaysInterest":{"type":"boolean","description":"Whether the interest amount to apply should be the regular one or the one accrued during the Payment Holidays. If nothing specified it will be the regular one."},"notes":{"type":"string","description":"Additional information for this action"},"paymentHolidaysInterestAmount":{"type":"number","description":"The amount of the Payment Holidays interest to apply"}},"required":["interestApplicationDate"],"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.interestApplicationDate === undefined) && (missing0 = "interestApplicationDate")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.interestApplicationDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.interestApplicationDate === "string")){validate10.errors = [{instancePath:instancePath+"/interestApplicationDate",schemaPath:"#/properties/interestApplicationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.isPaymentHolidaysInterest !== undefined){const _errs4 = errors;if(typeof data.isPaymentHolidaysInterest !== "boolean"){validate10.errors = [{instancePath:instancePath+"/isPaymentHolidaysInterest",schemaPath:"#/properties/isPaymentHolidaysInterest/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs6 = errors;if(typeof data.notes !== "string"){validate10.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentHolidaysInterestAmount !== undefined){let data3 = data.paymentHolidaysInterestAmount;const _errs8 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate10.errors = [{instancePath:instancePath+"/paymentHolidaysInterestAmount",schemaPath:"#/properties/paymentHolidaysInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}}}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApplyInterestInput","type":"object","description":"Represents a request for applying the accrued interest ","properties":{"interestApplicationDate":{"type":"string","description":"The date up to which interest is to be posted","format":"date-time"},"isInterestFromArrears":{"type":"boolean","description":"Whether the interest amount to apply should be the regular one or interest from arrears. If nothing specified it will be the regular one."},"isPaymentHolidaysInterest":{"type":"boolean","description":"Whether the interest amount to apply should be the regular one or the one accrued during the Payment Holidays. If nothing specified it will be the regular one."},"notes":{"type":"string","description":"Additional information for this action"},"paymentHolidaysInterestAmount":{"type":"number","description":"The amount of the Payment Holidays interest to apply"}},"required":["interestApplicationDate"],"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.interestApplicationDate === undefined) && (missing0 = "interestApplicationDate")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.interestApplicationDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.interestApplicationDate === "string")){validate10.errors = [{instancePath:instancePath+"/interestApplicationDate",schemaPath:"#/properties/interestApplicationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.isInterestFromArrears !== undefined){const _errs4 = errors;if(typeof data.isInterestFromArrears !== "boolean"){validate10.errors = [{instancePath:instancePath+"/isInterestFromArrears",schemaPath:"#/properties/isInterestFromArrears/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.isPaymentHolidaysInterest !== undefined){const _errs6 = errors;if(typeof data.isPaymentHolidaysInterest !== "boolean"){validate10.errors = [{instancePath:instancePath+"/isPaymentHolidaysInterest",schemaPath:"#/properties/isPaymentHolidaysInterest/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs8 = errors;if(typeof data.notes !== "string"){validate10.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentHolidaysInterestAmount !== undefined){let data4 = data.paymentHolidaysInterestAmount;const _errs10 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/paymentHolidaysInterestAmount",schemaPath:"#/properties/paymentHolidaysInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}}}}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file diff --git a/src/deposit-accounts/schemas/deposit-account.schema.js b/src/deposit-accounts/schemas/deposit-account.schema.js index e6c83db..f0d3907 100644 --- a/src/deposit-accounts/schemas/deposit-account.schema.js +++ b/src/deposit-accounts/schemas/deposit-account.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DepositAccount","type":"object","description":"Represents information about a deposit account.","properties":{"accountHolderKey":{"type":"string","description":"The encoded key of the account holder, which is an individual client or group."},"accountHolderType":{"description":"The account holder type.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the deposit account.","enum":["PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","MATURED","LOCKED","DORMANT","CLOSED","CLOSED_WRITTEN_OFF","WITHDRAWN","CLOSED_REJECTED"]},"accountType":{"description":"The deposit account type and the product that it belongs to.","enum":["CURRENT_ACCOUNT","REGULAR_SAVINGS","FIXED_DEPOSIT","SAVINGS_PLAN","INVESTOR_ACCOUNT"]},"accruedAmounts":{"$ref":"#/$defs/DepositAccountAccruedAmounts"},"activationDate":{"type":"string","description":"The date when the deposit account was activated, in the organization's timezone and time format.","format":"date-time"},"approvedDate":{"type":"string","description":"The date when the deposit account was approved, in the organization's timezone and time format.","format":"date-time"},"assignedBranchKey":{"type":"string","description":"The key of the branch that this deposit account is assigned to."},"assignedCentreKey":{"type":"string","description":"The key of the centre that this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user that this deposit is assigned to."},"balances":{"$ref":"#/$defs/DepositAccountBalances"},"closedDate":{"type":"string","description":"The date when the deposit account was closed, in UTC.","format":"date-time"},"creationDate":{"type":"string","description":"The date this deposit account was created, in UTC.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the credit arrangement where this account is registered."},"currencyCode":{"type":"string","description":"The currency code."},"encodedKey":{"type":"string","description":"The encoded key of the deposit account, which is auto-generated and unique."},"id":{"type":"string","description":"The ID of the deposit account, which can be generated and customized - but must be unique."},"interestSettings":{"$ref":"#/$defs/DepositAccountInterestSettings"},"internalControls":{"$ref":"#/$defs/DepositAccountInternalControls"},"lastAccountAppraisalDate":{"type":"string","description":"The date when the account was last evaluated for interest calculations and maturity, in the organization's timezone and time format.","format":"date-time"},"lastInterestCalculationDate":{"type":"string","description":"The date when interest was last calculated for the account, in the organization's timezone and time format.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date when regular interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastInterestStoredDate":{"type":"string","description":"The date when interest was last applied on the account, in the organization's timezone and time format.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last update date for the deposit account, in UTC.","format":"date-time"},"lastOverdraftInterestReviewDate":{"type":"string","description":"The date when the overdraft interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the deposit account was set to In Arrears, or null if the account is not In Arrears. The date is in the organization's timezone and time format.","format":"date-time"},"linkedSettlementAccountKeys":{"type":"array","description":"Lists all loan account keys on which the deposit account is used as the settlement account.","items":{"type":"string"}},"lockedDate":{"type":"string","description":"The date when the deposit account was locked, in the organization's timezone and time format.","format":"date-time"},"maturityDate":{"type":"string","description":"The date when the account matures, for fixed or compulsory savings plans, in the organization's timezone and time format.","format":"date-time"},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this deposit account. If this account was imported, you can track which migration event it came from."},"name":{"type":"string","description":"The deposit account name."},"notes":{"type":"string","description":"The notes or description attached to this object."},"overdraftInterestSettings":{"$ref":"#/$defs/DepositAccountOverdraftInterestSettings"},"overdraftSettings":{"$ref":"#/$defs/DepositAccountOverdraftSettings"},"productTypeKey":{"type":"string","description":"The key to the product type that this account is based on."},"withholdingTaxSourceKey":{"type":"string","description":"The tax source where the account withholding taxes will be updated."}},"required":["accountHolderKey","accountHolderType","name","productTypeKey"],"additionalProperties":true,"$defs":{"DepositAccountAccruedAmounts":{"type":"object","description":"Represents information about the accrued amounts of deposit accounts.","properties":{"interestAccrued":{"type":"number","description":"The amount of positive interest that has been accrued in the account."},"negativeInterestAccrued":{"type":"number","description":"The amount of negative interest that has been accrued in the account."},"overdraftInterestAccrued":{"type":"number","description":"The amount of overdraft interest that has been accrued in the account."},"technicalOverdraftInterestAccrued":{"type":"number","description":"The amount of technical overdraft interest that has been accrued in the account."}},"additionalProperties":true},"DepositAccountBalances":{"type":"object","description":"Represents information about the balances of a deposit account.","properties":{"availableBalance":{"type":"number","description":"The current available balance for deposit transactions."},"blockedBalance":{"type":"number","description":"The sum of all the blocked amounts on an account."},"feesDue":{"type":"number","description":"The amount of fees due to be paid on this account."},"forwardAvailableBalance":{"type":"number","description":"The sum of all the authorization hold amounts that have `CRDT` as the `creditDebitIndicator` for an account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts that have `DBIT` as the `creditDebitIndicator` for an account."},"lockedBalance":{"type":"number","description":"The locked amount that is not available for withdrawal in the account. For more information, see [Deposit Account Overview Details](https://support.mambu.com/docs/deposit-account-overview-details)."},"overdraftAmount":{"type":"number","description":"The overdraft amount that has been taken out in the account. For more information, see [Overdraft Products](https://support.mambu.com/docs/en/overdraft-products)."},"overdraftInterestDue":{"type":"number","description":"The amount of interest due to be paid on an account as a result of an authorized overdraft."},"technicalOverdraftAmount":{"type":"number","description":"The technical overdraft amount that has been taken out in the account. For more information, see [Technical Overdraft](https://support.mambu.com/docs/en/overdraft-products#technical-overdraft)."},"technicalOverdraftInterestDue":{"type":"number","description":"The amount of interest due to be paid on an account as a result of a technical overdraft."},"totalBalance":{"type":"number","description":"The current balance of the account."}},"additionalProperties":true},"DepositAccountInterestSettings":{"type":"object","description":"Represents information about the deposit account's interest settings.","properties":{"interestPaymentSettings":{"$ref":"#/$defs/DepositAccountInterestPaymentSettings"},"interestRateSettings":{"$ref":"#/$defs/DepositAccountInterestRateSettings"}},"additionalProperties":true},"DepositAccountInterestPaymentSettings":{"type":"object","description":"Represents information about the interest payment settings.","properties":{"interestPaymentDates":{"type":"array","description":"The list of all dates when the interest is paid into the deposit account.","items":{"$ref":"#/$defs/MonthAndDay"}},"interestPaymentPoint":{"description":"The interest payment point, which specifies when the interest should be paid to the account.","enum":["FIRST_DAY_OF_MONTH","EVERY_WEEK","EVERY_OTHER_WEEK","EVERY_MONTH","EVERY_3_MONTHS","ON_FIXED_DATES","DAILY","ANNUALLY","BI_ANNUALLY","ON_ACCOUNT_MATURITY"]}},"additionalProperties":true},"MonthAndDay":{"type":"object","description":"Wrapper for month and day for instances where the year isn't needed","properties":{"day":{"type":"integer","description":"The day in the month"},"month":{"type":"integer","description":"The month of the year"}},"additionalProperties":true},"DepositAccountInterestRateSettings":{"type":"object","description":"Represents information about the interest rate settings for deposit accounts.","properties":{"encodedKey":{"type":"string","description":"The encoded key for the set of interest settings, which is auto-generated and unique."},"interestChargeFrequency":{"description":"The interest charge frequency, which shows how often interest is charged on loan or deposit accounts.","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestChargeFrequencyCount":{"type":"integer","description":"The number of times to apply interest in a time period."},"interestRate":{"type":"number","description":"The interest rate for the deposit account."},"interestRateReviewCount":{"type":"integer","description":"The number of times to review the interest rate in a time period."},"interestRateReviewUnit":{"description":"The time unit to use to determine the frequency of interest rate reviews.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"The interest calculation method used.","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"description":"The terms for how interest rate is determined when accruing for an account.","enum":["FIXED","TIERED","TIERED_PERIOD","TIERED_BAND"]},"interestRateTiers":{"type":"array","description":"The list of interest rate tiers, which hold the values to define how interest is calculated.","items":{"$ref":"#/$defs/DepositAccountInterestRateTier"}},"interestSpread":{"type":"number","description":"The index interest rate that is used to calculate the interest rate that is applied to accounts."}},"additionalProperties":true},"DepositAccountInterestRateTier":{"type":"object","description":"Represents information about how interest rate is calculated.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"endingDay":{"type":"integer","description":"The end date for the account period. Used to determine if this interest rate tier is used or not."},"interestRate":{"type":"number","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true},"DepositAccountInternalControls":{"type":"object","description":"Represents information about internal controls.","properties":{"maxDepositBalance":{"type":"number","description":"The maximum deposit balance of the account."},"maxWithdrawalAmount":{"type":"number","description":"The maximum amount allowed for a withdrawal."},"recommendedDepositAmount":{"type":"number","description":"The recommended amount for a deposit."},"targetAmount":{"type":"number","description":"The target amount for a deposit made towards a savings goal."}},"additionalProperties":true},"DepositAccountOverdraftInterestSettings":{"type":"object","description":"Represents information about a deposit account's overdraft interest settings.","properties":{"interestRateSettings":{"$ref":"#/$defs/DepositAccountOverdraftInterestRateSettings"}},"additionalProperties":true},"DepositAccountOverdraftInterestRateSettings":{"type":"object","description":"Represents information about overdraft interest rate settings for deposit accounts.","properties":{"encodedKey":{"type":"string","description":"The encoded key for the set of interest settings, which is auto-generated and unique."},"interestChargeFrequency":{"description":"The interest charge frequency, which shows how often interest is charged on loan or deposit accounts.","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestChargeFrequencyCount":{"type":"integer","description":"The number of times to apply interest in a time period."},"interestRate":{"type":"number","description":"The interest rate for the deposit account."},"interestRateReviewCount":{"type":"integer","description":"The number of times to review the interest rate in a time period."},"interestRateReviewUnit":{"description":"The time unit to use to determine the frequency of interest rate reviews.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"The interest calculation method used.","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"description":"The terms for how interest rate is determined when accruing for an account.","enum":["FIXED","TIERED","TIERED_PERIOD","TIERED_BAND"]},"interestRateTiers":{"type":"array","description":"The list of interest rate tiers, which hold the values to define how interest is calculated.","items":{"$ref":"#/$defs/DepositAccountInterestRateTier"}},"interestSpread":{"type":"number","description":"The index interest rate that is used to calculate the interest rate that is applied to accounts."}},"additionalProperties":true},"DepositAccountOverdraftSettings":{"type":"object","description":"Represents information about a deposit account's overdraft settings.","properties":{"allowOverdraft":{"type":"boolean","description":"`TRUE` if this account supports overdraft, `FALSE` otherwise."},"overdraftExpiryDate":{"type":"string","description":"The expiration date of an overdraft.","format":"date-time"},"overdraftLimit":{"type":"number","description":"The limit amount that may be taken out as overdraft, where null means 0."}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents information about the accrued amounts of deposit accounts.","properties":{"interestAccrued":{"type":"number","description":"The amount of positive interest that has been accrued in the account."},"negativeInterestAccrued":{"type":"number","description":"The amount of negative interest that has been accrued in the account."},"overdraftInterestAccrued":{"type":"number","description":"The amount of overdraft interest that has been accrued in the account."},"technicalOverdraftInterestAccrued":{"type":"number","description":"The amount of technical overdraft interest that has been accrued in the account."}},"additionalProperties":true};const schema13 = {"type":"object","description":"Represents information about the balances of a deposit account.","properties":{"availableBalance":{"type":"number","description":"The current available balance for deposit transactions."},"blockedBalance":{"type":"number","description":"The sum of all the blocked amounts on an account."},"feesDue":{"type":"number","description":"The amount of fees due to be paid on this account."},"forwardAvailableBalance":{"type":"number","description":"The sum of all the authorization hold amounts that have `CRDT` as the `creditDebitIndicator` for an account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts that have `DBIT` as the `creditDebitIndicator` for an account."},"lockedBalance":{"type":"number","description":"The locked amount that is not available for withdrawal in the account. For more information, see [Deposit Account Overview Details](https://support.mambu.com/docs/deposit-account-overview-details)."},"overdraftAmount":{"type":"number","description":"The overdraft amount that has been taken out in the account. For more information, see [Overdraft Products](https://support.mambu.com/docs/en/overdraft-products)."},"overdraftInterestDue":{"type":"number","description":"The amount of interest due to be paid on an account as a result of an authorized overdraft."},"technicalOverdraftAmount":{"type":"number","description":"The technical overdraft amount that has been taken out in the account. For more information, see [Technical Overdraft](https://support.mambu.com/docs/en/overdraft-products#technical-overdraft)."},"technicalOverdraftInterestDue":{"type":"number","description":"The amount of interest due to be paid on an account as a result of a technical overdraft."},"totalBalance":{"type":"number","description":"The current balance of the account."}},"additionalProperties":true};const schema19 = {"type":"object","description":"Represents information about internal controls.","properties":{"maxDepositBalance":{"type":"number","description":"The maximum deposit balance of the account."},"maxWithdrawalAmount":{"type":"number","description":"The maximum amount allowed for a withdrawal."},"recommendedDepositAmount":{"type":"number","description":"The recommended amount for a deposit."},"targetAmount":{"type":"number","description":"The target amount for a deposit made towards a savings goal."}},"additionalProperties":true};const schema23 = {"type":"object","description":"Represents information about a deposit account's overdraft settings.","properties":{"allowOverdraft":{"type":"boolean","description":"`TRUE` if this account supports overdraft, `FALSE` otherwise."},"overdraftExpiryDate":{"type":"string","description":"The expiration date of an overdraft.","format":"date-time"},"overdraftLimit":{"type":"number","description":"The limit amount that may be taken out as overdraft, where null means 0."}},"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema14 = {"type":"object","description":"Represents information about the deposit account's interest settings.","properties":{"interestPaymentSettings":{"$ref":"#/$defs/DepositAccountInterestPaymentSettings"},"interestRateSettings":{"$ref":"#/$defs/DepositAccountInterestRateSettings"}},"additionalProperties":true};const schema15 = {"type":"object","description":"Represents information about the interest payment settings.","properties":{"interestPaymentDates":{"type":"array","description":"The list of all dates when the interest is paid into the deposit account.","items":{"$ref":"#/$defs/MonthAndDay"}},"interestPaymentPoint":{"description":"The interest payment point, which specifies when the interest should be paid to the account.","enum":["FIRST_DAY_OF_MONTH","EVERY_WEEK","EVERY_OTHER_WEEK","EVERY_MONTH","EVERY_3_MONTHS","ON_FIXED_DATES","DAILY","ANNUALLY","BI_ANNUALLY","ON_ACCOUNT_MATURITY"]}},"additionalProperties":true};const schema16 = {"type":"object","description":"Wrapper for month and day for instances where the year isn't needed","properties":{"day":{"type":"integer","description":"The day in the month"},"month":{"type":"integer","description":"The month of the year"}},"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.interestPaymentDates !== undefined){let data0 = data.interestPaymentDates;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a loan account. A loan account defines the amount that your organization lends to a client. The terms and conditions of a loan account are defined by a loan product. In a loan account, Mambu stores all the information related to disbursements, repayments, interest rates, and withdrawals.","properties":{"accountArrearsSettings":{"$ref":"#/$defs/AccountArrearsSettings"},"accountHolderKey":{"type":"string","description":"The encoded key of the account holder."},"accountHolderType":{"description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"description":"A second state for the loan account. Beside the account state, a second substate is sometimes necessary to provide more information about the exact lifecycle state of a loan account.For example, even if the account state of a loan account is `ACTIVE`, it can also have a substate of `LOCKED`.","enum":["PARTIALLY_DISBURSED","LOCKED","LOCKED_CAPPING","REFINANCED","RESCHEDULED","WITHDRAWN","REPAID","REJECTED","WRITTEN_OFF","TERMINATED"]},"accruedInterest":{"type":"number","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Asset"}},"assignedBranchKey":{"type":"string","description":"The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set."},"assignedCentreKey":{"type":"string","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user this loan account is assigned to."},"balances":{"$ref":"#/$defs/Balances"},"closedDate":{"type":"string","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the line of credit where this account is registered to."},"currency":{"$ref":"#/$defs/Currency"},"daysInArrears":{"type":"integer","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"$ref":"#/$defs/DisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFund"}},"futurePaymentsAcceptance":{"description":"Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account.","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"guarantors":{"type":"array","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantor"}},"id":{"type":"string","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","description":"The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled."},"interestFromArrearsAccrued":{"type":"number","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"$ref":"#/$defs/InterestSettings"},"lastAccountAppraisalDate":{"type":"string","description":"The date the loan account has last been evaluated for interest, principal, fees, and penalties calculations expressed in the organization time format and time zone.","format":"date-time"},"lastInterestAppliedDate":{"type":"string","description":"The date of the last time the loan account had interest applied (stored to interest balance), expressed in the organization time format and time zone.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","description":"The date when the loan account was set for the last time in the `LOCKED` state expressed in the organization time format and time zone. If null, the account is not locked anymore.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the loan account was set to last standing or null; if never set, it is expressed in your organization time format and time zone.","format":"date-time"},"lastTaxRateReviewDate":{"type":"string","description":"The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone.","format":"date-time"},"latePaymentsRecalculationMethod":{"description":"The overdue payments recalculation method inherited from the loan product on which this loan account is based.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"loanAmount":{"type":"number","description":"The loan amount."},"loanName":{"type":"string","description":"The name of the loan account."},"lockedAccountTotalDueType":{"description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","description":"A list with operations which are locked when the account is in the AccountState.LOCKED substate.","items":{"enum":["APPLY_INTEREST","APPLY_FEES","APPLY_PENALTIES"]}},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from."},"modifyInterestForFirstInstallment":{"type":"boolean","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"description":"The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account).","enum":["HORIZONTAL","VERTICAL"]},"penaltySettings":{"$ref":"#/$defs/PenaltySettings"},"plannedInstallmentFees":{"type":"array","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFee"}},"prepaymentSettings":{"$ref":"#/$defs/PrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentAccountSettings"},"productTypeKey":{"type":"string","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"$ref":"#/$defs/LoanAccountRedrawSettings"},"rescheduledAccountKey":{"type":"string","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"$ref":"#/$defs/ScheduleSettings"},"settlementAccountKey":{"type":"string","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","description":"The tax rate."},"terminationDate":{"type":"string","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTranche"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","description":"The interest from arrears balance. Indicates interest from arrears owned by the client, from now on. (total interest from arrears accrued for account - interest from arrears paid)."},"interestFromArrearsDue":{"type":"number","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","description":"The constraint minimum value"},"sharePercentage":{"type":"number","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","description":"Guarantor, holds information about a client guaranty entry. It can be defined based on another client which guarantees (including or not a savings account whether it is a client of the organization using Mambu or not) or based on a value the client holds (an asset)","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true};const schema30 = {"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true};const schema31 = {"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema14 = {"type":"object","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"$ref":"#/$defs/Currency"}},"required":["amount","assetName"],"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.amount === undefined) && (missing0 = "amount")) || ((data.assetName === undefined) && (missing0 = "assetName"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.assetName !== undefined){const _errs4 = errors;if(typeof data.assetName !== "string"){validate12.errors = [{instancePath:instancePath+"/assetName",schemaPath:"#/properties/assetName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.depositAccountKey !== undefined){const _errs6 = errors;if(typeof data.depositAccountKey !== "string"){validate12.errors = [{instancePath:instancePath+"/depositAccountKey",schemaPath:"#/properties/depositAccountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = errors;if(typeof data.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorKey !== undefined){const _errs10 = errors;if(typeof data.guarantorKey !== "string"){validate12.errors = [{instancePath:instancePath+"/guarantorKey",schemaPath:"#/properties/guarantorKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorType !== undefined){let data5 = data.guarantorType;const _errs12 = errors;if(!((data5 === "CLIENT") || (data5 === "GROUP"))){validate12.errors = [{instancePath:instancePath+"/guarantorType",schemaPath:"#/properties/guarantorType/enum",keyword:"enum",params:{allowedValues: schema14.properties.guarantorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data6 = data.originalAmount;const _errs13 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate12.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){let data7 = data.originalCurrency;const _errs15 = errors;const _errs16 = errors;if(errors === _errs16){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.code !== undefined){const _errs19 = errors;let valid3;valid3 = false;for(const v0 of schema15.properties.code.enum){if(func0(data7.code, v0)){valid3 = true;break;}}if(!valid3){validate12.errors = [{instancePath:instancePath+"/originalCurrency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema15.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data7.currencyCode !== undefined){const _errs20 = errors;if(typeof data7.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/originalCurrency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}}}else {validate12.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}const schema18 = {"type":"object","description":"The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees.","properties":{"disbursementDate":{"type":"string","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"firstRepaymentDate":{"type":"string","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"$ref":"#/$defs/LoanTransactionDetails"}},"additionalProperties":true};const schema19 = {"type":"object","description":"The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement.","properties":{"amount":{"type":"number","description":"The amount of the custom fee."},"encodedKey":{"type":"string","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","description":"In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made."},"transactionChannelId":{"type":"string","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.disbursementDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.disbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = errors;if(typeof data.encodedKey !== "string"){validate14.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.expectedDisbursementDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(!(typeof data.expectedDisbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data3 = data.fees;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid1 = true;const len0 = data3.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema26 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate16(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema33 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate18.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate18.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate18.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a loan account. A loan account defines the amount that your organization lends to a client. The terms and conditions of a loan account are defined by a loan product. In a loan account, Mambu stores all the information related to disbursements, repayments, interest rates, and withdrawals.","properties":{"accountArrearsSettings":{"$ref":"#/$defs/AccountArrearsSettings"},"accountHolderKey":{"type":"string","description":"The encoded key of the account holder."},"accountHolderType":{"description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"description":"A second state for the loan account. Beside the account state, a second substate is sometimes necessary to provide more information about the exact lifecycle state of a loan account.For example, even if the account state of a loan account is `ACTIVE`, it can also have a substate of `LOCKED`.","enum":["PARTIALLY_DISBURSED","LOCKED","LOCKED_CAPPING","REFINANCED","RESCHEDULED","WITHDRAWN","REPAID","REJECTED","WRITTEN_OFF","TERMINATED"]},"accruedInterest":{"type":"number","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Asset"}},"assignedBranchKey":{"type":"string","description":"The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set."},"assignedCentreKey":{"type":"string","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user this loan account is assigned to."},"balances":{"$ref":"#/$defs/Balances"},"closedDate":{"type":"string","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the line of credit where this account is registered to."},"currency":{"$ref":"#/$defs/Currency"},"daysInArrears":{"type":"integer","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"$ref":"#/$defs/DisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFund"}},"futurePaymentsAcceptance":{"description":"Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account.","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"guarantors":{"type":"array","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantor"}},"id":{"type":"string","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","description":"The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled."},"interestFromArrearsAccrued":{"type":"number","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"$ref":"#/$defs/InterestSettings"},"lastAccountAppraisalDate":{"type":"string","description":"The date the loan account has last been evaluated for interest, principal, fees, and penalties calculations expressed in the organization time format and time zone.","format":"date-time"},"lastInterestAppliedDate":{"type":"string","description":"The date of the last time the loan account had interest applied (stored to interest balance), expressed in the organization time format and time zone.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","description":"The date when the loan account was set for the last time in the `LOCKED` state expressed in the organization time format and time zone. If null, the account is not locked anymore.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the loan account was set to last standing or null; if never set, it is expressed in your organization time format and time zone.","format":"date-time"},"lastTaxRateReviewDate":{"type":"string","description":"The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone.","format":"date-time"},"latePaymentsRecalculationMethod":{"description":"The overdue payments recalculation method inherited from the loan product on which this loan account is based.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"loanAmount":{"type":"number","description":"The loan amount."},"loanName":{"type":"string","description":"The name of the loan account."},"lockedAccountTotalDueType":{"description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","description":"A list with operations which are locked when the account is in the AccountState.LOCKED substate.","items":{"enum":["APPLY_INTEREST","APPLY_FEES","APPLY_PENALTIES"]}},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from."},"modifyInterestForFirstInstallment":{"type":"boolean","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"description":"The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account).","enum":["HORIZONTAL","VERTICAL"]},"penaltySettings":{"$ref":"#/$defs/PenaltySettings"},"plannedInstallmentFees":{"type":"array","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFee"}},"prepaymentSettings":{"$ref":"#/$defs/PrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentAccountSettings"},"productTypeKey":{"type":"string","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"$ref":"#/$defs/LoanAccountRedrawSettings"},"rescheduledAccountKey":{"type":"string","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"$ref":"#/$defs/ScheduleSettings"},"settlementAccountKey":{"type":"string","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","description":"The tax rate."},"terminationDate":{"type":"string","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTranche"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","description":"The interest from arrears balance. Indicates interest from arrears owned by the client, from now on. (total interest from arrears accrued for account - interest from arrears paid)."},"interestFromArrearsDue":{"type":"number","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","description":"The constraint minimum value"},"sharePercentage":{"type":"number","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","description":"Guarantor, holds information about a client guaranty entry. It can be defined based on another client which guarantees (including or not a savings account whether it is a client of the organization using Mambu or not) or based on a value the client holds (an asset)","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true};const schema30 = {"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true};const schema31 = {"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema14 = {"type":"object","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"$ref":"#/$defs/Currency"}},"required":["amount","assetName"],"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.amount === undefined) && (missing0 = "amount")) || ((data.assetName === undefined) && (missing0 = "assetName"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.assetName !== undefined){const _errs4 = errors;if(typeof data.assetName !== "string"){validate12.errors = [{instancePath:instancePath+"/assetName",schemaPath:"#/properties/assetName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.depositAccountKey !== undefined){const _errs6 = errors;if(typeof data.depositAccountKey !== "string"){validate12.errors = [{instancePath:instancePath+"/depositAccountKey",schemaPath:"#/properties/depositAccountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = errors;if(typeof data.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorKey !== undefined){const _errs10 = errors;if(typeof data.guarantorKey !== "string"){validate12.errors = [{instancePath:instancePath+"/guarantorKey",schemaPath:"#/properties/guarantorKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorType !== undefined){let data5 = data.guarantorType;const _errs12 = errors;if(!((data5 === "CLIENT") || (data5 === "GROUP"))){validate12.errors = [{instancePath:instancePath+"/guarantorType",schemaPath:"#/properties/guarantorType/enum",keyword:"enum",params:{allowedValues: schema14.properties.guarantorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data6 = data.originalAmount;const _errs13 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate12.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){let data7 = data.originalCurrency;const _errs15 = errors;const _errs16 = errors;if(errors === _errs16){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.code !== undefined){const _errs19 = errors;let valid3;valid3 = false;for(const v0 of schema15.properties.code.enum){if(func0(data7.code, v0)){valid3 = true;break;}}if(!valid3){validate12.errors = [{instancePath:instancePath+"/originalCurrency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema15.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data7.currencyCode !== undefined){const _errs20 = errors;if(typeof data7.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/originalCurrency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}}}else {validate12.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}const schema18 = {"type":"object","description":"The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees.","properties":{"disbursementDate":{"type":"string","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"firstRepaymentDate":{"type":"string","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"$ref":"#/$defs/LoanTransactionDetails"}},"additionalProperties":true};const schema19 = {"type":"object","description":"The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement.","properties":{"amount":{"type":"number","description":"The amount of the custom fee."},"encodedKey":{"type":"string","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","description":"In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made."},"transactionChannelId":{"type":"string","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.disbursementDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.disbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = errors;if(typeof data.encodedKey !== "string"){validate14.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.expectedDisbursementDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(!(typeof data.expectedDisbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data3 = data.fees;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid1 = true;const len0 = data3.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema26 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate16(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema33 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate18.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate18.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate18.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuDepositProductsConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/depositproducts.yaml + * * Get configuration for all deposit products */ public get({ @@ -55,23 +59,25 @@ export class MambuDepositProductsConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/depositproducts.yaml', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/depositproducts.yaml + * * Update all deposit products configuration */ public update({ @@ -87,7 +93,7 @@ export class MambuDepositProductsConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -95,7 +101,6 @@ export class MambuDepositProductsConfiguration { return this.awaitResponse( this.buildClient(auth).put('configuration/depositproducts.yaml', { headers: headers ?? {}, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -105,50 +110,52 @@ export class MambuDepositProductsConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -156,8 +163,7 @@ export class MambuDepositProductsConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -165,21 +171,21 @@ export class MambuDepositProductsConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/deposit-products/rest.client.ts b/src/deposit-products/rest.client.ts index 4319f0a..1544839 100644 --- a/src/deposit-products/rest.client.ts +++ b/src/deposit-products/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { DepositProduct, @@ -23,7 +23,7 @@ import { * depositproducts */ export class MambuDepositProducts { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -38,22 +38,26 @@ export class MambuDepositProducts { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /depositproducts/{depositProductId}:batchUpdate + * * Perform a batch update action on the specified deposit product */ public batchUpdate({ @@ -77,7 +81,7 @@ export class MambuDepositProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -89,9 +93,8 @@ export class MambuDepositProducts { return this.awaitResponse( this.buildClient(auth).post(`depositproducts/${path.depositProductId}:batchUpdate`, { - json: body, + json: _body.right as DepositProductAction, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -101,10 +104,13 @@ export class MambuDepositProducts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /depositproducts + * * Create deposit product */ public create({ @@ -121,7 +127,7 @@ export class MambuDepositProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -133,9 +139,8 @@ export class MambuDepositProducts { return this.awaitResponse( this.buildClient(auth).post('depositproducts', { - json: body, + json: _body.right as DepositProduct, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -144,10 +149,13 @@ export class MambuDepositProducts { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /depositproducts/{depositProductId} + * * Delete deposit product */ public delete({ @@ -163,15 +171,13 @@ export class MambuDepositProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`depositproducts/${path.depositProductId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`depositproducts/${path.depositProductId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -180,10 +186,13 @@ export class MambuDepositProducts { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /depositproducts + * * Get deposit products */ public getAll({ @@ -200,7 +209,7 @@ export class MambuDepositProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -209,7 +218,6 @@ export class MambuDepositProducts { this.buildClient(auth).get('depositproducts', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -217,10 +225,13 @@ export class MambuDepositProducts { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /depositproducts/{depositProductId} + * * Get deposit product */ public getById({ @@ -236,7 +247,7 @@ export class MambuDepositProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -245,7 +256,6 @@ export class MambuDepositProducts { this.buildClient(auth).get(`depositproducts/${path.depositProductId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: DepositProduct, @@ -254,10 +264,13 @@ export class MambuDepositProducts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /depositproducts/{depositProductId} + * * Partially update deposit product */ public patch({ @@ -275,7 +288,7 @@ export class MambuDepositProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -287,8 +300,7 @@ export class MambuDepositProducts { return this.awaitResponse( this.buildClient(auth).patch(`depositproducts/${path.depositProductId}`, { - json: body, - responseType: 'text', + json: _body.right as PatchRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -298,10 +310,13 @@ export class MambuDepositProducts { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PUT /depositproducts/{depositProductId} + * * Update deposit product */ public update({ @@ -319,7 +334,7 @@ export class MambuDepositProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -331,9 +346,8 @@ export class MambuDepositProducts { return this.awaitResponse( this.buildClient(auth).put(`depositproducts/${path.depositProductId}`, { - json: body, + json: _body.right as DepositProduct, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: DepositProduct, @@ -343,6 +357,7 @@ export class MambuDepositProducts { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } @@ -367,44 +382,45 @@ export class MambuDepositProducts { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -412,8 +428,7 @@ export class MambuDepositProducts { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -421,21 +436,21 @@ export class MambuDepositProducts { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/deposit-products/rest.type.ts b/src/deposit-products/rest.type.ts index 2d47bc9..60c6e3c 100644 --- a/src/deposit-products/rest.type.ts +++ b/src/deposit-products/rest.type.ts @@ -293,12 +293,14 @@ export interface DepositGLAccountingRule { | 'FUND_SOURCE' | 'WRITE_OFF_EXPENSE' | 'INTEREST_INCOME' + | 'PAYMENT_HOLIDAY_INTEREST_INCOME' | 'TAXES_PAYABLE' | 'FEE_INCOME' | 'PENALTY_INCOME' | 'NEGATIVE_INTEREST_PAYABLE_RECEIVABLE' | 'NEGATIVE_INTEREST_PAYABLE' | 'INTEREST_RECEIVABLE' + | 'PAYMENT_HOLIDAY_INTEREST_RECEIVABLE' | 'FEE_RECEIVABLE' | 'PENALTY_RECEIVABLE' | 'TAXES_RECEIVABLE' @@ -316,6 +318,9 @@ export interface DepositGLAccountingRule { | 'OVERDRAFT_WRITE_OFF_EXPENSE' | 'OVERDRAFT_INTEREST_RECEIVABLE' | 'INTER_BRANCH_TRANSFER' + | 'INTEREST_FROM_ARREARS_INCOME' + | 'INTEREST_FROM_ARREARS_RECEIVABLE' + | 'INTEREST_FROM_ARREARS_WRITE_OFF_EXPENSE' /** * The encoded key of the account that is mapped to the financialResource */ @@ -435,7 +440,7 @@ export const DepositProduct = { */ export interface DepositProductAccountingSettings { /** - * A list of accounting rules for a product. + * The calculation method used for accounting. */ accountingMethod: 'NONE' | 'CASH' | 'ACCRUAL' /** @@ -443,7 +448,11 @@ export interface DepositProductAccountingSettings { */ accountingRules?: DepositGLAccountingRule[] | undefined /** - * A list of accounting rules for a product. + * The accounting interest calculation option selected for the product. + */ + interestAccrualCalculation?: 'NONE' | 'AGGREGATED_AMOUNT' | 'BREAKDOWN_PER_ACCOUNT' | undefined + /** + * The interval defined for a product when the interest accrues should be maintained. */ interestAccruedAccountingMethod?: 'NONE' | 'DAILY' | 'END_OF_MONTH' | undefined } diff --git a/src/deposit-products/schemas/deposit-product.schema.js b/src/deposit-products/schemas/deposit-product.schema.js index 107d62d..ef33226 100644 --- a/src/deposit-products/schemas/deposit-product.schema.js +++ b/src/deposit-products/schemas/deposit-product.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DepositProduct","type":"object","description":"A deposit product defines the terms and constraints on deposit accounts","properties":{"accountingSettings":{"$ref":"#/$defs/DepositProductAccountingSettings"},"availabilitySettings":{"$ref":"#/$defs/DepositProductAvailabilitySettings"},"category":{"description":"Indicates the category that the product belongs to","enum":["PERSONAL_DEPOSIT","BUSINESS_DEPOSIT","DAILY_BANKING_ACCOUNTS","BUSINESS_BANKING_ACCOUNTS","STORED_VALUE_ACCOUNTS","UNCATEGORIZED"]},"creationDate":{"type":"string","description":"The date this product was created","format":"date-time"},"creditArrangementSettings":{"$ref":"#/$defs/CreditArrangementSettings"},"currencySettings":{"$ref":"#/$defs/DepositProductCurrencySettings"},"encodedKey":{"type":"string","description":"The encoded key of the deposit product, auto generated, unique"},"feesSettings":{"$ref":"#/$defs/DepositProductFeeSettings"},"id":{"type":"string","description":"The id of the product, can be generated and customized, unique"},"interestSettings":{"$ref":"#/$defs/DepositProductInterestSettings"},"internalControls":{"$ref":"#/$defs/DepositProductInternalControls"},"lastModifiedDate":{"type":"string","description":"The last date the product was updated","format":"date-time"},"maturitySettings":{"$ref":"#/$defs/DepositMaturitySettings"},"name":{"type":"string","description":"The name of the product"},"newAccountSettings":{"$ref":"#/$defs/DepositNewAccountSettings"},"notes":{"type":"string","description":"Some notes/a description about the product"},"offsetSettings":{"$ref":"#/$defs/DepositProductOffsetSettings"},"overdraftInterestSettings":{"$ref":"#/$defs/OverdraftInterestSettings"},"overdraftSettings":{"$ref":"#/$defs/DepositProductOverdraftSettings"},"state":{"description":"Indicates the current state of the product","enum":["ACTIVE","INACTIVE"]},"taxSettings":{"$ref":"#/$defs/DepositProductTaxSettings"},"templates":{"type":"array","description":"Template documents of the product.","items":{"$ref":"#/$defs/DocumentTemplate"}},"type":{"description":"Indicates the type of product.","enum":["CURRENT_ACCOUNT","REGULAR_SAVINGS","FIXED_DEPOSIT","SAVINGS_PLAN","INVESTOR_ACCOUNT"]}},"required":["accountingSettings","id","name","newAccountSettings","state","type"],"additionalProperties":true,"$defs":{"DepositProductAccountingSettings":{"type":"object","description":"Accounting settings, defines the accounting settings for the product.","properties":{"accountingMethod":{"description":"A list of accounting rules for a product.","enum":["NONE","CASH","ACCRUAL"]},"accountingRules":{"type":"array","description":"A list of accounting rules for the product.","items":{"$ref":"#/$defs/DepositGLAccountingRule"}},"interestAccruedAccountingMethod":{"description":"A list of accounting rules for a product.","enum":["NONE","DAILY","END_OF_MONTH"]}},"required":["accountingMethod"],"additionalProperties":true},"DepositGLAccountingRule":{"type":"object","description":"The GL accounting rule, it maps a financial resource with a GL account for a specific product (i.e loan or saving).","properties":{"encodedKey":{"type":"string","description":"The encoded key of the accounting rule, auto generated, unique."},"financialResource":{"description":"General Ledger Financial Resources used to setup the product accounting rules and determine the credit and debit accounts when logging journal entries","enum":["PORTFOLIO_CONTROL","FUND_SOURCE","WRITE_OFF_EXPENSE","INTEREST_INCOME","TAXES_PAYABLE","FEE_INCOME","PENALTY_INCOME","NEGATIVE_INTEREST_PAYABLE_RECEIVABLE","NEGATIVE_INTEREST_PAYABLE","INTEREST_RECEIVABLE","FEE_RECEIVABLE","PENALTY_RECEIVABLE","TAXES_RECEIVABLE","DEFERRED_INTERESTS_INCOME","DEFERRED_FEE_INCOME","DEFERRED_TAXES","DEPOSIT_REFERENCE","SAVINGS_CONTROL","INTEREST_EXPENSE","INTEREST_PAYABLE","NEGATIVE_INTEREST_INCOME","NEGATIVE_INTEREST_RECEIVABLE","OVERDRAFT_PORTFOLIO_CONTROL","OVERDRAFT_INTEREST_INCOME","OVERDRAFT_WRITE_OFF_EXPENSE","OVERDRAFT_INTEREST_RECEIVABLE","INTER_BRANCH_TRANSFER"]},"glAccountKey":{"type":"string","description":"The encoded key of the account that is mapped to the financialResource"}},"required":["financialResource","glAccountKey"],"additionalProperties":true},"DepositProductAvailabilitySettings":{"type":"object","description":"Holds information about product availability.","properties":{"availableFor":{"type":"array","description":"Holds the entities this product is available for. i.e Individuals","items":{"enum":["INDIVIDUALS","PURE_GROUPS"]},"uniqueItems":true},"branchSettings":{"$ref":"#/$defs/BranchSettings"}},"additionalProperties":true},"BranchSettings":{"type":"object","description":"Holds information about branch availability for the product.","properties":{"availableProductBranches":{"type":"array","description":"Holds the encoded keys of the branches this product should be available for.","items":{"type":"string"}},"forAllBranches":{"type":"boolean","description":"Indicates if this product should be available for all branches"}},"additionalProperties":true},"CreditArrangementSettings":{"type":"object","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"creditArrangementRequirement":{"description":"Shows whether accounts created after this product can/should be part of a line of credit.","enum":["OPTIONAL","REQUIRED","NOT_REQUIRED"]}},"additionalProperties":true},"DepositProductCurrencySettings":{"type":"object","description":"Currency settings for the product.","properties":{"currencies":{"type":"array","description":"Currencies that can be used by accounts of this product","items":{"$ref":"#/$defs/Currency"}}},"additionalProperties":true},"Currency":{"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true},"DepositProductFeeSettings":{"type":"object","description":"Defines fees settings for the product.","properties":{"allowArbitraryFees":{"type":"boolean","description":"Only if true users will be able to apply fees, for current object, of type 'Other'; these fees can have any amount."},"fees":{"type":"array","description":"List of all fees that can be applied for accounts of this loan product.","items":{"$ref":"#/$defs/DepositProductPredefinedFee"}}},"additionalProperties":true},"DepositProductPredefinedFee":{"type":"object","description":"The response representation of the PredefinedFee. Represents a fee with a defined name and a fixed value.","properties":{"accountingRules":{"type":"array","description":"A list of accounting rules defined for this fee. If null, product default rules are selected.","items":{"$ref":"#/$defs/DepositGLAccountingRule"}},"amount":{"type":"number","description":"The amount of the fee"},"amountCalculationFunctionName":{"type":"string","description":"External function"},"amountCalculationMethod":{"description":"The amount from which the fee is calculated using percentageAmount","enum":["FLAT","MAMBU_FUNCTION"]},"applyDateMethod":{"description":"Shows when a fee should be applied; to be used with monthly deposit fees","enum":["MONTHLY_FROM_ACTIVATION","FIRST_OF_EVERY_MONTH"]},"creationDate":{"type":"string","description":"Shows the creation date of the fee","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"feeApplication":{"description":"The type of fee application when disbursement is applied","enum":["REQUIRED","OPTIONAL"]},"id":{"type":"string","description":"The id of the fee"},"lastModifiedDate":{"type":"string","description":"Shows the last modified date of the fee","format":"date-time"},"name":{"type":"string","description":"The name of the fee"},"state":{"description":"Indicates the state of the fee","enum":["ACTIVE","INACTIVE"]},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MONTHLY_FEE","ARBITRARY"]}},"required":["feeApplication","state","trigger"],"additionalProperties":true},"DepositProductInterestSettings":{"type":"object","description":"The interest settings, defines constraints regarding interest that will be used on the deposit account based on this product.","properties":{"collectInterestWhenLocked":{"type":"boolean","description":"Whether locked accounts still collect Interest or not"},"daysInYear":{"description":"How many days in a year should be used for interest calculations","enum":["ACTUAL_365_FIXED","ACTUAL_360","ACTUAL_ACTUAL_ISDA","E30_360","E30_42_365","BUS_252"]},"interestCalculationBalance":{"description":"The balance which is used for the Interest calculation","enum":["MINIMUM","AVERAGE","END_OF_DAY","MINIMUM_TO_END_OF_DAY","FRENCH_INTEREST_ACCRUAL"]},"interestGainsProvidedEndDate":{"type":"string","description":"The date when the accounts under this product, will no longer have interest gains provided","format":"date"},"interestGainsProvidedStartDate":{"type":"string","description":"The date when the accounts of this product will start to have interest gains provided. Starting with this date 0 interest rate is enforced on the accounts of this product.","format":"date"},"interestPaidIntoAccount":{"type":"boolean","description":"If interest should be payed into the deposit account"},"interestPaymentSettings":{"$ref":"#/$defs/InterestPaymentSettings"},"interestRateSettings":{"$ref":"#/$defs/DepositProductInterestRateSettings"},"maximumBalance":{"type":"number","description":"The maximum balance used for Interest calculation"}},"additionalProperties":true},"InterestPaymentSettings":{"type":"object","description":"Defines the interest payment settings for the deposit product and for deposits created based on this product","properties":{"interestPaymentDates":{"type":"array","description":"List of all dates on which the interest is payed into deposit account","items":{"$ref":"#/$defs/MonthAndDay"}},"interestPaymentPoint":{"description":"Specifies when the interest should be paid to the deposit account","enum":["FIRST_DAY_OF_MONTH","EVERY_WEEK","EVERY_OTHER_WEEK","EVERY_MONTH","EVERY_3_MONTHS","ON_FIXED_DATES","DAILY","ANNUALLY","BI_ANNUALLY","ON_ACCOUNT_MATURITY"]}},"additionalProperties":true},"MonthAndDay":{"type":"object","description":"Wrapper for month and day for instances where the year isn't needed","properties":{"day":{"type":"integer","description":"The day in the month"},"month":{"type":"integer","description":"The month of the year"}},"additionalProperties":true},"DepositProductInterestRateSettings":{"type":"object","description":"The interest settings, defines constraints regarding interest that will be used on the deposit created based on this product.","properties":{"accrueInterestAfterMaturity":{"type":"boolean","description":"If the product supports this option, specify if the interest should be accrued after the account maturity date"},"allowNegativeInterestRate":{"type":"boolean","description":"Indicator whether the deposit product allows negative values for interest rate"},"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestChargeFrequency":{"description":"The interval used for determining how often is interest charged","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestChargeFrequencyCount":{"type":"integer","description":"the count of units to apply over the interval"},"interestRate":{"$ref":"#/$defs/DecimalInterval"},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count"},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"description":"The option for how is the interest rate determined when being accrued for an account","enum":["FIXED","TIERED","TIERED_PERIOD","TIERED_BAND"]},"interestRateTiers":{"type":"array","description":"The list of interest rate tiers available for the current settings instance","items":{"$ref":"#/$defs/DepositProductInterestRateTier"}}},"additionalProperties":true},"DecimalInterval":{"type":"object","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","description":"The default value, will be used in case no other value was filled in by the user."},"maxValue":{"type":"number","description":"The maximum value."},"minValue":{"type":"number","description":"The minimum value."}},"additionalProperties":true},"DepositProductInterestRateTier":{"type":"object","description":"Used or TIERED interest rates, holds the values to define how the interest is computed","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"endingDay":{"type":"integer","description":"The top-limit value for the account period since activation in order to determine if this tier is used or not"},"interestRate":{"type":"number","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true},"DepositProductInternalControls":{"type":"object","description":"Constraints and automated actions and that will be applied on the accounts.","properties":{"dormancyPeriodDays":{"type":"integer","description":"Specifies the number of days for an account to be fully paid in order to auto close it."},"maxWithdrawalAmount":{"type":"number","description":"Max amount per withdrawal"},"openingBalance":{"$ref":"#/$defs/AmountDecimalInterval"},"recommendedDepositAmount":{"type":"number","description":"Recommended amount for a deposit"}},"additionalProperties":true},"AmountDecimalInterval":{"type":"object","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","description":"The default value, will be used in case no other value was filled in by the user."},"maxValue":{"type":"number","description":"The maximum value."},"minValue":{"type":"number","description":"The minimum value."}},"additionalProperties":true},"DepositMaturitySettings":{"type":"object","description":"The maturity settings for the product.","properties":{"maturityPeriod":{"$ref":"#/$defs/IntegerInterval"},"maturityPeriodUnit":{"description":"maturity period measurement unit","enum":["DAYS","WEEKS","MONTHS"]}},"additionalProperties":true},"IntegerInterval":{"type":"object","description":"Decimal integer, like min/max/default.","properties":{"defaultValue":{"type":"integer","description":"The default value, will be used in case no other value was filled in by the user."},"maxValue":{"type":"integer","description":"The maximum value."},"minValue":{"type":"integer","description":"The minimum value."}},"additionalProperties":true},"DepositNewAccountSettings":{"type":"object","description":"New Account settings for deposit accounts","properties":{"idGeneratorType":{"description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["idGeneratorType","idPattern"],"additionalProperties":true},"DepositProductOffsetSettings":{"type":"object","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","description":"Specify if the product allow to create accounts which can be used as offset for loans"}},"additionalProperties":true},"OverdraftInterestSettings":{"type":"object","description":"Overdraft settings for the product","properties":{"daysInYear":{"description":"How many days in a year should be used for interest calculations","enum":["ACTUAL_365_FIXED","ACTUAL_360","ACTUAL_ACTUAL_ISDA","E30_360","E30_42_365","BUS_252"]},"interestCalculationBalance":{"description":"The balance which is used for the overdraft interest calculation. Default value is MINIMUM. If set to null on a PUT call and the product allows overdrafts, the null value is ignored and not changed.","enum":["MINIMUM","AVERAGE","END_OF_DAY","MINIMUM_TO_END_OF_DAY","FRENCH_INTEREST_ACCRUAL"]},"interestRateSettings":{"$ref":"#/$defs/DepositProductOverdraftInterestRateSettings"}},"additionalProperties":true},"DepositProductOverdraftInterestRateSettings":{"type":"object","description":"The overdraft interest settings, defines constraints regarding interest that will be used on the account created based on this product.","properties":{"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestChargeFrequency":{"description":"The interval used for determining how often is interest charged","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestChargeFrequencyCount":{"type":"integer","description":"the count of units to apply over the interval"},"interestRate":{"$ref":"#/$defs/DecimalInterval"},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count"},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"description":"The option for how is the interest rate determined when being accrued for an account","enum":["FIXED","TIERED","TIERED_PERIOD","TIERED_BAND"]},"interestRateTiers":{"type":"array","description":"The list of interest rate tiers available for the current settings instance","items":{"$ref":"#/$defs/DepositProductOverdraftInterestRateTier"}}},"additionalProperties":true},"DepositProductOverdraftInterestRateTier":{"type":"object","description":"Used for TIERED interest rates, holds the values to define how the interest is computed","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"interestRate":{"type":"number","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true},"DepositProductOverdraftSettings":{"type":"object","description":"The overdraft settings of the deposit product","properties":{"allowOverdraft":{"type":"boolean","description":"Whether the accounts for this product may have overdraft"},"allowTechnicalOverdraft":{"type":"boolean","description":"Whether the accounts for this product may have technical overdraft"},"maxOverdraftLimit":{"type":"number","description":"How much money may be taken out for the account to go negative"}},"additionalProperties":true},"DepositProductTaxSettings":{"type":"object","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"withholdingTaxEnabled":{"type":"boolean","description":"Whether withholding taxes are enabled for this product or not"}},"additionalProperties":true},"DocumentTemplate":{"type":"object","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","description":"The name the document"},"type":{"description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true}}};const schema16 = {"type":"object","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"creditArrangementRequirement":{"description":"Shows whether accounts created after this product can/should be part of a line of credit.","enum":["OPTIONAL","REQUIRED","NOT_REQUIRED"]}},"additionalProperties":true};const schema32 = {"type":"object","description":"New Account settings for deposit accounts","properties":{"idGeneratorType":{"description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["idGeneratorType","idPattern"],"additionalProperties":true};const schema33 = {"type":"object","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","description":"Specify if the product allow to create accounts which can be used as offset for loans"}},"additionalProperties":true};const schema38 = {"type":"object","description":"The overdraft settings of the deposit product","properties":{"allowOverdraft":{"type":"boolean","description":"Whether the accounts for this product may have overdraft"},"allowTechnicalOverdraft":{"type":"boolean","description":"Whether the accounts for this product may have technical overdraft"},"maxOverdraftLimit":{"type":"number","description":"How much money may be taken out for the account to go negative"}},"additionalProperties":true};const schema39 = {"type":"object","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"withholdingTaxEnabled":{"type":"boolean","description":"Whether withholding taxes are enabled for this product or not"}},"additionalProperties":true};const schema40 = {"type":"object","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","description":"The name the document"},"type":{"description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true};const schema12 = {"type":"object","description":"Accounting settings, defines the accounting settings for the product.","properties":{"accountingMethod":{"description":"A list of accounting rules for a product.","enum":["NONE","CASH","ACCRUAL"]},"accountingRules":{"type":"array","description":"A list of accounting rules for the product.","items":{"$ref":"#/$defs/DepositGLAccountingRule"}},"interestAccruedAccountingMethod":{"description":"A list of accounting rules for a product.","enum":["NONE","DAILY","END_OF_MONTH"]}},"required":["accountingMethod"],"additionalProperties":true};const schema13 = {"type":"object","description":"The GL accounting rule, it maps a financial resource with a GL account for a specific product (i.e loan or saving).","properties":{"encodedKey":{"type":"string","description":"The encoded key of the accounting rule, auto generated, unique."},"financialResource":{"description":"General Ledger Financial Resources used to setup the product accounting rules and determine the credit and debit accounts when logging journal entries","enum":["PORTFOLIO_CONTROL","FUND_SOURCE","WRITE_OFF_EXPENSE","INTEREST_INCOME","TAXES_PAYABLE","FEE_INCOME","PENALTY_INCOME","NEGATIVE_INTEREST_PAYABLE_RECEIVABLE","NEGATIVE_INTEREST_PAYABLE","INTEREST_RECEIVABLE","FEE_RECEIVABLE","PENALTY_RECEIVABLE","TAXES_RECEIVABLE","DEFERRED_INTERESTS_INCOME","DEFERRED_FEE_INCOME","DEFERRED_TAXES","DEPOSIT_REFERENCE","SAVINGS_CONTROL","INTEREST_EXPENSE","INTEREST_PAYABLE","NEGATIVE_INTEREST_INCOME","NEGATIVE_INTEREST_RECEIVABLE","OVERDRAFT_PORTFOLIO_CONTROL","OVERDRAFT_INTEREST_INCOME","OVERDRAFT_WRITE_OFF_EXPENSE","OVERDRAFT_INTEREST_RECEIVABLE","INTER_BRANCH_TRANSFER"]},"glAccountKey":{"type":"string","description":"The encoded key of the account that is mapped to the financialResource"}},"required":["financialResource","glAccountKey"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.accountingMethod === undefined) && (missing0 = "accountingMethod")){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountingMethod !== undefined){let data0 = data.accountingMethod;const _errs2 = errors;if(!(((data0 === "NONE") || (data0 === "CASH")) || (data0 === "ACCRUAL"))){validate11.errors = [{instancePath:instancePath+"/accountingMethod",schemaPath:"#/properties/accountingMethod/enum",keyword:"enum",params:{allowedValues: schema12.properties.accountingMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.accountingRules !== undefined){let data1 = data.accountingRules;const _errs3 = errors;if(errors === _errs3){if(Array.isArray(data1)){var valid1 = true;const len0 = data1.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate13.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate13.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.branchSettings !== undefined){let data2 = data.branchSettings;const _errs5 = errors;const _errs6 = errors;if(errors === _errs6){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.availableProductBranches !== undefined){let data3 = data2.availableProductBranches;const _errs9 = errors;if(errors === _errs9){if(Array.isArray(data3)){var valid5 = true;const len1 = data3.length;for(let i2=0; i2 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate13.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate13.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.branchSettings !== undefined){let data2 = data.branchSettings;const _errs5 = errors;const _errs6 = errors;if(errors === _errs6){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.availableProductBranches !== undefined){let data3 = data2.availableProductBranches;const _errs9 = errors;if(errors === _errs9){if(Array.isArray(data3)){var valid5 = true;const len1 = data3.length;for(let i2=0; i2 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate14.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate14.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.branchSettings !== undefined){let data2 = data.branchSettings;const _errs5 = errors;const _errs6 = errors;if(errors === _errs6){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.availableProductBranches !== undefined){let data3 = data2.availableProductBranches;const _errs9 = errors;if(errors === _errs9){if(Array.isArray(data3)){var valid5 = true;const len1 = data3.length;for(let i2=0; i2 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate14.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate14.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.branchSettings !== undefined){let data2 = data.branchSettings;const _errs5 = errors;const _errs6 = errors;if(errors === _errs6){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.availableProductBranches !== undefined){let data3 = data2.availableProductBranches;const _errs9 = errors;if(errors === _errs9){if(Array.isArray(data3)){var valid5 = true;const len1 = data3.length;for(let i2=0; i2 Promise<[username: string, password: string]>) @@ -46,22 +46,26 @@ export class MambuDepositTransactions { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /deposits/transactions/{depositTransactionId}:adjust + * * Adjust a deposit transaction, which may bulk adjust multiple transactions */ public adjust({ @@ -86,7 +90,7 @@ export class MambuDepositTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -98,9 +102,8 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).post(`deposits/transactions/${path.depositTransactionId}:adjust`, { - json: body, + json: _body.right as DepositTransactionAdjustmentDetails, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -111,10 +114,13 @@ export class MambuDepositTransactions { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/{depositAccountId}/fee-transactions + * * Apply a fee on a deposit account */ public applyFee({ @@ -135,11 +141,12 @@ export class MambuDepositTransactions { | FailureResponse<'403', ErrorResponse, 'response:statuscode'> | FailureResponse<'404', ErrorResponse, 'response:statuscode'> | FailureResponse<'409', ErrorResponse, 'response:statuscode'> + | FailureResponse<'429', ErrorResponse, 'response:statuscode'> | FailureResponse | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< - Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + Exclude, '102' | '400' | '401' | '403' | '404' | '409' | '429'>, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -151,9 +158,8 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/fee-transactions`, { - json: body, + json: _body.right as FeeAppliedDepositTransactionInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -163,11 +169,15 @@ export class MambuDepositTransactions { 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, + 429: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /deposits/transactions/{depositTransactionId} + * * Edit custom information or notes for deposit transaction */ public editTransactionDetails({ @@ -184,7 +194,7 @@ export class MambuDepositTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -196,8 +206,7 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).patch(`deposits/transactions/${path.depositTransactionId}`, { - json: body, - responseType: 'text', + json: _body.right as EditTransactionDetailsRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -206,10 +215,13 @@ export class MambuDepositTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /deposits/{depositAccountId}/transactions + * * Get deposit transactions */ public getAll({ @@ -228,7 +240,7 @@ export class MambuDepositTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -237,7 +249,6 @@ export class MambuDepositTransactions { this.buildClient(auth).get(`deposits/${path.depositAccountId}/transactions`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -245,10 +256,13 @@ export class MambuDepositTransactions { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/transactions/{depositTransactionId} + * * Get deposit transaction */ public getById({ @@ -264,7 +278,7 @@ export class MambuDepositTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -273,7 +287,6 @@ export class MambuDepositTransactions { this.buildClient(auth).get(`deposits/transactions/${path.depositTransactionId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: DepositTransaction, @@ -282,10 +295,13 @@ export class MambuDepositTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /deposits/transactions/{depositTransactionId}/templates/{templateId} + * * Get deposit transaction document */ public getDepositTransactionDocument({ @@ -300,7 +316,7 @@ export class MambuDepositTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -308,7 +324,6 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).get(`deposits/transactions/${path.depositTransactionId}/templates/${path.templateId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetDepositTransactionDocumentResponse, @@ -317,10 +332,13 @@ export class MambuDepositTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/deposit-transactions:bulk + * * Create bulk deposit transactions. */ public makeBulkDeposits({ @@ -337,7 +355,7 @@ export class MambuDepositTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -349,9 +367,8 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).post('deposits/deposit-transactions:bulk', { - json: body, + json: _body.right as BulkDepositTransactionsInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -360,10 +377,13 @@ export class MambuDepositTransactions { 401: ErrorResponse, 403: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /deposits/{depositAccountId}/deposit-transactions + * * Create deposit transaction */ public makeDeposit({ @@ -384,11 +404,12 @@ export class MambuDepositTransactions { | FailureResponse<'403', ErrorResponse, 'response:statuscode'> | FailureResponse<'404', ErrorResponse, 'response:statuscode'> | FailureResponse<'409', ErrorResponse, 'response:statuscode'> + | FailureResponse<'429', ErrorResponse, 'response:statuscode'> | FailureResponse | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< - Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + Exclude, '102' | '400' | '401' | '403' | '404' | '409' | '429'>, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -400,9 +421,8 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/deposit-transactions`, { - json: body, + json: _body.right as DepositTransactionInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -412,11 +432,15 @@ export class MambuDepositTransactions { 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, + 429: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/{depositAccountId}/transactions/deposits + * * Create deposit transaction */ public makeDepositAsync({ @@ -440,7 +464,7 @@ export class MambuDepositTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -452,9 +476,8 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/transactions/deposits`, { - json: body, + json: _body.right as DepositTransactionInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -464,10 +487,13 @@ export class MambuDepositTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /deposits/{depositAccountId}/seizure-transactions + * * Seize a block amount on a deposit account */ public makeSeizure({ @@ -488,11 +514,12 @@ export class MambuDepositTransactions { | FailureResponse<'403', ErrorResponse, 'response:statuscode'> | FailureResponse<'404', ErrorResponse, 'response:statuscode'> | FailureResponse<'409', ErrorResponse, 'response:statuscode'> + | FailureResponse<'429', ErrorResponse, 'response:statuscode'> | FailureResponse | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< - Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + Exclude, '102' | '400' | '401' | '403' | '404' | '409' | '429'>, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -504,9 +531,8 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/seizure-transactions`, { - json: body, + json: _body.right as SeizeBlockAmount, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -516,11 +542,15 @@ export class MambuDepositTransactions { 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, + 429: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/{depositAccountId}/transfer-transactions + * * Create transfer transaction */ public makeTransfer({ @@ -541,11 +571,12 @@ export class MambuDepositTransactions { | FailureResponse<'403', ErrorResponse, 'response:statuscode'> | FailureResponse<'404', ErrorResponse, 'response:statuscode'> | FailureResponse<'409', ErrorResponse, 'response:statuscode'> + | FailureResponse<'429', ErrorResponse, 'response:statuscode'> | FailureResponse | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< - Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + Exclude, '102' | '400' | '401' | '403' | '404' | '409' | '429'>, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -557,9 +588,8 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/transfer-transactions`, { - json: body, + json: _body.right as TransferDepositTransactionInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -569,11 +599,15 @@ export class MambuDepositTransactions { 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, + 429: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/{depositAccountId}/withdrawal-transactions + * * Create withdrawal transaction */ public makeWithdrawal({ @@ -594,11 +628,12 @@ export class MambuDepositTransactions { | FailureResponse<'403', ErrorResponse, 'response:statuscode'> | FailureResponse<'404', ErrorResponse, 'response:statuscode'> | FailureResponse<'409', ErrorResponse, 'response:statuscode'> + | FailureResponse<'429', ErrorResponse, 'response:statuscode'> | FailureResponse | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< - Exclude, '102' | '400' | '401' | '403' | '404' | '409'>, - string, + Exclude, '102' | '400' | '401' | '403' | '404' | '409' | '429'>, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -610,9 +645,8 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/withdrawal-transactions`, { - json: body, + json: _body.right as WithdrawalDepositTransactionInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -622,11 +656,15 @@ export class MambuDepositTransactions { 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, + 429: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /deposits/{depositAccountId}/transactions/withdrawals + * * Create withdrawal transaction */ public makeWithdrawalAsync({ @@ -650,7 +688,7 @@ export class MambuDepositTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -662,9 +700,8 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/transactions/withdrawals`, { - json: body, + json: _body.right as WithdrawalDepositTransactionInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -674,10 +711,13 @@ export class MambuDepositTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /deposits/transactions:search + * * Search deposit transactions for deposit accounts by various criteria */ public search({ @@ -686,7 +726,7 @@ export class MambuDepositTransactions { auth = [['apiKey'], ['basic']], }: { body: DepositTransactionSearchCriteria - query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } + query?: { offset?: string; limit?: string; paginationDetails?: string; cursor?: string; detailsLevel?: string } auth?: string[][] | string[] }): Promise< | SuccessResponse<'200', SearchResponse> @@ -697,7 +737,7 @@ export class MambuDepositTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -709,10 +749,9 @@ export class MambuDepositTransactions { return this.awaitResponse( this.buildClient(auth).post('deposits/transactions:search', { - json: body, + json: _body.right as DepositTransactionSearchCriteria, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: SearchResponse, @@ -720,6 +759,7 @@ export class MambuDepositTransactions { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } @@ -744,44 +784,45 @@ export class MambuDepositTransactions { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -789,8 +830,7 @@ export class MambuDepositTransactions { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -798,21 +838,21 @@ export class MambuDepositTransactions { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/deposit-transactions/rest.type.ts b/src/deposit-transactions/rest.type.ts index a0ad23a..20b5947 100644 --- a/src/deposit-transactions/rest.type.ts +++ b/src/deposit-transactions/rest.type.ts @@ -340,6 +340,10 @@ export interface DepositTransaction { * The currency in which this transaction was posted */ currencyCode?: string | undefined + /** + * Whether the custom fields of the transaction are archived + */ + customFieldsArchived?: boolean | undefined /** * The encoded key of the deposit transaction, auto generated, unique */ @@ -418,6 +422,7 @@ export interface DepositTransaction { | 'OVERDRAFT_INTEREST_RATE_CHANGED' | 'OVERDRAFT_LIMIT_CHANGED' | 'BRANCH_CHANGED' + | 'ACCOUNT_HOLDER_CHANGED' | 'LOAN_FUNDED' | 'LOAN_FUNDED_ADJUSTMENT' | 'LOAN_REPAID' diff --git a/src/deposit-transactions/schemas/deposit-transaction.schema.js b/src/deposit-transactions/schemas/deposit-transaction.schema.js index 06da06d..a0924ac 100644 --- a/src/deposit-transactions/schemas/deposit-transaction.schema.js +++ b/src/deposit-transactions/schemas/deposit-transaction.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DepositTransaction","type":"object","description":"Represents the action performed on an Deposit Account after which the account's amount changes its value.","properties":{"accountBalances":{"$ref":"#/$defs/DepositTransactionBalances"},"adjustmentTransactionKey":{"type":"string","description":"The key of the deposit transaction where the adjustment for this transaction was made (if any adjustment was involved)"},"affectedAmounts":{"$ref":"#/$defs/DepositAffectedAmounts"},"amount":{"type":"number","description":"How much was added/removed in account"},"blockId":{"type":"string","description":"The block fund id associated with the transaction"},"bookingDate":{"type":"string","description":"The date when corresponding JE is booked (as Organization Time)","format":"date-time"},"branchKey":{"type":"string","description":"The branch where the transaction was performed"},"cardTransaction":{"$ref":"#/$defs/CardTransaction"},"centreKey":{"type":"string","description":"The center where the transaction was performed"},"creationDate":{"type":"string","description":"The date when this deposit transaction was created","format":"date-time"},"currencyCode":{"type":"string","description":"The currency in which this transaction was posted"},"encodedKey":{"type":"string","description":"The encoded key of the deposit transaction, auto generated, unique"},"externalId":{"type":"string","description":"The external id of the deposit transaction, customizable, unique"},"fees":{"type":"array","description":"All the amounts that have been applied or paid within this transaction and involved predefined fees","items":{"$ref":"#/$defs/DepositFee"}},"holdExternalReferenceId":{"type":"string","description":"The external id of an account authorization hold"},"id":{"type":"string","description":"The id of the deposit transaction, auto generated, unique"},"interestAccruedAmounts":{"$ref":"#/$defs/DepositInterestAccruedAmounts"},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this deposit account. If this account was imported, track which 'migration event' they came from"},"notes":{"type":"string","description":"Extra notes about this deposit transaction"},"originalTransactionKey":{"type":"string","description":"The encodedKey of the transaction that was adjusted as part of this one. Available only for adjustment transactions"},"parentAccountKey":{"type":"string","description":"The key of the parent deposit account"},"paymentDetails":{"$ref":"#/$defs/PaymentDetails"},"paymentOrderId":{"type":"string","description":"The payment order id of the deposit transaction, customizable"},"taxes":{"$ref":"#/$defs/DepositTaxes"},"terms":{"$ref":"#/$defs/DepositTerms"},"tillKey":{"type":"string","description":"The till key associated with this transaction"},"transactionDetails":{"$ref":"#/$defs/TransactionDetails"},"transferDetails":{"$ref":"#/$defs/TransferDetails"},"type":{"description":"The type of the deposit transaction","enum":["IMPORT","WRITE_OFF","WRITE_OFF_ADJUSTMENT","DEPOSIT","ADJUSTMENT","WITHDRAWAL","WITHDRAWAL_ADJUSTMENT","CARD_TRANSACTION_REVERSAL","CARD_TRANSACTION_REVERSAL_ADJUSTMENT","TRANSFER","TRANSFER_ADJUSTMENT","FEE_APPLIED","FEE_ADJUSTED","FEES_DUE_REDUCED","INTEREST_APPLIED","INTEREST_APPLIED_ADJUSTMENT","NET_DIFF_INTEREST","FEE_REDUCTION_ADJUSTMENT","WITHHOLDING_TAX","WITHHOLDING_TAX_ADJUSTMENT","INTEREST_RATE_CHANGED","OVERDRAFT_INTEREST_RATE_CHANGED","OVERDRAFT_LIMIT_CHANGED","BRANCH_CHANGED","LOAN_FUNDED","LOAN_FUNDED_ADJUSTMENT","LOAN_REPAID","LOAN_REPAID_ADJUSTMENT","LOAN_FRACTION_BOUGHT","LOAN_FRACTION_BOUGHT_ADJUSTMENT","LOAN_FRACTION_SOLD","LOAN_FRACTION_SOLD_ADJUSTMENT","SEIZED_AMOUNT"]},"userKey":{"type":"string","description":"The person that performed the transaction"},"valueDate":{"type":"string","description":"Date of the entry (eg date of repayment or disbursal, etc.) (as Organization Time)","format":"date-time"}},"additionalProperties":true,"$defs":{"DepositTransactionBalances":{"type":"object","description":"The balances changed within a transaction.","properties":{"totalBalance":{"type":"number","description":"The running balance owed by deposit"}},"additionalProperties":true},"DepositAffectedAmounts":{"type":"object","description":"The amounts affected after completing the deposit transaction","properties":{"feesAmount":{"type":"number","description":"Amount of fees involved in a transaction that affects an account with positive balance"},"fractionAmount":{"type":"number","description":"In the case of an LOAN_FRACTION_BOUGHT this represent the fraction amount which was bought from another investor"},"fundsAmount":{"type":"number","description":"Balance change amount involved in a transaction that affects an account with positive balance"},"interestAmount":{"type":"number","description":"Amount of interest involved in a transaction that affects an account with positive balance"},"overdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as overdraft"},"overdraftFeesAmount":{"type":"number","description":"Fees amount involved in a transaction that affects an overdraft"},"overdraftInterestAmount":{"type":"number","description":"Interest amount involved in a transaction that affects an overdraft"},"technicalOverdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft"},"technicalOverdraftInterestAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft interest"}},"additionalProperties":true},"CardTransaction":{"type":"object","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true},"CardAcceptor":{"type":"object","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","description":"The city in which the card acceptor has the business."},"country":{"type":"string","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","description":"The name of the card acceptor."},"state":{"type":"string","description":"The state in which the card acceptor has the business."},"street":{"type":"string","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true},"DepositFee":{"type":"object","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MONTHLY_FEE","ARBITRARY"]}},"required":["predefinedFeeKey"],"additionalProperties":true},"DepositInterestAccruedAmounts":{"type":"object","description":"Represents the accrued interest amounts for an Interest Applied deposit transaction.","properties":{"interestAccrued":{"type":"number","description":"The amount of positive interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"negativeInterestAccrued":{"type":"number","description":"The amount of negative interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"overdraftInterestAccrued":{"type":"number","description":"The amount of overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"technicalOverdraftInterestAccrued":{"type":"number","description":"The amount of technical overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"}},"additionalProperties":true},"PaymentDetails":{"type":"object","description":"The payment information including account identification details","properties":{"creditor":{"$ref":"#/$defs/Party"},"creditorAccount":{"$ref":"#/$defs/AccountDetails"},"creditorAgent":{"$ref":"#/$defs/Agent"},"debtor":{"$ref":"#/$defs/Party"},"debtorAccount":{"$ref":"#/$defs/AccountDetails"},"debtorAgent":{"$ref":"#/$defs/Agent"},"paymentIdentification":{"$ref":"#/$defs/PaymentIdentification"},"paymentTypeInformation":{"$ref":"#/$defs/PaymentTypeInformation"},"remittanceInformation":{"$ref":"#/$defs/RemittanceInformation"}},"additionalProperties":true},"Party":{"type":"object","description":"The details of the party for a transaction","properties":{"name":{"type":"string","description":"The name of the party"}},"additionalProperties":true},"AccountDetails":{"type":"object","description":"The account currency and identification","properties":{"currency":{"type":"string","description":"The currency of the account"},"identification":{"$ref":"#/$defs/AccountIdentification"}},"additionalProperties":true},"AccountIdentification":{"type":"object","description":"The account identification details","properties":{"iban":{"type":"string","description":"The account unique identifier"},"other":{"$ref":"#/$defs/OtherAccountIdentification"}},"additionalProperties":true},"OtherAccountIdentification":{"type":"object","description":"Represents other way of identification for the account.","properties":{"identification":{"type":"string","description":"The identification of the payer/payee"},"scheme":{"type":"string","description":"The identification scheme"}},"additionalProperties":true},"Agent":{"type":"object","description":"The agent details for a party","properties":{"financialInstitutionIdentification":{"$ref":"#/$defs/FinancialInstitutionIdentification"}},"additionalProperties":true},"FinancialInstitutionIdentification":{"type":"object","description":"The identification of the financial institution","properties":{"bic":{"type":"string","description":"Business identifier code"}},"additionalProperties":true},"PaymentIdentification":{"type":"object","description":"The payment identification details","properties":{"endToEndIdentification":{"type":"string","description":"Identifier assigned by the initiating party to the transaction"},"instructionIdentification":{"type":"string","description":"Identifier of a payment instruction"},"transactionIdentification":{"type":"string","description":"Identifier unique for a period assigned by the first initiating party to the transaction"}},"additionalProperties":true},"PaymentTypeInformation":{"type":"object","description":"The information specifying the type of transaction","properties":{"serviceLevel":{"$ref":"#/$defs/ServiceLevel"}},"additionalProperties":true},"ServiceLevel":{"type":"object","description":"The rules under which the transaction should be processed","properties":{"code":{"type":"string","description":"The code for a pre-agreed service or level of service between the parties"}},"additionalProperties":true},"RemittanceInformation":{"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"structured":{"$ref":"#/$defs/Structured"},"unstructured":{"type":"string","description":"Information supplied to match the items of the payment in an unstructured form"}},"additionalProperties":true},"Structured":{"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"creditorReferenceInformation":{"$ref":"#/$defs/CreditorReferenceInformation"}},"additionalProperties":true},"CreditorReferenceInformation":{"type":"object","description":"Represents the reference to the underlying documents of the payment.","properties":{"reference":{"type":"string","description":"The reference information of the creditor's underlying documents"},"referenceIssuer":{"type":"string","description":"The entity that assigns the reference type"},"referenceType":{"type":"string","description":"The type of creditor reference"}},"additionalProperties":true},"DepositTaxes":{"type":"object","description":"The taxes applied within a transaction","properties":{"taxRate":{"type":"number","description":"The tax rate that was set or changed in this transaction"}},"additionalProperties":true},"DepositTerms":{"type":"object","description":"The deposit transaction terms","properties":{"interestSettings":{"$ref":"#/$defs/DepositTransactionInterestSettings"},"overdraftInterestSettings":{"$ref":"#/$defs/DepositOverdraftInterestSettings"},"overdraftSettings":{"$ref":"#/$defs/DepositOverdraftSettings"}},"additionalProperties":true},"DepositTransactionInterestSettings":{"type":"object","description":"The interest settings, holds all the properties regarding interests for the deposit account","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate for the deposit account"}},"additionalProperties":true},"DepositOverdraftInterestSettings":{"type":"object","description":"Holds the deposit overdraft interest settings","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate that was set or changed in this transaction. Used on product interest rate changes or interest tier switches"}},"additionalProperties":true},"DepositOverdraftSettings":{"type":"object","description":"Holds the deposit overdraft settings for a transaction","properties":{"overdraftLimit":{"type":"number","description":"The overdraft limit that was set or changed in this transaction"}},"additionalProperties":true},"TransactionDetails":{"type":"object","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true},"TransferDetails":{"type":"object","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","description":"The key of the related loan transaction"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"The balances changed within a transaction.","properties":{"totalBalance":{"type":"number","description":"The running balance owed by deposit"}},"additionalProperties":true};const schema13 = {"type":"object","description":"The amounts affected after completing the deposit transaction","properties":{"feesAmount":{"type":"number","description":"Amount of fees involved in a transaction that affects an account with positive balance"},"fractionAmount":{"type":"number","description":"In the case of an LOAN_FRACTION_BOUGHT this represent the fraction amount which was bought from another investor"},"fundsAmount":{"type":"number","description":"Balance change amount involved in a transaction that affects an account with positive balance"},"interestAmount":{"type":"number","description":"Amount of interest involved in a transaction that affects an account with positive balance"},"overdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as overdraft"},"overdraftFeesAmount":{"type":"number","description":"Fees amount involved in a transaction that affects an overdraft"},"overdraftInterestAmount":{"type":"number","description":"Interest amount involved in a transaction that affects an overdraft"},"technicalOverdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft"},"technicalOverdraftInterestAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft interest"}},"additionalProperties":true};const schema16 = {"type":"object","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MONTHLY_FEE","ARBITRARY"]}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema17 = {"type":"object","description":"Represents the accrued interest amounts for an Interest Applied deposit transaction.","properties":{"interestAccrued":{"type":"number","description":"The amount of positive interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"negativeInterestAccrued":{"type":"number","description":"The amount of negative interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"overdraftInterestAccrued":{"type":"number","description":"The amount of overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"technicalOverdraftInterestAccrued":{"type":"number","description":"The amount of technical overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"}},"additionalProperties":true};const schema32 = {"type":"object","description":"The taxes applied within a transaction","properties":{"taxRate":{"type":"number","description":"The tax rate that was set or changed in this transaction"}},"additionalProperties":true};const schema37 = {"type":"object","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};const schema38 = {"type":"object","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","description":"The key of the related loan transaction"}},"additionalProperties":true};const schema14 = {"type":"object","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true};const schema15 = {"type":"object","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","description":"The city in which the card acceptor has the business."},"country":{"type":"string","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","description":"The name of the card acceptor."},"state":{"type":"string","description":"The state in which the card acceptor has the business."},"street":{"type":"string","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true};function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((((data.advice === undefined) && (missing0 = "advice")) || ((data.amount === undefined) && (missing0 = "amount"))) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.advice !== undefined){const _errs2 = errors;if(typeof data.advice !== "boolean"){validate11.errors = [{instancePath:instancePath+"/advice",schemaPath:"#/properties/advice/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data1 = data.amount;const _errs4 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate11.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.cardAcceptor !== undefined){let data2 = data.cardAcceptor;const _errs6 = errors;const _errs7 = errors;if(errors === _errs7){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.city !== undefined){const _errs10 = errors;if(typeof data2.city !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptor/properties/city/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data2.country !== undefined){const _errs12 = errors;if(typeof data2.country !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptor/properties/country/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data2.mcc !== undefined){let data5 = data2.mcc;const _errs14 = errors;if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptor/properties/mcc/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data2.name !== undefined){const _errs16 = errors;if(typeof data2.name !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptor/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}if(valid2){if(data2.state !== undefined){const _errs18 = errors;if(typeof data2.state !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptor/properties/state/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs18 === errors;}else {var valid2 = true;}if(valid2){if(data2.street !== undefined){const _errs20 = errors;if(typeof data2.street !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptor/properties/street/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}if(valid2){if(data2.zip !== undefined){const _errs22 = errors;if(typeof data2.zip !== "string"){validate11.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptor/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs22 === errors;}else {var valid2 = true;}}}}}}}}else {validate11.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptor/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.cardToken !== undefined){const _errs24 = errors;if(typeof data.cardToken !== "string"){validate11.errors = [{instancePath:instancePath+"/cardToken",schemaPath:"#/properties/cardToken/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs26 = errors;if(typeof data.currencyCode !== "string"){validate11.errors = [{instancePath:instancePath+"/currencyCode",schemaPath:"#/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs28 = errors;if(typeof data.encodedKey !== "string"){validate11.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs28 === errors;}else {var valid0 = true;}if(valid0){if(data.externalAuthorizationReferenceId !== undefined){const _errs30 = errors;if(typeof data.externalAuthorizationReferenceId !== "string"){validate11.errors = [{instancePath:instancePath+"/externalAuthorizationReferenceId",schemaPath:"#/properties/externalAuthorizationReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs30 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs32 = errors;if(typeof data.externalReferenceId !== "string"){validate11.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs32 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs34 = errors;if(typeof data.userTransactionTime !== "string"){validate11.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs34 === errors;}else {var valid0 = true;}}}}}}}}}}}else {validate11.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11.errors = vErrors;return errors === 0;}const schema18 = {"type":"object","description":"The payment information including account identification details","properties":{"creditor":{"$ref":"#/$defs/Party"},"creditorAccount":{"$ref":"#/$defs/AccountDetails"},"creditorAgent":{"$ref":"#/$defs/Agent"},"debtor":{"$ref":"#/$defs/Party"},"debtorAccount":{"$ref":"#/$defs/AccountDetails"},"debtorAgent":{"$ref":"#/$defs/Agent"},"paymentIdentification":{"$ref":"#/$defs/PaymentIdentification"},"paymentTypeInformation":{"$ref":"#/$defs/PaymentTypeInformation"},"remittanceInformation":{"$ref":"#/$defs/RemittanceInformation"}},"additionalProperties":true};const schema19 = {"type":"object","description":"The details of the party for a transaction","properties":{"name":{"type":"string","description":"The name of the party"}},"additionalProperties":true};const schema26 = {"type":"object","description":"The payment identification details","properties":{"endToEndIdentification":{"type":"string","description":"Identifier assigned by the initiating party to the transaction"},"instructionIdentification":{"type":"string","description":"Identifier of a payment instruction"},"transactionIdentification":{"type":"string","description":"Identifier unique for a period assigned by the first initiating party to the transaction"}},"additionalProperties":true};const schema20 = {"type":"object","description":"The account currency and identification","properties":{"currency":{"type":"string","description":"The currency of the account"},"identification":{"$ref":"#/$defs/AccountIdentification"}},"additionalProperties":true};const schema21 = {"type":"object","description":"The account identification details","properties":{"iban":{"type":"string","description":"The account unique identifier"},"other":{"$ref":"#/$defs/OtherAccountIdentification"}},"additionalProperties":true};const schema22 = {"type":"object","description":"Represents other way of identification for the account.","properties":{"identification":{"type":"string","description":"The identification of the payer/payee"},"scheme":{"type":"string","description":"The identification scheme"}},"additionalProperties":true};function validate15(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.iban !== undefined){const _errs2 = errors;if(typeof data.iban !== "string"){validate15.errors = [{instancePath:instancePath+"/iban",schemaPath:"#/properties/iban/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.other !== undefined){let data1 = data.other;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.identification !== undefined){const _errs8 = errors;if(typeof data1.identification !== "string"){validate15.errors = [{instancePath:instancePath+"/other/identification",schemaPath:"#/$defs/OtherAccountIdentification/properties/identification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data1.scheme !== undefined){const _errs10 = errors;if(typeof data1.scheme !== "string"){validate15.errors = [{instancePath:instancePath+"/other/scheme",schemaPath:"#/$defs/OtherAccountIdentification/properties/scheme/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}else {validate15.errors = [{instancePath:instancePath+"/other",schemaPath:"#/$defs/OtherAccountIdentification/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}}}else {validate15.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate15.errors = vErrors;return errors === 0;}function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.currency !== undefined){const _errs2 = errors;if(typeof data.currency !== "string"){validate14.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/properties/currency/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.identification !== undefined){const _errs4 = errors;if(!(validate15(data.identification, {instancePath:instancePath+"/identification",parentData:data,parentDataProperty:"identification",rootData}))){vErrors = vErrors === null ? validate15.errors : vErrors.concat(validate15.errors);errors = vErrors.length;}var valid0 = _errs4 === errors;}else {var valid0 = true;}}}else {validate14.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate14.errors = vErrors;return errors === 0;}const schema23 = {"type":"object","description":"The agent details for a party","properties":{"financialInstitutionIdentification":{"$ref":"#/$defs/FinancialInstitutionIdentification"}},"additionalProperties":true};const schema24 = {"type":"object","description":"The identification of the financial institution","properties":{"bic":{"type":"string","description":"Business identifier code"}},"additionalProperties":true};function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.financialInstitutionIdentification !== undefined){let data0 = data.financialInstitutionIdentification;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.bic !== undefined){if(typeof data0.bic !== "string"){validate18.errors = [{instancePath:instancePath+"/financialInstitutionIdentification/bic",schemaPath:"#/$defs/FinancialInstitutionIdentification/properties/bic/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate18.errors = [{instancePath:instancePath+"/financialInstitutionIdentification",schemaPath:"#/$defs/FinancialInstitutionIdentification/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate18.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate18.errors = vErrors;return errors === 0;}const schema27 = {"type":"object","description":"The information specifying the type of transaction","properties":{"serviceLevel":{"$ref":"#/$defs/ServiceLevel"}},"additionalProperties":true};const schema28 = {"type":"object","description":"The rules under which the transaction should be processed","properties":{"code":{"type":"string","description":"The code for a pre-agreed service or level of service between the parties"}},"additionalProperties":true};function validate22(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.serviceLevel !== undefined){let data0 = data.serviceLevel;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.code !== undefined){if(typeof data0.code !== "string"){validate22.errors = [{instancePath:instancePath+"/serviceLevel/code",schemaPath:"#/$defs/ServiceLevel/properties/code/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate22.errors = [{instancePath:instancePath+"/serviceLevel",schemaPath:"#/$defs/ServiceLevel/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate22.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate22.errors = vErrors;return errors === 0;}const schema29 = {"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"structured":{"$ref":"#/$defs/Structured"},"unstructured":{"type":"string","description":"Information supplied to match the items of the payment in an unstructured form"}},"additionalProperties":true};const schema30 = {"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"creditorReferenceInformation":{"$ref":"#/$defs/CreditorReferenceInformation"}},"additionalProperties":true};const schema31 = {"type":"object","description":"Represents the reference to the underlying documents of the payment.","properties":{"reference":{"type":"string","description":"The reference information of the creditor's underlying documents"},"referenceIssuer":{"type":"string","description":"The entity that assigns the reference type"},"referenceType":{"type":"string","description":"The type of creditor reference"}},"additionalProperties":true};function validate25(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.creditorReferenceInformation !== undefined){let data0 = data.creditorReferenceInformation;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.reference !== undefined){const _errs6 = errors;if(typeof data0.reference !== "string"){validate25.errors = [{instancePath:instancePath+"/creditorReferenceInformation/reference",schemaPath:"#/$defs/CreditorReferenceInformation/properties/reference/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.referenceIssuer !== undefined){const _errs8 = errors;if(typeof data0.referenceIssuer !== "string"){validate25.errors = [{instancePath:instancePath+"/creditorReferenceInformation/referenceIssuer",schemaPath:"#/$defs/CreditorReferenceInformation/properties/referenceIssuer/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.referenceType !== undefined){const _errs10 = errors;if(typeof data0.referenceType !== "string"){validate25.errors = [{instancePath:instancePath+"/creditorReferenceInformation/referenceType",schemaPath:"#/$defs/CreditorReferenceInformation/properties/referenceType/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}else {validate25.errors = [{instancePath:instancePath+"/creditorReferenceInformation",schemaPath:"#/$defs/CreditorReferenceInformation/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate25.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate25.errors = vErrors;return errors === 0;}function validate24(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.structured !== undefined){const _errs2 = errors;if(!(validate25(data.structured, {instancePath:instancePath+"/structured",parentData:data,parentDataProperty:"structured",rootData}))){vErrors = vErrors === null ? validate25.errors : vErrors.concat(validate25.errors);errors = vErrors.length;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.unstructured !== undefined){const _errs3 = errors;if(typeof data.unstructured !== "string"){validate24.errors = [{instancePath:instancePath+"/unstructured",schemaPath:"#/properties/unstructured/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs3 === errors;}else {var valid0 = true;}}}else {validate24.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate24.errors = vErrors;return errors === 0;}function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.creditor !== undefined){let data0 = data.creditor;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.name !== undefined){if(typeof data0.name !== "string"){validate13.errors = [{instancePath:instancePath+"/creditor/name",schemaPath:"#/$defs/Party/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate13.errors = [{instancePath:instancePath+"/creditor",schemaPath:"#/$defs/Party/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.creditorAccount !== undefined){const _errs8 = errors;if(!(validate14(data.creditorAccount, {instancePath:instancePath+"/creditorAccount",parentData:data,parentDataProperty:"creditorAccount",rootData}))){vErrors = vErrors === null ? validate14.errors : vErrors.concat(validate14.errors);errors = vErrors.length;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.creditorAgent !== undefined){const _errs9 = errors;if(!(validate18(data.creditorAgent, {instancePath:instancePath+"/creditorAgent",parentData:data,parentDataProperty:"creditorAgent",rootData}))){vErrors = vErrors === null ? validate18.errors : vErrors.concat(validate18.errors);errors = vErrors.length;}var valid0 = _errs9 === errors;}else {var valid0 = true;}if(valid0){if(data.debtor !== undefined){let data4 = data.debtor;const _errs10 = errors;const _errs11 = errors;if(errors === _errs11){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){if(data4.name !== undefined){if(typeof data4.name !== "string"){validate13.errors = [{instancePath:instancePath+"/debtor/name",schemaPath:"#/$defs/Party/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate13.errors = [{instancePath:instancePath+"/debtor",schemaPath:"#/$defs/Party/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.debtorAccount !== undefined){const _errs16 = errors;if(!(validate14(data.debtorAccount, {instancePath:instancePath+"/debtorAccount",parentData:data,parentDataProperty:"debtorAccount",rootData}))){vErrors = vErrors === null ? validate14.errors : vErrors.concat(validate14.errors);errors = vErrors.length;}var valid0 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.debtorAgent !== undefined){const _errs17 = errors;if(!(validate18(data.debtorAgent, {instancePath:instancePath+"/debtorAgent",parentData:data,parentDataProperty:"debtorAgent",rootData}))){vErrors = vErrors === null ? validate18.errors : vErrors.concat(validate18.errors);errors = vErrors.length;}var valid0 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentIdentification !== undefined){let data8 = data.paymentIdentification;const _errs18 = errors;const _errs19 = errors;if(errors === _errs19){if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.endToEndIdentification !== undefined){const _errs22 = errors;if(typeof data8.endToEndIdentification !== "string"){validate13.errors = [{instancePath:instancePath+"/paymentIdentification/endToEndIdentification",schemaPath:"#/$defs/PaymentIdentification/properties/endToEndIdentification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs22 === errors;}else {var valid6 = true;}if(valid6){if(data8.instructionIdentification !== undefined){const _errs24 = errors;if(typeof data8.instructionIdentification !== "string"){validate13.errors = [{instancePath:instancePath+"/paymentIdentification/instructionIdentification",schemaPath:"#/$defs/PaymentIdentification/properties/instructionIdentification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs24 === errors;}else {var valid6 = true;}if(valid6){if(data8.transactionIdentification !== undefined){const _errs26 = errors;if(typeof data8.transactionIdentification !== "string"){validate13.errors = [{instancePath:instancePath+"/paymentIdentification/transactionIdentification",schemaPath:"#/$defs/PaymentIdentification/properties/transactionIdentification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs26 === errors;}else {var valid6 = true;}}}}else {validate13.errors = [{instancePath:instancePath+"/paymentIdentification",schemaPath:"#/$defs/PaymentIdentification/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentTypeInformation !== undefined){const _errs28 = errors;if(!(validate22(data.paymentTypeInformation, {instancePath:instancePath+"/paymentTypeInformation",parentData:data,parentDataProperty:"paymentTypeInformation",rootData}))){vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors);errors = vErrors.length;}var valid0 = _errs28 === errors;}else {var valid0 = true;}if(valid0){if(data.remittanceInformation !== undefined){const _errs29 = errors;if(!(validate24(data.remittanceInformation, {instancePath:instancePath+"/remittanceInformation",parentData:data,parentDataProperty:"remittanceInformation",rootData}))){vErrors = vErrors === null ? validate24.errors : vErrors.concat(validate24.errors);errors = vErrors.length;}var valid0 = _errs29 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate13.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate13.errors = vErrors;return errors === 0;}const schema33 = {"type":"object","description":"The deposit transaction terms","properties":{"interestSettings":{"$ref":"#/$defs/DepositTransactionInterestSettings"},"overdraftInterestSettings":{"$ref":"#/$defs/DepositOverdraftInterestSettings"},"overdraftSettings":{"$ref":"#/$defs/DepositOverdraftSettings"}},"additionalProperties":true};const schema34 = {"type":"object","description":"The interest settings, holds all the properties regarding interests for the deposit account","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate for the deposit account"}},"additionalProperties":true};const schema35 = {"type":"object","description":"Holds the deposit overdraft interest settings","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate that was set or changed in this transaction. Used on product interest rate changes or interest tier switches"}},"additionalProperties":true};const schema36 = {"type":"object","description":"Holds the deposit overdraft settings for a transaction","properties":{"overdraftLimit":{"type":"number","description":"The overdraft limit that was set or changed in this transaction"}},"additionalProperties":true};function validate29(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.interestSettings !== undefined){let data0 = data.interestSettings;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.indexInterestRate !== undefined){let data1 = data0.indexInterestRate;const _errs6 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate29.errors = [{instancePath:instancePath+"/interestSettings/indexInterestRate",schemaPath:"#/$defs/DepositTransactionInterestSettings/properties/indexInterestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.interestRate !== undefined){let data2 = data0.interestRate;const _errs8 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate29.errors = [{instancePath:instancePath+"/interestSettings/interestRate",schemaPath:"#/$defs/DepositTransactionInterestSettings/properties/interestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}}}else {validate29.errors = [{instancePath:instancePath+"/interestSettings",schemaPath:"#/$defs/DepositTransactionInterestSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.overdraftInterestSettings !== undefined){let data3 = data.overdraftInterestSettings;const _errs10 = errors;const _errs11 = errors;if(errors === _errs11){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){if(data3.indexInterestRate !== undefined){let data4 = data3.indexInterestRate;const _errs14 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate29.errors = [{instancePath:instancePath+"/overdraftInterestSettings/indexInterestRate",schemaPath:"#/$defs/DepositOverdraftInterestSettings/properties/indexInterestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs14 === errors;}else {var valid4 = true;}if(valid4){if(data3.interestRate !== undefined){let data5 = data3.interestRate;const _errs16 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate29.errors = [{instancePath:instancePath+"/overdraftInterestSettings/interestRate",schemaPath:"#/$defs/DepositOverdraftInterestSettings/properties/interestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs16 === errors;}else {var valid4 = true;}}}else {validate29.errors = [{instancePath:instancePath+"/overdraftInterestSettings",schemaPath:"#/$defs/DepositOverdraftInterestSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.overdraftSettings !== undefined){let data6 = data.overdraftSettings;const _errs18 = errors;const _errs19 = errors;if(errors === _errs19){if(data6 && typeof data6 == "object" && !Array.isArray(data6)){if(data6.overdraftLimit !== undefined){let data7 = data6.overdraftLimit;if(!((typeof data7 == "number") && (isFinite(data7)))){validate29.errors = [{instancePath:instancePath+"/overdraftSettings/overdraftLimit",schemaPath:"#/$defs/DepositOverdraftSettings/properties/overdraftLimit/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}}else {validate29.errors = [{instancePath:instancePath+"/overdraftSettings",schemaPath:"#/$defs/DepositOverdraftSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs18 === errors;}else {var valid0 = true;}}}}else {validate29.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate29.errors = vErrors;return errors === 0;}const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountBalances !== undefined){let data0 = data.accountBalances;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.totalBalance !== undefined){let data1 = data0.totalBalance;if(!((typeof data1 == "number") && (isFinite(data1)))){validate10.errors = [{instancePath:instancePath+"/accountBalances/totalBalance",schemaPath:"#/$defs/DepositTransactionBalances/properties/totalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}}else {validate10.errors = [{instancePath:instancePath+"/accountBalances",schemaPath:"#/$defs/DepositTransactionBalances/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.adjustmentTransactionKey !== undefined){const _errs8 = errors;if(typeof data.adjustmentTransactionKey !== "string"){validate10.errors = [{instancePath:instancePath+"/adjustmentTransactionKey",schemaPath:"#/properties/adjustmentTransactionKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.affectedAmounts !== undefined){let data3 = data.affectedAmounts;const _errs10 = errors;const _errs11 = errors;if(errors === _errs11){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){if(data3.feesAmount !== undefined){let data4 = data3.feesAmount;const _errs14 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/feesAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/feesAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs14 === errors;}else {var valid4 = true;}if(valid4){if(data3.fractionAmount !== undefined){let data5 = data3.fractionAmount;const _errs16 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/fractionAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/fractionAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs16 === errors;}else {var valid4 = true;}if(valid4){if(data3.fundsAmount !== undefined){let data6 = data3.fundsAmount;const _errs18 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/fundsAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/fundsAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs18 === errors;}else {var valid4 = true;}if(valid4){if(data3.interestAmount !== undefined){let data7 = data3.interestAmount;const _errs20 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/interestAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/interestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs20 === errors;}else {var valid4 = true;}if(valid4){if(data3.overdraftAmount !== undefined){let data8 = data3.overdraftAmount;const _errs22 = errors;if(!((typeof data8 == "number") && (isFinite(data8)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/overdraftAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/overdraftAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs22 === errors;}else {var valid4 = true;}if(valid4){if(data3.overdraftFeesAmount !== undefined){let data9 = data3.overdraftFeesAmount;const _errs24 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/overdraftFeesAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/overdraftFeesAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs24 === errors;}else {var valid4 = true;}if(valid4){if(data3.overdraftInterestAmount !== undefined){let data10 = data3.overdraftInterestAmount;const _errs26 = errors;if(!((typeof data10 == "number") && (isFinite(data10)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/overdraftInterestAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/overdraftInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs26 === errors;}else {var valid4 = true;}if(valid4){if(data3.technicalOverdraftAmount !== undefined){let data11 = data3.technicalOverdraftAmount;const _errs28 = errors;if(!((typeof data11 == "number") && (isFinite(data11)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/technicalOverdraftAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/technicalOverdraftAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs28 === errors;}else {var valid4 = true;}if(valid4){if(data3.technicalOverdraftInterestAmount !== undefined){let data12 = data3.technicalOverdraftInterestAmount;const _errs30 = errors;if(!((typeof data12 == "number") && (isFinite(data12)))){validate10.errors = [{instancePath:instancePath+"/affectedAmounts/technicalOverdraftInterestAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/technicalOverdraftInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs30 === errors;}else {var valid4 = true;}}}}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/affectedAmounts",schemaPath:"#/$defs/DepositAffectedAmounts/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data13 = data.amount;const _errs32 = errors;if(!((typeof data13 == "number") && (isFinite(data13)))){validate10.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs32 === errors;}else {var valid0 = true;}if(valid0){if(data.blockId !== undefined){const _errs34 = errors;if(typeof data.blockId !== "string"){validate10.errors = [{instancePath:instancePath+"/blockId",schemaPath:"#/properties/blockId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs34 === errors;}else {var valid0 = true;}if(valid0){if(data.bookingDate !== undefined){const _errs36 = errors;if(errors === _errs36){if(errors === _errs36){if(!(typeof data.bookingDate === "string")){validate10.errors = [{instancePath:instancePath+"/bookingDate",schemaPath:"#/properties/bookingDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs36 === errors;}else {var valid0 = true;}if(valid0){if(data.branchKey !== undefined){const _errs38 = errors;if(typeof data.branchKey !== "string"){validate10.errors = [{instancePath:instancePath+"/branchKey",schemaPath:"#/properties/branchKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs38 === errors;}else {var valid0 = true;}if(valid0){if(data.cardTransaction !== undefined){const _errs40 = errors;if(!(validate11(data.cardTransaction, {instancePath:instancePath+"/cardTransaction",parentData:data,parentDataProperty:"cardTransaction",rootData}))){vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors);errors = vErrors.length;}var valid0 = _errs40 === errors;}else {var valid0 = true;}if(valid0){if(data.centreKey !== undefined){const _errs41 = errors;if(typeof data.centreKey !== "string"){validate10.errors = [{instancePath:instancePath+"/centreKey",schemaPath:"#/properties/centreKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs43 = errors;if(errors === _errs43){if(errors === _errs43){if(!(typeof data.creationDate === "string")){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs43 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs45 = errors;if(typeof data.currencyCode !== "string"){validate10.errors = [{instancePath:instancePath+"/currencyCode",schemaPath:"#/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs45 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs47 = errors;if(typeof data.encodedKey !== "string"){validate10.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs47 === errors;}else {var valid0 = true;}if(valid0){if(data.externalId !== undefined){const _errs49 = errors;if(typeof data.externalId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalId",schemaPath:"#/properties/externalId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs49 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data23 = data.fees;const _errs51 = errors;if(errors === _errs51){if(Array.isArray(data23)){var valid5 = true;const len0 = data23.length;for(let i0=0; i0 Promise<[username: string, password: string]>) @@ -31,46 +31,65 @@ export class MambuDocuments { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /documents + * * Create document */ public createDocument({ + body, headers, auth = [['apiKey'], ['basic']], - }: { headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] } = {}): Promise< + }: { body: CreateDocumentRequest; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< | FailureResponse<'102', unknown, 'response:statuscode'> | SuccessResponse<'201', Document> | FailureResponse<'400', ErrorResponse, 'response:statuscode'> | FailureResponse<'401', ErrorResponse, 'response:statuscode'> | FailureResponse<'403', ErrorResponse, 'response:statuscode'> | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { + const _body = this.validateRequestBody(CreateDocumentRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } + + const _form = new FormData() + for (const [key, value] of Object.entries(_body.right as CreateDocumentRequest)) { + if (value instanceof Blob || value instanceof File) { + _form.append(key, value) + } else if (value !== null && value !== undefined) { + _form.append(key, value as string) + } + } return this.awaitResponse( this.buildClient(auth).post('documents', { + body: _form, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -80,10 +99,13 @@ export class MambuDocuments { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /documents/{documentId} + * * Delete document */ public deleteDocumentById({ @@ -98,15 +120,13 @@ export class MambuDocuments { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`documents/${path.documentId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`documents/${path.documentId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -114,10 +134,13 @@ export class MambuDocuments { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /documents/{documentId} + * * Download document */ public downloadDocumentById({ @@ -132,15 +155,13 @@ export class MambuDocuments { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).get(`documents/${path.documentId}`, { - responseType: 'text', - }), + this.buildClient(auth).get(`documents/${path.documentId}`, {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -148,10 +169,13 @@ export class MambuDocuments { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * GET /documents/documentsMetadata + * * Get all documents' metadata */ public getDocumentsByEntityId({ @@ -169,7 +193,7 @@ export class MambuDocuments { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -178,7 +202,6 @@ export class MambuDocuments { this.buildClient(auth).get('documents/documentsMetadata', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetDocumentsByEntityIdResponse, @@ -187,50 +210,70 @@ export class MambuDocuments { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } + public validateRequestBody { left: DefinedError[] } | { right: Body } }, Body>( + parser: Parser, + body: unknown, + ) { + const _body = parser.parse(body) + if ('left' in _body) { + return { + statusCode: undefined, + status: undefined, + headers: undefined, + left: body, + validationErrors: _body.left, + where: 'request:body', + } satisfies FailureResponse + } + return _body + } + public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -238,8 +281,7 @@ export class MambuDocuments { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -247,21 +289,21 @@ export class MambuDocuments { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/documents/rest.type.ts b/src/documents/rest.type.ts index 2a7c4d1..2d40c1f 100644 --- a/src/documents/rest.type.ts +++ b/src/documents/rest.type.ts @@ -6,10 +6,64 @@ import type { DefinedError, ValidateFunction } from 'ajv' +import { validate as CreateDocumentRequestValidator } from './schemas/create-document-request.schema.js' import { validate as DocumentValidator } from './schemas/document.schema.js' import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' import { validate as GetDocumentsByEntityIdResponseValidator } from './schemas/get-documents-by-entity-id-response.schema.js' +export interface CreateDocumentRequest { + /** + * The file to be attached for an entity. + */ + file: string + /** + * The ID or encoded key of the entity that owns the document. The ID or encoded key must belong to the entity indicated by the `entity` parameter. Possible entity types are :`CLIENT`, `GROUP`, `LOAN_PRODUCT`, `SAVINGS_PRODUCT`, `CENTRE`, `BRANCH`, `USER`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `ID_DOCUMENT`, `LINE_OF_CREDIT`, `GL_JOURNAL_ENTRY`. If the entity is `GL_JOURNAL_ENTRY`, the value can also represent the Journal Entry Transaction ID. + */ + id?: string | undefined + /** + * The name (title) of the attached file. + */ + name?: string | undefined + /** + * The description of the attached file. + */ + notes?: string | undefined + /** + * The type of the owner of the document. + */ + ownerType?: + | 'CLIENT' + | 'GROUP' + | 'LOAN_PRODUCT' + | 'SAVINGS_PRODUCT' + | 'CENTRE' + | 'BRANCH' + | 'USER' + | 'LOAN_ACCOUNT' + | 'DEPOSIT_ACCOUNT' + | 'ID_DOCUMENT' + | 'LINE_OF_CREDIT' + | 'GL_JOURNAL_ENTRY' + | undefined +} + +export const CreateDocumentRequest = { + validate: CreateDocumentRequestValidator as ValidateFunction, + get schema() { + return CreateDocumentRequest.validate.schema + }, + get errors() { + return CreateDocumentRequest.validate.errors ?? undefined + }, + is: (o: unknown): o is CreateDocumentRequest => CreateDocumentRequest.validate(o) === true, + parse: (o: unknown): { right: CreateDocumentRequest } | { left: DefinedError[] } => { + if (CreateDocumentRequest.is(o)) { + return { right: o } + } + return { left: (CreateDocumentRequest.errors ?? []) as DefinedError[] } + }, +} as const + /** * Holds information regarding the documents uploaded as attachments */ diff --git a/src/documents/schemas/create-document-request.schema.js b/src/documents/schemas/create-document-request.schema.js new file mode 100644 index 0000000..0953474 --- /dev/null +++ b/src/documents/schemas/create-document-request.schema.js @@ -0,0 +1,9 @@ +/* eslint-disable */ +// @ts-nocheck +/** + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code + */ +import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CreateDocumentRequest","type":"object","properties":{"file":{"type":"string","description":"The file to be attached for an entity."},"id":{"type":"string","description":"The ID or encoded key of the entity that owns the document. The ID or encoded key must belong to the entity indicated by the `entity` parameter. Possible entity types are :`CLIENT`, `GROUP`, `LOAN_PRODUCT`, `SAVINGS_PRODUCT`, `CENTRE`, `BRANCH`, `USER`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `ID_DOCUMENT`, `LINE_OF_CREDIT`, `GL_JOURNAL_ENTRY`. If the entity is `GL_JOURNAL_ENTRY`, the value can also represent the Journal Entry Transaction ID."},"name":{"type":"string","description":"The name (title) of the attached file."},"notes":{"type":"string","description":"The description of the attached file."},"ownerType":{"description":"The type of the owner of the document.","enum":["CLIENT","GROUP","LOAN_PRODUCT","SAVINGS_PRODUCT","CENTRE","BRANCH","USER","LOAN_ACCOUNT","DEPOSIT_ACCOUNT","ID_DOCUMENT","LINE_OF_CREDIT","GL_JOURNAL_ENTRY"]}},"required":["file"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.file === undefined) && (missing0 = "file")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.file !== undefined){const _errs2 = errors;if(typeof data.file !== "string"){validate10.errors = [{instancePath:instancePath+"/file",schemaPath:"#/properties/file/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs4 = errors;if(typeof data.id !== "string"){validate10.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs6 = errors;if(typeof data.name !== "string"){validate10.errors = [{instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs8 = errors;if(typeof data.notes !== "string"){validate10.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.ownerType !== undefined){const _errs10 = errors;let valid1;valid1 = false;for(const v0 of schema11.properties.ownerType.enum){if(func0(data.ownerType, v0)){valid1 = true;break;}}if(!valid1){validate10.errors = [{instancePath:instancePath+"/ownerType",schemaPath:"#/properties/ownerType/enum",keyword:"enum",params:{allowedValues: schema11.properties.ownerType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}}}}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file diff --git a/src/end-of-day-processing-configuration/rest.client.ts b/src/end-of-day-processing-configuration/rest.client.ts index 020af23..faefa6d 100644 --- a/src/end-of-day-processing-configuration/rest.client.ts +++ b/src/end-of-day-processing-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/endofdayprocessing.yaml */ export class MambuEndOfDayProcessingConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuEndOfDayProcessingConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/endofdayprocessing.yaml + * * Get end of day processing configuration */ public get({ @@ -54,22 +58,24 @@ export class MambuEndOfDayProcessingConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/endofdayprocessing.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/endofdayprocessing.yaml + * * Update end of day processing configuration */ public update({ @@ -83,15 +89,13 @@ export class MambuEndOfDayProcessingConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/endofdayprocessing.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/endofdayprocessing.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -99,50 +103,52 @@ export class MambuEndOfDayProcessingConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -150,8 +156,7 @@ export class MambuEndOfDayProcessingConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -159,21 +164,21 @@ export class MambuEndOfDayProcessingConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/exchange-rate/index.ts b/src/exchange-rate/index.ts new file mode 100644 index 0000000..5285525 --- /dev/null +++ b/src/exchange-rate/index.ts @@ -0,0 +1,2 @@ +export { MambuExchangeRate } from './rest.client.js' +export * as exchangeRate from './rest.type.js' diff --git a/src/exchange-rate/rest.client.ts b/src/exchange-rate/rest.client.ts index e1c53a7..6264c6c 100644 --- a/src/exchange-rate/rest.client.ts +++ b/src/exchange-rate/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, ExchangeRate, ExchangeRateInput, GetAllResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, ExchangeRate, ExchangeRateInput, GetAllResponse } from ' * currencies/rates */ export class MambuExchangeRate { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuExchangeRate { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /currencies/{currencyCode}/rates + * * Post exchange rates for a specific currency. */ public create({ @@ -69,7 +73,7 @@ export class MambuExchangeRate { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -81,9 +85,8 @@ export class MambuExchangeRate { return this.awaitResponse( this.buildClient(auth).post(`currencies/${path.currencyCode}/rates`, { - json: body, + json: _body.right as ExchangeRateInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -92,10 +95,13 @@ export class MambuExchangeRate { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /currencies/{currencyCode}/rates + * * Get exchange rates for a specific currency. */ public getAll({ @@ -114,7 +120,7 @@ export class MambuExchangeRate { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -123,7 +129,6 @@ export class MambuExchangeRate { this.buildClient(auth).get(`currencies/${path.currencyCode}/rates`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -131,6 +136,7 @@ export class MambuExchangeRate { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } @@ -155,44 +161,45 @@ export class MambuExchangeRate { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -200,8 +207,7 @@ export class MambuExchangeRate { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -209,21 +215,21 @@ export class MambuExchangeRate { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/funding-sources/rest.client.ts b/src/funding-sources/rest.client.ts index 73afa08..2cfc0c0 100644 --- a/src/funding-sources/rest.client.ts +++ b/src/funding-sources/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, SellFundingSourceAction, SellResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, SellFundingSourceAction, SellResponse } from './rest.typ * fundingsources */ export class MambuFundingSources { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuFundingSources { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /fundingsources/{fundingSourceId}:sell + * * Performs the sell of a funding share owned by an investor. Investors can sell the total share or only a part of the investment. In case of a partial sale, multiple operations can be performed until the entire investment is sold. For the seller, money will be deposited in the funding account, for the buyers money will be withdrawn from provided accounts. */ public sell({ @@ -70,7 +74,7 @@ export class MambuFundingSources { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -82,9 +86,8 @@ export class MambuFundingSources { return this.awaitResponse( this.buildClient(auth).post(`fundingsources/${path.fundingSourceId}:sell`, { - json: body, + json: _body.right as SellFundingSourceAction, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -94,6 +97,7 @@ export class MambuFundingSources { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -118,44 +122,45 @@ export class MambuFundingSources { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -163,8 +168,7 @@ export class MambuFundingSources { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -172,21 +176,21 @@ export class MambuFundingSources { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/funding-sources/rest.type.ts b/src/funding-sources/rest.type.ts index fd56b4c..9708ae5 100644 --- a/src/funding-sources/rest.type.ts +++ b/src/funding-sources/rest.type.ts @@ -302,6 +302,10 @@ export interface DepositTransaction { * The currency in which this transaction was posted */ currencyCode?: string | undefined + /** + * Whether the custom fields of the transaction are archived + */ + customFieldsArchived?: boolean | undefined /** * The encoded key of the deposit transaction, auto generated, unique */ @@ -380,6 +384,7 @@ export interface DepositTransaction { | 'OVERDRAFT_INTEREST_RATE_CHANGED' | 'OVERDRAFT_LIMIT_CHANGED' | 'BRANCH_CHANGED' + | 'ACCOUNT_HOLDER_CHANGED' | 'LOAN_FUNDED' | 'LOAN_FUNDED_ADJUSTMENT' | 'LOAN_REPAID' diff --git a/src/funding-sources/schemas/sell-response.schema.js b/src/funding-sources/schemas/sell-response.schema.js index a2ff40c..7c3fee3 100644 --- a/src/funding-sources/schemas/sell-response.schema.js +++ b/src/funding-sources/schemas/sell-response.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"SellResponse","type":"array","items":{"$ref":"#/$defs/DepositTransaction"},"$defs":{"DepositTransaction":{"type":"object","description":"Represents the action performed on an Deposit Account after which the account's amount changes its value.","properties":{"accountBalances":{"$ref":"#/$defs/DepositTransactionBalances"},"adjustmentTransactionKey":{"type":"string","description":"The key of the deposit transaction where the adjustment for this transaction was made (if any adjustment was involved)"},"affectedAmounts":{"$ref":"#/$defs/DepositAffectedAmounts"},"amount":{"type":"number","description":"How much was added/removed in account"},"blockId":{"type":"string","description":"The block fund id associated with the transaction"},"bookingDate":{"type":"string","description":"The date when corresponding JE is booked (as Organization Time)","format":"date-time"},"branchKey":{"type":"string","description":"The branch where the transaction was performed"},"cardTransaction":{"$ref":"#/$defs/CardTransaction"},"centreKey":{"type":"string","description":"The center where the transaction was performed"},"creationDate":{"type":"string","description":"The date when this deposit transaction was created","format":"date-time"},"currencyCode":{"type":"string","description":"The currency in which this transaction was posted"},"encodedKey":{"type":"string","description":"The encoded key of the deposit transaction, auto generated, unique"},"externalId":{"type":"string","description":"The external id of the deposit transaction, customizable, unique"},"fees":{"type":"array","description":"All the amounts that have been applied or paid within this transaction and involved predefined fees","items":{"$ref":"#/$defs/DepositFee"}},"holdExternalReferenceId":{"type":"string","description":"The external id of an account authorization hold"},"id":{"type":"string","description":"The id of the deposit transaction, auto generated, unique"},"interestAccruedAmounts":{"$ref":"#/$defs/DepositInterestAccruedAmounts"},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this deposit account. If this account was imported, track which 'migration event' they came from"},"notes":{"type":"string","description":"Extra notes about this deposit transaction"},"originalTransactionKey":{"type":"string","description":"The encodedKey of the transaction that was adjusted as part of this one. Available only for adjustment transactions"},"parentAccountKey":{"type":"string","description":"The key of the parent deposit account"},"paymentDetails":{"$ref":"#/$defs/PaymentDetails"},"paymentOrderId":{"type":"string","description":"The payment order id of the deposit transaction, customizable"},"taxes":{"$ref":"#/$defs/DepositTaxes"},"terms":{"$ref":"#/$defs/DepositTerms"},"tillKey":{"type":"string","description":"The till key associated with this transaction"},"transactionDetails":{"$ref":"#/$defs/TransactionDetails"},"transferDetails":{"$ref":"#/$defs/TransferDetails"},"type":{"description":"The type of the deposit transaction","enum":["IMPORT","WRITE_OFF","WRITE_OFF_ADJUSTMENT","DEPOSIT","ADJUSTMENT","WITHDRAWAL","WITHDRAWAL_ADJUSTMENT","CARD_TRANSACTION_REVERSAL","CARD_TRANSACTION_REVERSAL_ADJUSTMENT","TRANSFER","TRANSFER_ADJUSTMENT","FEE_APPLIED","FEE_ADJUSTED","FEES_DUE_REDUCED","INTEREST_APPLIED","INTEREST_APPLIED_ADJUSTMENT","NET_DIFF_INTEREST","FEE_REDUCTION_ADJUSTMENT","WITHHOLDING_TAX","WITHHOLDING_TAX_ADJUSTMENT","INTEREST_RATE_CHANGED","OVERDRAFT_INTEREST_RATE_CHANGED","OVERDRAFT_LIMIT_CHANGED","BRANCH_CHANGED","LOAN_FUNDED","LOAN_FUNDED_ADJUSTMENT","LOAN_REPAID","LOAN_REPAID_ADJUSTMENT","LOAN_FRACTION_BOUGHT","LOAN_FRACTION_BOUGHT_ADJUSTMENT","LOAN_FRACTION_SOLD","LOAN_FRACTION_SOLD_ADJUSTMENT","SEIZED_AMOUNT"]},"userKey":{"type":"string","description":"The person that performed the transaction"},"valueDate":{"type":"string","description":"Date of the entry (eg date of repayment or disbursal, etc.) (as Organization Time)","format":"date-time"}},"additionalProperties":true},"DepositTransactionBalances":{"type":"object","description":"The balances changed within a transaction.","properties":{"totalBalance":{"type":"number","description":"The running balance owed by deposit"}},"additionalProperties":true},"DepositAffectedAmounts":{"type":"object","description":"The amounts affected after completing the deposit transaction","properties":{"feesAmount":{"type":"number","description":"Amount of fees involved in a transaction that affects an account with positive balance"},"fractionAmount":{"type":"number","description":"In the case of an LOAN_FRACTION_BOUGHT this represent the fraction amount which was bought from another investor"},"fundsAmount":{"type":"number","description":"Balance change amount involved in a transaction that affects an account with positive balance"},"interestAmount":{"type":"number","description":"Amount of interest involved in a transaction that affects an account with positive balance"},"overdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as overdraft"},"overdraftFeesAmount":{"type":"number","description":"Fees amount involved in a transaction that affects an overdraft"},"overdraftInterestAmount":{"type":"number","description":"Interest amount involved in a transaction that affects an overdraft"},"technicalOverdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft"},"technicalOverdraftInterestAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft interest"}},"additionalProperties":true},"CardTransaction":{"type":"object","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true},"CardAcceptor":{"type":"object","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","description":"The city in which the card acceptor has the business."},"country":{"type":"string","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","description":"The name of the card acceptor."},"state":{"type":"string","description":"The state in which the card acceptor has the business."},"street":{"type":"string","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true},"DepositFee":{"type":"object","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MONTHLY_FEE","ARBITRARY"]}},"required":["predefinedFeeKey"],"additionalProperties":true},"DepositInterestAccruedAmounts":{"type":"object","description":"Represents the accrued interest amounts for an Interest Applied deposit transaction.","properties":{"interestAccrued":{"type":"number","description":"The amount of positive interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"negativeInterestAccrued":{"type":"number","description":"The amount of negative interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"overdraftInterestAccrued":{"type":"number","description":"The amount of overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"technicalOverdraftInterestAccrued":{"type":"number","description":"The amount of technical overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"}},"additionalProperties":true},"PaymentDetails":{"type":"object","description":"The payment information including account identification details","properties":{"creditor":{"$ref":"#/$defs/Party"},"creditorAccount":{"$ref":"#/$defs/AccountDetails"},"creditorAgent":{"$ref":"#/$defs/Agent"},"debtor":{"$ref":"#/$defs/Party"},"debtorAccount":{"$ref":"#/$defs/AccountDetails"},"debtorAgent":{"$ref":"#/$defs/Agent"},"paymentIdentification":{"$ref":"#/$defs/PaymentIdentification"},"paymentTypeInformation":{"$ref":"#/$defs/PaymentTypeInformation"},"remittanceInformation":{"$ref":"#/$defs/RemittanceInformation"}},"additionalProperties":true},"Party":{"type":"object","description":"The details of the party for a transaction","properties":{"name":{"type":"string","description":"The name of the party"}},"additionalProperties":true},"AccountDetails":{"type":"object","description":"The account currency and identification","properties":{"currency":{"type":"string","description":"The currency of the account"},"identification":{"$ref":"#/$defs/AccountIdentification"}},"additionalProperties":true},"AccountIdentification":{"type":"object","description":"The account identification details","properties":{"iban":{"type":"string","description":"The account unique identifier"},"other":{"$ref":"#/$defs/OtherAccountIdentification"}},"additionalProperties":true},"OtherAccountIdentification":{"type":"object","description":"Represents other way of identification for the account.","properties":{"identification":{"type":"string","description":"The identification of the payer/payee"},"scheme":{"type":"string","description":"The identification scheme"}},"additionalProperties":true},"Agent":{"type":"object","description":"The agent details for a party","properties":{"financialInstitutionIdentification":{"$ref":"#/$defs/FinancialInstitutionIdentification"}},"additionalProperties":true},"FinancialInstitutionIdentification":{"type":"object","description":"The identification of the financial institution","properties":{"bic":{"type":"string","description":"Business identifier code"}},"additionalProperties":true},"PaymentIdentification":{"type":"object","description":"The payment identification details","properties":{"endToEndIdentification":{"type":"string","description":"Identifier assigned by the initiating party to the transaction"},"instructionIdentification":{"type":"string","description":"Identifier of a payment instruction"},"transactionIdentification":{"type":"string","description":"Identifier unique for a period assigned by the first initiating party to the transaction"}},"additionalProperties":true},"PaymentTypeInformation":{"type":"object","description":"The information specifying the type of transaction","properties":{"serviceLevel":{"$ref":"#/$defs/ServiceLevel"}},"additionalProperties":true},"ServiceLevel":{"type":"object","description":"The rules under which the transaction should be processed","properties":{"code":{"type":"string","description":"The code for a pre-agreed service or level of service between the parties"}},"additionalProperties":true},"RemittanceInformation":{"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"structured":{"$ref":"#/$defs/Structured"},"unstructured":{"type":"string","description":"Information supplied to match the items of the payment in an unstructured form"}},"additionalProperties":true},"Structured":{"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"creditorReferenceInformation":{"$ref":"#/$defs/CreditorReferenceInformation"}},"additionalProperties":true},"CreditorReferenceInformation":{"type":"object","description":"Represents the reference to the underlying documents of the payment.","properties":{"reference":{"type":"string","description":"The reference information of the creditor's underlying documents"},"referenceIssuer":{"type":"string","description":"The entity that assigns the reference type"},"referenceType":{"type":"string","description":"The type of creditor reference"}},"additionalProperties":true},"DepositTaxes":{"type":"object","description":"The taxes applied within a transaction","properties":{"taxRate":{"type":"number","description":"The tax rate that was set or changed in this transaction"}},"additionalProperties":true},"DepositTerms":{"type":"object","description":"The deposit transaction terms","properties":{"interestSettings":{"$ref":"#/$defs/DepositTransactionInterestSettings"},"overdraftInterestSettings":{"$ref":"#/$defs/DepositOverdraftInterestSettings"},"overdraftSettings":{"$ref":"#/$defs/DepositOverdraftSettings"}},"additionalProperties":true},"DepositTransactionInterestSettings":{"type":"object","description":"The interest settings, holds all the properties regarding interests for the deposit account","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate for the deposit account"}},"additionalProperties":true},"DepositOverdraftInterestSettings":{"type":"object","description":"Holds the deposit overdraft interest settings","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate that was set or changed in this transaction. Used on product interest rate changes or interest tier switches"}},"additionalProperties":true},"DepositOverdraftSettings":{"type":"object","description":"Holds the deposit overdraft settings for a transaction","properties":{"overdraftLimit":{"type":"number","description":"The overdraft limit that was set or changed in this transaction"}},"additionalProperties":true},"TransactionDetails":{"type":"object","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true},"TransferDetails":{"type":"object","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","description":"The key of the related loan transaction"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents the action performed on an Deposit Account after which the account's amount changes its value.","properties":{"accountBalances":{"$ref":"#/$defs/DepositTransactionBalances"},"adjustmentTransactionKey":{"type":"string","description":"The key of the deposit transaction where the adjustment for this transaction was made (if any adjustment was involved)"},"affectedAmounts":{"$ref":"#/$defs/DepositAffectedAmounts"},"amount":{"type":"number","description":"How much was added/removed in account"},"blockId":{"type":"string","description":"The block fund id associated with the transaction"},"bookingDate":{"type":"string","description":"The date when corresponding JE is booked (as Organization Time)","format":"date-time"},"branchKey":{"type":"string","description":"The branch where the transaction was performed"},"cardTransaction":{"$ref":"#/$defs/CardTransaction"},"centreKey":{"type":"string","description":"The center where the transaction was performed"},"creationDate":{"type":"string","description":"The date when this deposit transaction was created","format":"date-time"},"currencyCode":{"type":"string","description":"The currency in which this transaction was posted"},"encodedKey":{"type":"string","description":"The encoded key of the deposit transaction, auto generated, unique"},"externalId":{"type":"string","description":"The external id of the deposit transaction, customizable, unique"},"fees":{"type":"array","description":"All the amounts that have been applied or paid within this transaction and involved predefined fees","items":{"$ref":"#/$defs/DepositFee"}},"holdExternalReferenceId":{"type":"string","description":"The external id of an account authorization hold"},"id":{"type":"string","description":"The id of the deposit transaction, auto generated, unique"},"interestAccruedAmounts":{"$ref":"#/$defs/DepositInterestAccruedAmounts"},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this deposit account. If this account was imported, track which 'migration event' they came from"},"notes":{"type":"string","description":"Extra notes about this deposit transaction"},"originalTransactionKey":{"type":"string","description":"The encodedKey of the transaction that was adjusted as part of this one. Available only for adjustment transactions"},"parentAccountKey":{"type":"string","description":"The key of the parent deposit account"},"paymentDetails":{"$ref":"#/$defs/PaymentDetails"},"paymentOrderId":{"type":"string","description":"The payment order id of the deposit transaction, customizable"},"taxes":{"$ref":"#/$defs/DepositTaxes"},"terms":{"$ref":"#/$defs/DepositTerms"},"tillKey":{"type":"string","description":"The till key associated with this transaction"},"transactionDetails":{"$ref":"#/$defs/TransactionDetails"},"transferDetails":{"$ref":"#/$defs/TransferDetails"},"type":{"description":"The type of the deposit transaction","enum":["IMPORT","WRITE_OFF","WRITE_OFF_ADJUSTMENT","DEPOSIT","ADJUSTMENT","WITHDRAWAL","WITHDRAWAL_ADJUSTMENT","CARD_TRANSACTION_REVERSAL","CARD_TRANSACTION_REVERSAL_ADJUSTMENT","TRANSFER","TRANSFER_ADJUSTMENT","FEE_APPLIED","FEE_ADJUSTED","FEES_DUE_REDUCED","INTEREST_APPLIED","INTEREST_APPLIED_ADJUSTMENT","NET_DIFF_INTEREST","FEE_REDUCTION_ADJUSTMENT","WITHHOLDING_TAX","WITHHOLDING_TAX_ADJUSTMENT","INTEREST_RATE_CHANGED","OVERDRAFT_INTEREST_RATE_CHANGED","OVERDRAFT_LIMIT_CHANGED","BRANCH_CHANGED","LOAN_FUNDED","LOAN_FUNDED_ADJUSTMENT","LOAN_REPAID","LOAN_REPAID_ADJUSTMENT","LOAN_FRACTION_BOUGHT","LOAN_FRACTION_BOUGHT_ADJUSTMENT","LOAN_FRACTION_SOLD","LOAN_FRACTION_SOLD_ADJUSTMENT","SEIZED_AMOUNT"]},"userKey":{"type":"string","description":"The person that performed the transaction"},"valueDate":{"type":"string","description":"Date of the entry (eg date of repayment or disbursal, etc.) (as Organization Time)","format":"date-time"}},"additionalProperties":true};const schema13 = {"type":"object","description":"The balances changed within a transaction.","properties":{"totalBalance":{"type":"number","description":"The running balance owed by deposit"}},"additionalProperties":true};const schema14 = {"type":"object","description":"The amounts affected after completing the deposit transaction","properties":{"feesAmount":{"type":"number","description":"Amount of fees involved in a transaction that affects an account with positive balance"},"fractionAmount":{"type":"number","description":"In the case of an LOAN_FRACTION_BOUGHT this represent the fraction amount which was bought from another investor"},"fundsAmount":{"type":"number","description":"Balance change amount involved in a transaction that affects an account with positive balance"},"interestAmount":{"type":"number","description":"Amount of interest involved in a transaction that affects an account with positive balance"},"overdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as overdraft"},"overdraftFeesAmount":{"type":"number","description":"Fees amount involved in a transaction that affects an overdraft"},"overdraftInterestAmount":{"type":"number","description":"Interest amount involved in a transaction that affects an overdraft"},"technicalOverdraftAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft"},"technicalOverdraftInterestAmount":{"type":"number","description":"The amount of money that was added/subtracted from the account by this transaction as technical overdraft interest"}},"additionalProperties":true};const schema17 = {"type":"object","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MONTHLY_FEE","ARBITRARY"]}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema18 = {"type":"object","description":"Represents the accrued interest amounts for an Interest Applied deposit transaction.","properties":{"interestAccrued":{"type":"number","description":"The amount of positive interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"negativeInterestAccrued":{"type":"number","description":"The amount of negative interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"overdraftInterestAccrued":{"type":"number","description":"The amount of overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"},"technicalOverdraftInterestAccrued":{"type":"number","description":"The amount of technical overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction"}},"additionalProperties":true};const schema33 = {"type":"object","description":"The taxes applied within a transaction","properties":{"taxRate":{"type":"number","description":"The tax rate that was set or changed in this transaction"}},"additionalProperties":true};const schema38 = {"type":"object","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};const schema39 = {"type":"object","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","description":"The key of the related loan transaction"}},"additionalProperties":true};const schema15 = {"type":"object","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true};const schema16 = {"type":"object","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","description":"The city in which the card acceptor has the business."},"country":{"type":"string","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","description":"The name of the card acceptor."},"state":{"type":"string","description":"The state in which the card acceptor has the business."},"street":{"type":"string","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((((data.advice === undefined) && (missing0 = "advice")) || ((data.amount === undefined) && (missing0 = "amount"))) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.advice !== undefined){const _errs2 = errors;if(typeof data.advice !== "boolean"){validate12.errors = [{instancePath:instancePath+"/advice",schemaPath:"#/properties/advice/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data1 = data.amount;const _errs4 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.cardAcceptor !== undefined){let data2 = data.cardAcceptor;const _errs6 = errors;const _errs7 = errors;if(errors === _errs7){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.city !== undefined){const _errs10 = errors;if(typeof data2.city !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptor/properties/city/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data2.country !== undefined){const _errs12 = errors;if(typeof data2.country !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptor/properties/country/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data2.mcc !== undefined){let data5 = data2.mcc;const _errs14 = errors;if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptor/properties/mcc/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data2.name !== undefined){const _errs16 = errors;if(typeof data2.name !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptor/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}if(valid2){if(data2.state !== undefined){const _errs18 = errors;if(typeof data2.state !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptor/properties/state/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs18 === errors;}else {var valid2 = true;}if(valid2){if(data2.street !== undefined){const _errs20 = errors;if(typeof data2.street !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptor/properties/street/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}if(valid2){if(data2.zip !== undefined){const _errs22 = errors;if(typeof data2.zip !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptor/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs22 === errors;}else {var valid2 = true;}}}}}}}}else {validate12.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptor/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.cardToken !== undefined){const _errs24 = errors;if(typeof data.cardToken !== "string"){validate12.errors = [{instancePath:instancePath+"/cardToken",schemaPath:"#/properties/cardToken/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs26 = errors;if(typeof data.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/currencyCode",schemaPath:"#/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs28 = errors;if(typeof data.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs28 === errors;}else {var valid0 = true;}if(valid0){if(data.externalAuthorizationReferenceId !== undefined){const _errs30 = errors;if(typeof data.externalAuthorizationReferenceId !== "string"){validate12.errors = [{instancePath:instancePath+"/externalAuthorizationReferenceId",schemaPath:"#/properties/externalAuthorizationReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs30 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs32 = errors;if(typeof data.externalReferenceId !== "string"){validate12.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs32 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs34 = errors;if(typeof data.userTransactionTime !== "string"){validate12.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs34 === errors;}else {var valid0 = true;}}}}}}}}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}const schema19 = {"type":"object","description":"The payment information including account identification details","properties":{"creditor":{"$ref":"#/$defs/Party"},"creditorAccount":{"$ref":"#/$defs/AccountDetails"},"creditorAgent":{"$ref":"#/$defs/Agent"},"debtor":{"$ref":"#/$defs/Party"},"debtorAccount":{"$ref":"#/$defs/AccountDetails"},"debtorAgent":{"$ref":"#/$defs/Agent"},"paymentIdentification":{"$ref":"#/$defs/PaymentIdentification"},"paymentTypeInformation":{"$ref":"#/$defs/PaymentTypeInformation"},"remittanceInformation":{"$ref":"#/$defs/RemittanceInformation"}},"additionalProperties":true};const schema20 = {"type":"object","description":"The details of the party for a transaction","properties":{"name":{"type":"string","description":"The name of the party"}},"additionalProperties":true};const schema27 = {"type":"object","description":"The payment identification details","properties":{"endToEndIdentification":{"type":"string","description":"Identifier assigned by the initiating party to the transaction"},"instructionIdentification":{"type":"string","description":"Identifier of a payment instruction"},"transactionIdentification":{"type":"string","description":"Identifier unique for a period assigned by the first initiating party to the transaction"}},"additionalProperties":true};const schema21 = {"type":"object","description":"The account currency and identification","properties":{"currency":{"type":"string","description":"The currency of the account"},"identification":{"$ref":"#/$defs/AccountIdentification"}},"additionalProperties":true};const schema22 = {"type":"object","description":"The account identification details","properties":{"iban":{"type":"string","description":"The account unique identifier"},"other":{"$ref":"#/$defs/OtherAccountIdentification"}},"additionalProperties":true};const schema23 = {"type":"object","description":"Represents other way of identification for the account.","properties":{"identification":{"type":"string","description":"The identification of the payer/payee"},"scheme":{"type":"string","description":"The identification scheme"}},"additionalProperties":true};function validate16(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.iban !== undefined){const _errs2 = errors;if(typeof data.iban !== "string"){validate16.errors = [{instancePath:instancePath+"/iban",schemaPath:"#/properties/iban/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.other !== undefined){let data1 = data.other;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.identification !== undefined){const _errs8 = errors;if(typeof data1.identification !== "string"){validate16.errors = [{instancePath:instancePath+"/other/identification",schemaPath:"#/$defs/OtherAccountIdentification/properties/identification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data1.scheme !== undefined){const _errs10 = errors;if(typeof data1.scheme !== "string"){validate16.errors = [{instancePath:instancePath+"/other/scheme",schemaPath:"#/$defs/OtherAccountIdentification/properties/scheme/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}else {validate16.errors = [{instancePath:instancePath+"/other",schemaPath:"#/$defs/OtherAccountIdentification/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}}}else {validate16.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate16.errors = vErrors;return errors === 0;}function validate15(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.currency !== undefined){const _errs2 = errors;if(typeof data.currency !== "string"){validate15.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/properties/currency/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.identification !== undefined){const _errs4 = errors;if(!(validate16(data.identification, {instancePath:instancePath+"/identification",parentData:data,parentDataProperty:"identification",rootData}))){vErrors = vErrors === null ? validate16.errors : vErrors.concat(validate16.errors);errors = vErrors.length;}var valid0 = _errs4 === errors;}else {var valid0 = true;}}}else {validate15.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate15.errors = vErrors;return errors === 0;}const schema24 = {"type":"object","description":"The agent details for a party","properties":{"financialInstitutionIdentification":{"$ref":"#/$defs/FinancialInstitutionIdentification"}},"additionalProperties":true};const schema25 = {"type":"object","description":"The identification of the financial institution","properties":{"bic":{"type":"string","description":"Business identifier code"}},"additionalProperties":true};function validate19(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.financialInstitutionIdentification !== undefined){let data0 = data.financialInstitutionIdentification;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.bic !== undefined){if(typeof data0.bic !== "string"){validate19.errors = [{instancePath:instancePath+"/financialInstitutionIdentification/bic",schemaPath:"#/$defs/FinancialInstitutionIdentification/properties/bic/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate19.errors = [{instancePath:instancePath+"/financialInstitutionIdentification",schemaPath:"#/$defs/FinancialInstitutionIdentification/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate19.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate19.errors = vErrors;return errors === 0;}const schema28 = {"type":"object","description":"The information specifying the type of transaction","properties":{"serviceLevel":{"$ref":"#/$defs/ServiceLevel"}},"additionalProperties":true};const schema29 = {"type":"object","description":"The rules under which the transaction should be processed","properties":{"code":{"type":"string","description":"The code for a pre-agreed service or level of service between the parties"}},"additionalProperties":true};function validate23(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.serviceLevel !== undefined){let data0 = data.serviceLevel;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.code !== undefined){if(typeof data0.code !== "string"){validate23.errors = [{instancePath:instancePath+"/serviceLevel/code",schemaPath:"#/$defs/ServiceLevel/properties/code/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate23.errors = [{instancePath:instancePath+"/serviceLevel",schemaPath:"#/$defs/ServiceLevel/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate23.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate23.errors = vErrors;return errors === 0;}const schema30 = {"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"structured":{"$ref":"#/$defs/Structured"},"unstructured":{"type":"string","description":"Information supplied to match the items of the payment in an unstructured form"}},"additionalProperties":true};const schema31 = {"type":"object","description":"The information specifying the payment items that are intended to settle","properties":{"creditorReferenceInformation":{"$ref":"#/$defs/CreditorReferenceInformation"}},"additionalProperties":true};const schema32 = {"type":"object","description":"Represents the reference to the underlying documents of the payment.","properties":{"reference":{"type":"string","description":"The reference information of the creditor's underlying documents"},"referenceIssuer":{"type":"string","description":"The entity that assigns the reference type"},"referenceType":{"type":"string","description":"The type of creditor reference"}},"additionalProperties":true};function validate26(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.creditorReferenceInformation !== undefined){let data0 = data.creditorReferenceInformation;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.reference !== undefined){const _errs6 = errors;if(typeof data0.reference !== "string"){validate26.errors = [{instancePath:instancePath+"/creditorReferenceInformation/reference",schemaPath:"#/$defs/CreditorReferenceInformation/properties/reference/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.referenceIssuer !== undefined){const _errs8 = errors;if(typeof data0.referenceIssuer !== "string"){validate26.errors = [{instancePath:instancePath+"/creditorReferenceInformation/referenceIssuer",schemaPath:"#/$defs/CreditorReferenceInformation/properties/referenceIssuer/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.referenceType !== undefined){const _errs10 = errors;if(typeof data0.referenceType !== "string"){validate26.errors = [{instancePath:instancePath+"/creditorReferenceInformation/referenceType",schemaPath:"#/$defs/CreditorReferenceInformation/properties/referenceType/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}else {validate26.errors = [{instancePath:instancePath+"/creditorReferenceInformation",schemaPath:"#/$defs/CreditorReferenceInformation/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate26.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate26.errors = vErrors;return errors === 0;}function validate25(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.structured !== undefined){const _errs2 = errors;if(!(validate26(data.structured, {instancePath:instancePath+"/structured",parentData:data,parentDataProperty:"structured",rootData}))){vErrors = vErrors === null ? validate26.errors : vErrors.concat(validate26.errors);errors = vErrors.length;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.unstructured !== undefined){const _errs3 = errors;if(typeof data.unstructured !== "string"){validate25.errors = [{instancePath:instancePath+"/unstructured",schemaPath:"#/properties/unstructured/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs3 === errors;}else {var valid0 = true;}}}else {validate25.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate25.errors = vErrors;return errors === 0;}function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.creditor !== undefined){let data0 = data.creditor;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.name !== undefined){if(typeof data0.name !== "string"){validate14.errors = [{instancePath:instancePath+"/creditor/name",schemaPath:"#/$defs/Party/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate14.errors = [{instancePath:instancePath+"/creditor",schemaPath:"#/$defs/Party/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.creditorAccount !== undefined){const _errs8 = errors;if(!(validate15(data.creditorAccount, {instancePath:instancePath+"/creditorAccount",parentData:data,parentDataProperty:"creditorAccount",rootData}))){vErrors = vErrors === null ? validate15.errors : vErrors.concat(validate15.errors);errors = vErrors.length;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.creditorAgent !== undefined){const _errs9 = errors;if(!(validate19(data.creditorAgent, {instancePath:instancePath+"/creditorAgent",parentData:data,parentDataProperty:"creditorAgent",rootData}))){vErrors = vErrors === null ? validate19.errors : vErrors.concat(validate19.errors);errors = vErrors.length;}var valid0 = _errs9 === errors;}else {var valid0 = true;}if(valid0){if(data.debtor !== undefined){let data4 = data.debtor;const _errs10 = errors;const _errs11 = errors;if(errors === _errs11){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){if(data4.name !== undefined){if(typeof data4.name !== "string"){validate14.errors = [{instancePath:instancePath+"/debtor/name",schemaPath:"#/$defs/Party/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate14.errors = [{instancePath:instancePath+"/debtor",schemaPath:"#/$defs/Party/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.debtorAccount !== undefined){const _errs16 = errors;if(!(validate15(data.debtorAccount, {instancePath:instancePath+"/debtorAccount",parentData:data,parentDataProperty:"debtorAccount",rootData}))){vErrors = vErrors === null ? validate15.errors : vErrors.concat(validate15.errors);errors = vErrors.length;}var valid0 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.debtorAgent !== undefined){const _errs17 = errors;if(!(validate19(data.debtorAgent, {instancePath:instancePath+"/debtorAgent",parentData:data,parentDataProperty:"debtorAgent",rootData}))){vErrors = vErrors === null ? validate19.errors : vErrors.concat(validate19.errors);errors = vErrors.length;}var valid0 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentIdentification !== undefined){let data8 = data.paymentIdentification;const _errs18 = errors;const _errs19 = errors;if(errors === _errs19){if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.endToEndIdentification !== undefined){const _errs22 = errors;if(typeof data8.endToEndIdentification !== "string"){validate14.errors = [{instancePath:instancePath+"/paymentIdentification/endToEndIdentification",schemaPath:"#/$defs/PaymentIdentification/properties/endToEndIdentification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs22 === errors;}else {var valid6 = true;}if(valid6){if(data8.instructionIdentification !== undefined){const _errs24 = errors;if(typeof data8.instructionIdentification !== "string"){validate14.errors = [{instancePath:instancePath+"/paymentIdentification/instructionIdentification",schemaPath:"#/$defs/PaymentIdentification/properties/instructionIdentification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs24 === errors;}else {var valid6 = true;}if(valid6){if(data8.transactionIdentification !== undefined){const _errs26 = errors;if(typeof data8.transactionIdentification !== "string"){validate14.errors = [{instancePath:instancePath+"/paymentIdentification/transactionIdentification",schemaPath:"#/$defs/PaymentIdentification/properties/transactionIdentification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs26 === errors;}else {var valid6 = true;}}}}else {validate14.errors = [{instancePath:instancePath+"/paymentIdentification",schemaPath:"#/$defs/PaymentIdentification/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentTypeInformation !== undefined){const _errs28 = errors;if(!(validate23(data.paymentTypeInformation, {instancePath:instancePath+"/paymentTypeInformation",parentData:data,parentDataProperty:"paymentTypeInformation",rootData}))){vErrors = vErrors === null ? validate23.errors : vErrors.concat(validate23.errors);errors = vErrors.length;}var valid0 = _errs28 === errors;}else {var valid0 = true;}if(valid0){if(data.remittanceInformation !== undefined){const _errs29 = errors;if(!(validate25(data.remittanceInformation, {instancePath:instancePath+"/remittanceInformation",parentData:data,parentDataProperty:"remittanceInformation",rootData}))){vErrors = vErrors === null ? validate25.errors : vErrors.concat(validate25.errors);errors = vErrors.length;}var valid0 = _errs29 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate14.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate14.errors = vErrors;return errors === 0;}const schema34 = {"type":"object","description":"The deposit transaction terms","properties":{"interestSettings":{"$ref":"#/$defs/DepositTransactionInterestSettings"},"overdraftInterestSettings":{"$ref":"#/$defs/DepositOverdraftInterestSettings"},"overdraftSettings":{"$ref":"#/$defs/DepositOverdraftSettings"}},"additionalProperties":true};const schema35 = {"type":"object","description":"The interest settings, holds all the properties regarding interests for the deposit account","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate for the deposit account"}},"additionalProperties":true};const schema36 = {"type":"object","description":"Holds the deposit overdraft interest settings","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate set or changed in this transaction"},"interestRate":{"type":"number","description":"The interest rate that was set or changed in this transaction. Used on product interest rate changes or interest tier switches"}},"additionalProperties":true};const schema37 = {"type":"object","description":"Holds the deposit overdraft settings for a transaction","properties":{"overdraftLimit":{"type":"number","description":"The overdraft limit that was set or changed in this transaction"}},"additionalProperties":true};function validate30(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.interestSettings !== undefined){let data0 = data.interestSettings;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.indexInterestRate !== undefined){let data1 = data0.indexInterestRate;const _errs6 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate30.errors = [{instancePath:instancePath+"/interestSettings/indexInterestRate",schemaPath:"#/$defs/DepositTransactionInterestSettings/properties/indexInterestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.interestRate !== undefined){let data2 = data0.interestRate;const _errs8 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate30.errors = [{instancePath:instancePath+"/interestSettings/interestRate",schemaPath:"#/$defs/DepositTransactionInterestSettings/properties/interestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}}}else {validate30.errors = [{instancePath:instancePath+"/interestSettings",schemaPath:"#/$defs/DepositTransactionInterestSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.overdraftInterestSettings !== undefined){let data3 = data.overdraftInterestSettings;const _errs10 = errors;const _errs11 = errors;if(errors === _errs11){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){if(data3.indexInterestRate !== undefined){let data4 = data3.indexInterestRate;const _errs14 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate30.errors = [{instancePath:instancePath+"/overdraftInterestSettings/indexInterestRate",schemaPath:"#/$defs/DepositOverdraftInterestSettings/properties/indexInterestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs14 === errors;}else {var valid4 = true;}if(valid4){if(data3.interestRate !== undefined){let data5 = data3.interestRate;const _errs16 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate30.errors = [{instancePath:instancePath+"/overdraftInterestSettings/interestRate",schemaPath:"#/$defs/DepositOverdraftInterestSettings/properties/interestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs16 === errors;}else {var valid4 = true;}}}else {validate30.errors = [{instancePath:instancePath+"/overdraftInterestSettings",schemaPath:"#/$defs/DepositOverdraftInterestSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.overdraftSettings !== undefined){let data6 = data.overdraftSettings;const _errs18 = errors;const _errs19 = errors;if(errors === _errs19){if(data6 && typeof data6 == "object" && !Array.isArray(data6)){if(data6.overdraftLimit !== undefined){let data7 = data6.overdraftLimit;if(!((typeof data7 == "number") && (isFinite(data7)))){validate30.errors = [{instancePath:instancePath+"/overdraftSettings/overdraftLimit",schemaPath:"#/$defs/DepositOverdraftSettings/properties/overdraftLimit/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}}else {validate30.errors = [{instancePath:instancePath+"/overdraftSettings",schemaPath:"#/$defs/DepositOverdraftSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs18 === errors;}else {var valid0 = true;}}}}else {validate30.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate30.errors = vErrors;return errors === 0;}const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountBalances !== undefined){let data0 = data.accountBalances;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.totalBalance !== undefined){let data1 = data0.totalBalance;if(!((typeof data1 == "number") && (isFinite(data1)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/totalBalance",schemaPath:"#/$defs/DepositTransactionBalances/properties/totalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}}else {validate11.errors = [{instancePath:instancePath+"/accountBalances",schemaPath:"#/$defs/DepositTransactionBalances/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.adjustmentTransactionKey !== undefined){const _errs8 = errors;if(typeof data.adjustmentTransactionKey !== "string"){validate11.errors = [{instancePath:instancePath+"/adjustmentTransactionKey",schemaPath:"#/properties/adjustmentTransactionKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.affectedAmounts !== undefined){let data3 = data.affectedAmounts;const _errs10 = errors;const _errs11 = errors;if(errors === _errs11){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){if(data3.feesAmount !== undefined){let data4 = data3.feesAmount;const _errs14 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/feesAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/feesAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs14 === errors;}else {var valid4 = true;}if(valid4){if(data3.fractionAmount !== undefined){let data5 = data3.fractionAmount;const _errs16 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/fractionAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/fractionAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs16 === errors;}else {var valid4 = true;}if(valid4){if(data3.fundsAmount !== undefined){let data6 = data3.fundsAmount;const _errs18 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/fundsAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/fundsAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs18 === errors;}else {var valid4 = true;}if(valid4){if(data3.interestAmount !== undefined){let data7 = data3.interestAmount;const _errs20 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/interestAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/interestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs20 === errors;}else {var valid4 = true;}if(valid4){if(data3.overdraftAmount !== undefined){let data8 = data3.overdraftAmount;const _errs22 = errors;if(!((typeof data8 == "number") && (isFinite(data8)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/overdraftAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/overdraftAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs22 === errors;}else {var valid4 = true;}if(valid4){if(data3.overdraftFeesAmount !== undefined){let data9 = data3.overdraftFeesAmount;const _errs24 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/overdraftFeesAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/overdraftFeesAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs24 === errors;}else {var valid4 = true;}if(valid4){if(data3.overdraftInterestAmount !== undefined){let data10 = data3.overdraftInterestAmount;const _errs26 = errors;if(!((typeof data10 == "number") && (isFinite(data10)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/overdraftInterestAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/overdraftInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs26 === errors;}else {var valid4 = true;}if(valid4){if(data3.technicalOverdraftAmount !== undefined){let data11 = data3.technicalOverdraftAmount;const _errs28 = errors;if(!((typeof data11 == "number") && (isFinite(data11)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/technicalOverdraftAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/technicalOverdraftAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs28 === errors;}else {var valid4 = true;}if(valid4){if(data3.technicalOverdraftInterestAmount !== undefined){let data12 = data3.technicalOverdraftInterestAmount;const _errs30 = errors;if(!((typeof data12 == "number") && (isFinite(data12)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/technicalOverdraftInterestAmount",schemaPath:"#/$defs/DepositAffectedAmounts/properties/technicalOverdraftInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs30 === errors;}else {var valid4 = true;}}}}}}}}}}else {validate11.errors = [{instancePath:instancePath+"/affectedAmounts",schemaPath:"#/$defs/DepositAffectedAmounts/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data13 = data.amount;const _errs32 = errors;if(!((typeof data13 == "number") && (isFinite(data13)))){validate11.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs32 === errors;}else {var valid0 = true;}if(valid0){if(data.blockId !== undefined){const _errs34 = errors;if(typeof data.blockId !== "string"){validate11.errors = [{instancePath:instancePath+"/blockId",schemaPath:"#/properties/blockId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs34 === errors;}else {var valid0 = true;}if(valid0){if(data.bookingDate !== undefined){const _errs36 = errors;if(errors === _errs36){if(errors === _errs36){if(!(typeof data.bookingDate === "string")){validate11.errors = [{instancePath:instancePath+"/bookingDate",schemaPath:"#/properties/bookingDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs36 === errors;}else {var valid0 = true;}if(valid0){if(data.branchKey !== undefined){const _errs38 = errors;if(typeof data.branchKey !== "string"){validate11.errors = [{instancePath:instancePath+"/branchKey",schemaPath:"#/properties/branchKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs38 === errors;}else {var valid0 = true;}if(valid0){if(data.cardTransaction !== undefined){const _errs40 = errors;if(!(validate12(data.cardTransaction, {instancePath:instancePath+"/cardTransaction",parentData:data,parentDataProperty:"cardTransaction",rootData}))){vErrors = vErrors === null ? validate12.errors : vErrors.concat(validate12.errors);errors = vErrors.length;}var valid0 = _errs40 === errors;}else {var valid0 = true;}if(valid0){if(data.centreKey !== undefined){const _errs41 = errors;if(typeof data.centreKey !== "string"){validate11.errors = [{instancePath:instancePath+"/centreKey",schemaPath:"#/properties/centreKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs43 = errors;if(errors === _errs43){if(errors === _errs43){if(!(typeof data.creationDate === "string")){validate11.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs43 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs45 = errors;if(typeof data.currencyCode !== "string"){validate11.errors = [{instancePath:instancePath+"/currencyCode",schemaPath:"#/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs45 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs47 = errors;if(typeof data.encodedKey !== "string"){validate11.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs47 === errors;}else {var valid0 = true;}if(valid0){if(data.externalId !== undefined){const _errs49 = errors;if(typeof data.externalId !== "string"){validate11.errors = [{instancePath:instancePath+"/externalId",schemaPath:"#/properties/externalId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs49 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data23 = data.fees;const _errs51 = errors;if(errors === _errs51){if(Array.isArray(data23)){var valid5 = true;const len0 = data23.length;for(let i0=0; i0 Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuGeneralLedgerAccounts { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /glaccounts + * * Create general ledger account */ public create({ @@ -64,7 +68,7 @@ export class MambuGeneralLedgerAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -76,9 +80,8 @@ export class MambuGeneralLedgerAccounts { return this.awaitResponse( this.buildClient(auth).post('glaccounts', { - json: body, + json: _body.right as CreateRequest, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -88,10 +91,13 @@ export class MambuGeneralLedgerAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /glaccounts + * * Get general ledger accounts */ public getAll({ @@ -117,7 +123,7 @@ export class MambuGeneralLedgerAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -126,7 +132,6 @@ export class MambuGeneralLedgerAccounts { this.buildClient(auth).get('glaccounts', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -134,10 +139,13 @@ export class MambuGeneralLedgerAccounts { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /glaccounts/{glAccountId} + * * Get general ledger account */ public getById({ @@ -157,7 +165,7 @@ export class MambuGeneralLedgerAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -166,7 +174,6 @@ export class MambuGeneralLedgerAccounts { this.buildClient(auth).get(`glaccounts/${path.glAccountId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GLAccount, @@ -175,10 +182,13 @@ export class MambuGeneralLedgerAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /glaccounts/{glAccountId} + * * Partially update an existing general ledger account */ public patch({ @@ -195,7 +205,7 @@ export class MambuGeneralLedgerAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -207,8 +217,7 @@ export class MambuGeneralLedgerAccounts { return this.awaitResponse( this.buildClient(auth).patch(`glaccounts/${path.glAccountId}`, { - json: body, - responseType: 'text', + json: _body.right as PatchRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -217,6 +226,7 @@ export class MambuGeneralLedgerAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } @@ -241,44 +251,45 @@ export class MambuGeneralLedgerAccounts { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -286,8 +297,7 @@ export class MambuGeneralLedgerAccounts { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -295,21 +305,21 @@ export class MambuGeneralLedgerAccounts { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/general-setup/rest.client.ts b/src/general-setup/rest.client.ts index afb920c..5eb3a5f 100644 --- a/src/general-setup/rest.client.ts +++ b/src/general-setup/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, GeneralSetup } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, GeneralSetup } from './rest.type.js' * setup/general */ export class MambuGeneralSetup { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuGeneralSetup { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /setup/general + * * Get general setup */ public getGeneralSetup({ @@ -56,62 +60,63 @@ export class MambuGeneralSetup { | FailureResponse<'401', ErrorResponse, 'response:statuscode'> | FailureResponse<'403', ErrorResponse, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('setup/general', { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GeneralSetup, 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -119,8 +124,7 @@ export class MambuGeneralSetup { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -128,21 +132,21 @@ export class MambuGeneralSetup { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/general-setup/rest.type.ts b/src/general-setup/rest.type.ts index 3d91732..4287b92 100644 --- a/src/general-setup/rest.type.ts +++ b/src/general-setup/rest.type.ts @@ -109,6 +109,7 @@ export interface DuplicateFieldConstraint { | 'ACCOUNT_INTEREST_RATE_SETTINGS' | 'LENDING_ACCOUNT_CONTRACT' | 'REVOLVING_ACCOUNT' + | 'LENDING_PRODUCT_CONTRACT' | undefined /** * The encoded key of the duplicate field constraint, auto generated, unique diff --git a/src/general-setup/schemas/general-setup.schema.js b/src/general-setup/schemas/general-setup.schema.js index 1d8a545..ef0c88b 100644 --- a/src/general-setup/schemas/general-setup.schema.js +++ b/src/general-setup/schemas/general-setup.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"GeneralSetup","type":"object","description":"Represents the general setup for an organization.","properties":{"accountingCutOffTime":{"type":"string","description":"The accounting cut off time."},"approvalDisbursalTwoManRuleEnabled":{"type":"boolean","description":"`TRUE` if separate users are required for approval and disbursal, `FALSE` otherwise."},"arrearsDaysBeforeWriteOff":{"type":"integer","description":"The number of days that are required before an account can be written off."},"assignmentConstraints":{"type":"array","description":"The list of required assignments for clients and groups.","items":{"enum":["BRANCH","CENTRE","CREDIT_OFFICER","GROUP"]}},"automatedAccountingClosuresInterval":{"type":"integer","description":"The interval (number of days) between the execution of automated accounting closures. If this number is 0, automated closure is performed."},"clientIdFormat":{"type":"string","description":"The pattern for generating individual client IDs."},"dashboardConfigurations":{"type":"array","description":"The dashboard configuration.","items":{"$ref":"#/$defs/DashboardConfiguration"},"uniqueItems":true},"dateFormats":{"type":"object","description":"The date (dd-MM-yyyy) or date time (dd-MM-yyyy HH:mm:ss) formats.","additionalProperties":{"type":"string"}},"decimalSeparator":{"description":"The symbol used to mark the border between the integral and the fractional parts of a decimal numeral.","enum":["COMMA","POINT"]},"defaultClientRoleKey":{"type":"string","description":"The client role used as default."},"defaultClientState":{"description":"The client default state.","enum":["PENDING_APPROVAL","INACTIVE","ACTIVE","EXITED","BLACKLISTED","REJECTED"]},"defaultGroupRoleKey":{"type":"string","description":"The group role used as default."},"defaultLineOfCreditState":{"description":"The line of credit default state.","enum":["PENDING_APPROVAL","APPROVED","ACTIVE","CLOSED","WITHDRAWN","REJECTED"]},"defaultTransactionChannelKey":{"type":"string","description":"The transaction channel that is used as the default."},"duplicateClientChecks":{"type":"array","description":"The list of duplicate client constraints that are available in the administration and can be performed.","items":{"$ref":"#/$defs/DuplicateFieldConstraint"}},"duplicateClientConstraintAction":{"description":"The action to be taken when the duplicate client validation fails.","enum":["NONE","WARNING","ERROR"]},"enabledComponents":{"type":"array","description":"The list of all the enabled components for the current tenant.","items":{"enum":["LOANS","DEPOSITS","BRANCHES","CENTRES","CLIENTS","GROUPS","ACCOUNTING","CREDIT_OFFICERS"]}},"encodedKey":{"type":"string","description":"The encoded key of the general setup, which is auto generated, and unique."},"eodProcessingMethod":{"description":"The end of day (EOD) processing settings. The `AUTOMATIC` EOD processing runs every midnight. The `MANUAL` EOD processing runs when the client initiates the action from the Mambu UI.","enum":["AUTOMATIC","MANUAL"]},"exposureAmount":{"type":"number","description":"The maximum exposure amount."},"exposureType":{"description":"The maximum exposure a client can have in outstanding loans at any time.","enum":["UNLIMITED","SUM_OF_LOANS","SUM_OF_LOANS_MINUS_SAVINGS"]},"groupIdFormat":{"type":"string","description":"The pattern for generating group client IDs."},"groupSizeLimitType":{"description":"The group size limitation type.","enum":["HARD","WARNING","NONE"]},"interBranchTransferGLAccountKey":{"type":"string","description":"The key of the general ledger (GL) account which will be used for inter-branch transfers."},"lineOfCreditIdFormat":{"type":"string","description":"The unique pattern after which all the lines of credit IDs should be created."},"maxAllowedIdDocumentAttachments":{"type":"integer","description":"The maximum allowed ID document attachments."},"maxAllowedJournalEntryDocumentAttachments":{"type":"integer","description":"The maximum allowed journal entry attachments."},"maxAllowedUndoClosurePeriod":{"type":"integer","description":"The maximum number of days users are allowed to undo of close obligations met for a loan account."},"maxGroupSizeLimit":{"type":"integer","description":"The maximum group size allowed. A null value means the limit is ignored."},"minGroupSizeLimit":{"type":"integer","description":"The minimum group size allowed. A null value means the limit is ignored."},"multipleGroupMemberships":{"description":"The constraint on whether clients can belong to more than one group or not.","enum":["UNLIMITED","ONE_GROUP"]},"multipleLoans":{"description":"The option that shows if multiple loans are allowed or not.","enum":["UNLIMITED","ONE_LOAN"]},"otherIdDocumentsEnabled":{"type":"boolean","description":"`TRUE` if other ID documents are enabled, `FALSE` otherwise."},"overdraftInterestEodBalanceDate":{"type":"string","description":"The date used when computing overdraft interest for savings accounts.","format":"date-time"},"tillIdFormat":{"type":"string","description":"The unique pattern after which all the till IDs should be created."}},"additionalProperties":true,"$defs":{"DashboardConfiguration":{"type":"object","description":"Response representation of the dashboard configuration","properties":{"creationDate":{"type":"string","description":"The date dashboard configuration was created","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the dashboard configuration, auto generated, unique"},"name":{"description":"The Dashboard option name","enum":["LATEST_ACTIVITY","TASKS","FAVOURITE_VIEWS","INDICATORS","CURRENT_TILLS","CLIENTS","UPCOMING_REPAYMENTS","NONE"]}},"additionalProperties":true},"DuplicateFieldConstraint":{"type":"object","description":"Represents a duplicate constraint which needs to apply when saving entities","properties":{"active":{"type":"boolean","description":"The check will be performed if the field is true"},"dataField":{"type":"string","description":"The ENUM data field when the field is an ENUM"},"dataItemType":{"description":"The type of the owner (entity) to whom a data field belongs to","enum":["LOANS","SAVINGS","CLIENT","CLIENT_ROLE","GROUP","GROUP_ROLE","TRANSACTION","JOURNAL_ENTRY","INTEREST_ACCRUAL_BREAKDOWN","BRANCH","CENTRE","USER","LOAN_PRODUCT","SAVINGS_PRODUCT","NOTIFICATION_MESSAGE","NOTIFICATION_TEMPLATE","REPAYMENT","REPAYMENT_COLLECTION","ACTIVITY","LINE_OF_CREDIT","IDENTIFICATION_DOCUMENT","ATTACHMENT","CURRENCY","PRODUCT","REVENUE","EXPENSE","OUTSTANDING_PORTFOLIO_ACCOUNTS","OUTSTANDING_PORTFOLIO_AMOUNTS","CREATED_ACCOUNTS","WRITTEN_OFF_LOANS","DISBURSED_LOANS","LOAN_GROUP","TRANCHE","DISBURSEMENT_DETAILS","TRANSACTION_DETAILS","TRANSACTION_CHANNEL","CUSTOM_PREDEFINED_FEE","CUSTOM_FIELD_SELECTION","PREDEFINED_FEE","LOAN_TRANSACTION","SAVINGS_TRANSACTION","CARD_TRANSACTION_REVERSAL","COMPOSED_TRANSACTIONS","UNION_TRANSACTIONS","INVESTOR_FUND","PRINCIPAL_PAYMENT_SETTINGS","LOAN_ACCOUNT_GUARANTY","TASK","DOCUMENT_TEMPLATE","INDEX_RATE","INDEX_RATE_SOURCE","INTEREST_PRODUCT_SETTINGS","MCC_EXPIRATION","PRODUCT_ARREARS_SETTINGS","ACCOUNT_INTEREST_RATE_SETTINGS","LENDING_ACCOUNT_CONTRACT","REVOLVING_ACCOUNT"]},"encodedKey":{"type":"string","description":"The encoded key of the duplicate field constraint, auto generated, unique"},"groupIndex":{"type":"integer","description":"Used for creating an AND clause between constraints"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Response representation of the dashboard configuration","properties":{"creationDate":{"type":"string","description":"The date dashboard configuration was created","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the dashboard configuration, auto generated, unique"},"name":{"description":"The Dashboard option name","enum":["LATEST_ACTIVITY","TASKS","FAVOURITE_VIEWS","INDICATORS","CURRENT_TILLS","CLIENTS","UPCOMING_REPAYMENTS","NONE"]}},"additionalProperties":true};const schema13 = {"type":"object","description":"Represents a duplicate constraint which needs to apply when saving entities","properties":{"active":{"type":"boolean","description":"The check will be performed if the field is true"},"dataField":{"type":"string","description":"The ENUM data field when the field is an ENUM"},"dataItemType":{"description":"The type of the owner (entity) to whom a data field belongs to","enum":["LOANS","SAVINGS","CLIENT","CLIENT_ROLE","GROUP","GROUP_ROLE","TRANSACTION","JOURNAL_ENTRY","INTEREST_ACCRUAL_BREAKDOWN","BRANCH","CENTRE","USER","LOAN_PRODUCT","SAVINGS_PRODUCT","NOTIFICATION_MESSAGE","NOTIFICATION_TEMPLATE","REPAYMENT","REPAYMENT_COLLECTION","ACTIVITY","LINE_OF_CREDIT","IDENTIFICATION_DOCUMENT","ATTACHMENT","CURRENCY","PRODUCT","REVENUE","EXPENSE","OUTSTANDING_PORTFOLIO_ACCOUNTS","OUTSTANDING_PORTFOLIO_AMOUNTS","CREATED_ACCOUNTS","WRITTEN_OFF_LOANS","DISBURSED_LOANS","LOAN_GROUP","TRANCHE","DISBURSEMENT_DETAILS","TRANSACTION_DETAILS","TRANSACTION_CHANNEL","CUSTOM_PREDEFINED_FEE","CUSTOM_FIELD_SELECTION","PREDEFINED_FEE","LOAN_TRANSACTION","SAVINGS_TRANSACTION","CARD_TRANSACTION_REVERSAL","COMPOSED_TRANSACTIONS","UNION_TRANSACTIONS","INVESTOR_FUND","PRINCIPAL_PAYMENT_SETTINGS","LOAN_ACCOUNT_GUARANTY","TASK","DOCUMENT_TEMPLATE","INDEX_RATE","INDEX_RATE_SOURCE","INTEREST_PRODUCT_SETTINGS","MCC_EXPIRATION","PRODUCT_ARREARS_SETTINGS","ACCOUNT_INTEREST_RATE_SETTINGS","LENDING_ACCOUNT_CONTRACT","REVOLVING_ACCOUNT"]},"encodedKey":{"type":"string","description":"The encoded key of the duplicate field constraint, auto generated, unique"},"groupIndex":{"type":"integer","description":"Used for creating an AND clause between constraints"}},"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountingCutOffTime !== undefined){const _errs2 = errors;if(typeof data.accountingCutOffTime !== "string"){validate10.errors = [{instancePath:instancePath+"/accountingCutOffTime",schemaPath:"#/properties/accountingCutOffTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.approvalDisbursalTwoManRuleEnabled !== undefined){const _errs4 = errors;if(typeof data.approvalDisbursalTwoManRuleEnabled !== "boolean"){validate10.errors = [{instancePath:instancePath+"/approvalDisbursalTwoManRuleEnabled",schemaPath:"#/properties/approvalDisbursalTwoManRuleEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.arrearsDaysBeforeWriteOff !== undefined){let data2 = data.arrearsDaysBeforeWriteOff;const _errs6 = errors;if(!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))){validate10.errors = [{instancePath:instancePath+"/arrearsDaysBeforeWriteOff",schemaPath:"#/properties/arrearsDaysBeforeWriteOff/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.assignmentConstraints !== undefined){let data3 = data.assignmentConstraints;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid1 = true;const len0 = data3.length;for(let i0=0; i0 1){outer0:for(;i2--;){for(j0 = i2; j0--;){if(func0(data7[i2], data7[j0])){validate10.errors = [{instancePath:instancePath+"/dashboardConfigurations",schemaPath:"#/properties/dashboardConfigurations/uniqueItems",keyword:"uniqueItems",params:{i: i2, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i2+" are identical)"}];return false;break outer0;}}}}}}else {validate10.errors = [{instancePath:instancePath+"/dashboardConfigurations",schemaPath:"#/properties/dashboardConfigurations/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}if(valid0){if(data.dateFormats !== undefined){let data12 = data.dateFormats;const _errs26 = errors;if(errors === _errs26){if(data12 && typeof data12 == "object" && !Array.isArray(data12)){for(const key0 in data12){const _errs29 = errors;if(typeof data12[key0] !== "string"){validate10.errors = [{instancePath:instancePath+"/dateFormats/" + key0.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/dateFormats/additionalProperties/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid7 = _errs29 === errors;if(!valid7){break;}}}else {validate10.errors = [{instancePath:instancePath+"/dateFormats",schemaPath:"#/properties/dateFormats/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.decimalSeparator !== undefined){let data14 = data.decimalSeparator;const _errs31 = errors;if(!((data14 === "COMMA") || (data14 === "POINT"))){validate10.errors = [{instancePath:instancePath+"/decimalSeparator",schemaPath:"#/properties/decimalSeparator/enum",keyword:"enum",params:{allowedValues: schema11.properties.decimalSeparator.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultClientRoleKey !== undefined){const _errs32 = errors;if(typeof data.defaultClientRoleKey !== "string"){validate10.errors = [{instancePath:instancePath+"/defaultClientRoleKey",schemaPath:"#/properties/defaultClientRoleKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs32 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultClientState !== undefined){const _errs34 = errors;let valid8;valid8 = false;for(const v1 of schema11.properties.defaultClientState.enum){if(func0(data.defaultClientState, v1)){valid8 = true;break;}}if(!valid8){validate10.errors = [{instancePath:instancePath+"/defaultClientState",schemaPath:"#/properties/defaultClientState/enum",keyword:"enum",params:{allowedValues: schema11.properties.defaultClientState.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs34 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultGroupRoleKey !== undefined){const _errs35 = errors;if(typeof data.defaultGroupRoleKey !== "string"){validate10.errors = [{instancePath:instancePath+"/defaultGroupRoleKey",schemaPath:"#/properties/defaultGroupRoleKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs35 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultLineOfCreditState !== undefined){const _errs37 = errors;let valid9;valid9 = false;for(const v2 of schema11.properties.defaultLineOfCreditState.enum){if(func0(data.defaultLineOfCreditState, v2)){valid9 = true;break;}}if(!valid9){validate10.errors = [{instancePath:instancePath+"/defaultLineOfCreditState",schemaPath:"#/properties/defaultLineOfCreditState/enum",keyword:"enum",params:{allowedValues: schema11.properties.defaultLineOfCreditState.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs37 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultTransactionChannelKey !== undefined){const _errs38 = errors;if(typeof data.defaultTransactionChannelKey !== "string"){validate10.errors = [{instancePath:instancePath+"/defaultTransactionChannelKey",schemaPath:"#/properties/defaultTransactionChannelKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs38 === errors;}else {var valid0 = true;}if(valid0){if(data.duplicateClientChecks !== undefined){let data20 = data.duplicateClientChecks;const _errs40 = errors;if(errors === _errs40){if(Array.isArray(data20)){var valid10 = true;const len2 = data20.length;for(let i3=0; i3 1){outer0:for(;i2--;){for(j0 = i2; j0--;){if(func0(data7[i2], data7[j0])){validate10.errors = [{instancePath:instancePath+"/dashboardConfigurations",schemaPath:"#/properties/dashboardConfigurations/uniqueItems",keyword:"uniqueItems",params:{i: i2, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i2+" are identical)"}];return false;break outer0;}}}}}}else {validate10.errors = [{instancePath:instancePath+"/dashboardConfigurations",schemaPath:"#/properties/dashboardConfigurations/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}if(valid0){if(data.dateFormats !== undefined){let data12 = data.dateFormats;const _errs26 = errors;if(errors === _errs26){if(data12 && typeof data12 == "object" && !Array.isArray(data12)){for(const key0 in data12){const _errs29 = errors;if(typeof data12[key0] !== "string"){validate10.errors = [{instancePath:instancePath+"/dateFormats/" + key0.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/dateFormats/additionalProperties/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid7 = _errs29 === errors;if(!valid7){break;}}}else {validate10.errors = [{instancePath:instancePath+"/dateFormats",schemaPath:"#/properties/dateFormats/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.decimalSeparator !== undefined){let data14 = data.decimalSeparator;const _errs31 = errors;if(!((data14 === "COMMA") || (data14 === "POINT"))){validate10.errors = [{instancePath:instancePath+"/decimalSeparator",schemaPath:"#/properties/decimalSeparator/enum",keyword:"enum",params:{allowedValues: schema11.properties.decimalSeparator.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultClientRoleKey !== undefined){const _errs32 = errors;if(typeof data.defaultClientRoleKey !== "string"){validate10.errors = [{instancePath:instancePath+"/defaultClientRoleKey",schemaPath:"#/properties/defaultClientRoleKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs32 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultClientState !== undefined){const _errs34 = errors;let valid8;valid8 = false;for(const v1 of schema11.properties.defaultClientState.enum){if(func0(data.defaultClientState, v1)){valid8 = true;break;}}if(!valid8){validate10.errors = [{instancePath:instancePath+"/defaultClientState",schemaPath:"#/properties/defaultClientState/enum",keyword:"enum",params:{allowedValues: schema11.properties.defaultClientState.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs34 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultGroupRoleKey !== undefined){const _errs35 = errors;if(typeof data.defaultGroupRoleKey !== "string"){validate10.errors = [{instancePath:instancePath+"/defaultGroupRoleKey",schemaPath:"#/properties/defaultGroupRoleKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs35 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultLineOfCreditState !== undefined){const _errs37 = errors;let valid9;valid9 = false;for(const v2 of schema11.properties.defaultLineOfCreditState.enum){if(func0(data.defaultLineOfCreditState, v2)){valid9 = true;break;}}if(!valid9){validate10.errors = [{instancePath:instancePath+"/defaultLineOfCreditState",schemaPath:"#/properties/defaultLineOfCreditState/enum",keyword:"enum",params:{allowedValues: schema11.properties.defaultLineOfCreditState.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs37 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultTransactionChannelKey !== undefined){const _errs38 = errors;if(typeof data.defaultTransactionChannelKey !== "string"){validate10.errors = [{instancePath:instancePath+"/defaultTransactionChannelKey",schemaPath:"#/properties/defaultTransactionChannelKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs38 === errors;}else {var valid0 = true;}if(valid0){if(data.duplicateClientChecks !== undefined){let data20 = data.duplicateClientChecks;const _errs40 = errors;if(errors === _errs40){if(Array.isArray(data20)){var valid10 = true;const len2 = data20.length;for(let i3=0; i3 Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuGroupRoleNamesConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/grouprolenames.yaml + * * Get group role names configuration */ public get({ @@ -54,22 +58,24 @@ export class MambuGroupRoleNamesConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/grouprolenames.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/grouprolenames.yaml + * * Update group role names configuration */ public update({ @@ -83,15 +89,13 @@ export class MambuGroupRoleNamesConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/grouprolenames.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/grouprolenames.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -99,50 +103,52 @@ export class MambuGroupRoleNamesConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -150,8 +156,7 @@ export class MambuGroupRoleNamesConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -159,21 +164,21 @@ export class MambuGroupRoleNamesConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/groups/rest.client.ts b/src/groups/rest.client.ts index a16188b..38b1e43 100644 --- a/src/groups/rest.client.ts +++ b/src/groups/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, @@ -24,7 +24,7 @@ import { * groups */ export class MambuGroups { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -39,22 +39,26 @@ export class MambuGroups { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /groups + * * Create group */ public create({ @@ -71,7 +75,7 @@ export class MambuGroups { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -83,9 +87,8 @@ export class MambuGroups { return this.awaitResponse( this.buildClient(auth).post('groups', { - json: body, + json: _body.right as Group, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -94,10 +97,13 @@ export class MambuGroups { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /groups/{groupId} + * * Delete group */ public delete({ @@ -112,15 +118,13 @@ export class MambuGroups { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`groups/${path.groupId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`groups/${path.groupId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -128,10 +132,13 @@ export class MambuGroups { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /groups + * * Get groups */ public getAll({ @@ -157,7 +164,7 @@ export class MambuGroups { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -166,7 +173,6 @@ export class MambuGroups { this.buildClient(auth).get('groups', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -174,10 +180,13 @@ export class MambuGroups { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /groups/{groupId} + * * Get group */ public getById({ @@ -193,7 +202,7 @@ export class MambuGroups { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -202,7 +211,6 @@ export class MambuGroups { this.buildClient(auth).get(`groups/${path.groupId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Group, @@ -211,10 +219,13 @@ export class MambuGroups { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /groups/{groupId}/creditarrangements + * * Credit arrangements list returned. */ public getCreditArrangementsByGroupIdOrKey({ @@ -234,7 +245,7 @@ export class MambuGroups { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -243,7 +254,6 @@ export class MambuGroups { this.buildClient(auth).get(`groups/${path.groupId}/creditarrangements`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetCreditArrangementsByGroupIdOrKeyResponse, @@ -252,10 +262,13 @@ export class MambuGroups { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /groups/{groupId} + * * Partially update group */ public patch({ @@ -272,7 +285,7 @@ export class MambuGroups { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -284,8 +297,7 @@ export class MambuGroups { return this.awaitResponse( this.buildClient(auth).patch(`groups/${path.groupId}`, { - json: body, - responseType: 'text', + json: _body.right as PatchRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -294,10 +306,13 @@ export class MambuGroups { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /groups:search + * * Search groups */ public search({ @@ -317,7 +332,7 @@ export class MambuGroups { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -329,10 +344,9 @@ export class MambuGroups { return this.awaitResponse( this.buildClient(auth).post('groups:search', { - json: body, + json: _body.right as GroupSearchCriteria, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: SearchResponse, @@ -340,10 +354,13 @@ export class MambuGroups { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /groups/{groupId} + * * Update group */ public update({ @@ -360,7 +377,7 @@ export class MambuGroups { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -372,9 +389,8 @@ export class MambuGroups { return this.awaitResponse( this.buildClient(auth).put(`groups/${path.groupId}`, { - json: body, + json: _body.right as Group, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Group, @@ -383,6 +399,7 @@ export class MambuGroups { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -407,44 +424,45 @@ export class MambuGroups { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -452,8 +470,7 @@ export class MambuGroups { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -461,21 +478,21 @@ export class MambuGroups { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/holidays-configuration/rest.client.ts b/src/holidays-configuration/rest.client.ts index df2774a..148cfff 100644 --- a/src/holidays-configuration/rest.client.ts +++ b/src/holidays-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/holidays.yaml */ export class MambuHolidaysConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuHolidaysConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/holidays.yaml + * * Get holidays configuration */ public get({ @@ -58,7 +62,7 @@ export class MambuHolidaysConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -66,7 +70,6 @@ export class MambuHolidaysConfiguration { return this.awaitResponse( this.buildClient(auth).get('configuration/holidays.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -75,10 +78,13 @@ export class MambuHolidaysConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/holidays.yaml + * * Update holidays configuration */ public update({ @@ -92,15 +98,13 @@ export class MambuHolidaysConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/holidays.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/holidays.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -108,50 +112,52 @@ export class MambuHolidaysConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -159,8 +165,7 @@ export class MambuHolidaysConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -168,21 +173,21 @@ export class MambuHolidaysConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/id-templates/rest.client.ts b/src/id-templates/rest.client.ts index d63e446..b4342a1 100644 --- a/src/id-templates/rest.client.ts +++ b/src/id-templates/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, GetAllResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, GetAllResponse } from './rest.type.js' * organization/identificationDocumentTemplates */ export class MambuIdTemplates { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuIdTemplates { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /organization/identificationDocumentTemplates + * * Get ID templates */ public getAll({ @@ -60,7 +64,7 @@ export class MambuIdTemplates { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -69,7 +73,6 @@ export class MambuIdTemplates { this.buildClient(auth).get('organization/identificationDocumentTemplates', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -77,50 +80,52 @@ export class MambuIdTemplates { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -128,8 +133,7 @@ export class MambuIdTemplates { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -137,21 +141,21 @@ export class MambuIdTemplates { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/identification-document-templates-configuration/rest.client.ts b/src/identification-document-templates-configuration/rest.client.ts index ade1b33..c2e80e8 100644 --- a/src/identification-document-templates-configuration/rest.client.ts +++ b/src/identification-document-templates-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/iddocumenttemplates.yaml */ export class MambuIdentificationDocumentTemplatesConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuIdentificationDocumentTemplatesConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/iddocumenttemplates.yaml + * * Get ID templates configuration */ public get({ @@ -54,22 +58,24 @@ export class MambuIdentificationDocumentTemplatesConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/iddocumenttemplates.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/iddocumenttemplates.yaml + * * Update ID templates configuration */ public update({ @@ -83,15 +89,13 @@ export class MambuIdentificationDocumentTemplatesConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/iddocumenttemplates.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/iddocumenttemplates.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -99,50 +103,52 @@ export class MambuIdentificationDocumentTemplatesConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -150,8 +156,7 @@ export class MambuIdentificationDocumentTemplatesConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -159,21 +164,21 @@ export class MambuIdentificationDocumentTemplatesConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/index-rate-sources/rest.client.ts b/src/index-rate-sources/rest.client.ts index 66629a1..9ae795a 100644 --- a/src/index-rate-sources/rest.client.ts +++ b/src/index-rate-sources/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, @@ -22,7 +22,7 @@ import { * indexratesources */ export class MambuIndexRateSources { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -37,22 +37,26 @@ export class MambuIndexRateSources { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /indexratesources/{indexRateSourceId}/indexrates + * * Create index rate */ public createIndexRate({ @@ -75,7 +79,7 @@ export class MambuIndexRateSources { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -87,9 +91,8 @@ export class MambuIndexRateSources { return this.awaitResponse( this.buildClient(auth).post(`indexratesources/${path.indexRateSourceId}/indexrates`, { - json: body, + json: _body.right as IndexRate, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -98,10 +101,13 @@ export class MambuIndexRateSources { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /indexratesources + * * Create index rate source */ public createIndexRateSource({ @@ -118,7 +124,7 @@ export class MambuIndexRateSources { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -130,9 +136,8 @@ export class MambuIndexRateSources { return this.awaitResponse( this.buildClient(auth).post('indexratesources', { - json: body, + json: _body.right as IndexRateSource, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -141,10 +146,13 @@ export class MambuIndexRateSources { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /indexratesources/{indexRateSourceId}/indexrates/{indexRateId} + * * Delete index rate */ public deleteIndexRate({ @@ -159,15 +167,13 @@ export class MambuIndexRateSources { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`indexratesources/${path.indexRateSourceId}/indexrates/${path.indexRateId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`indexratesources/${path.indexRateSourceId}/indexrates/${path.indexRateId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -175,10 +181,13 @@ export class MambuIndexRateSources { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * DELETE /indexratesources/{indexRateSourceId} + * * Delete index rate source */ public deleteIndexRateSource({ @@ -193,15 +202,13 @@ export class MambuIndexRateSources { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`indexratesources/${path.indexRateSourceId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`indexratesources/${path.indexRateSourceId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -209,10 +216,13 @@ export class MambuIndexRateSources { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /indexratesources/{indexRateSourceId}/indexrates + * * Get index rates for a source */ public getAllIndexRates({ @@ -226,7 +236,7 @@ export class MambuIndexRateSources { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -234,7 +244,6 @@ export class MambuIndexRateSources { return this.awaitResponse( this.buildClient(auth).get(`indexratesources/${path.indexRateSourceId}/indexrates`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllIndexRatesResponse, @@ -242,10 +251,13 @@ export class MambuIndexRateSources { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /indexratesources + * * Get index rate sources */ public getAllIndexRateSources({ @@ -258,7 +270,7 @@ export class MambuIndexRateSources { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -266,7 +278,6 @@ export class MambuIndexRateSources { return this.awaitResponse( this.buildClient(auth).get('indexratesources', { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllIndexRateSourcesResponse, @@ -274,10 +285,13 @@ export class MambuIndexRateSources { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /indexratesources/{indexRateSourceId} + * * Get index rate sources */ public getIndexRateSourceById({ @@ -292,7 +306,7 @@ export class MambuIndexRateSources { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -300,7 +314,6 @@ export class MambuIndexRateSources { return this.awaitResponse( this.buildClient(auth).get(`indexratesources/${path.indexRateSourceId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: IndexRateSource, @@ -309,6 +322,7 @@ export class MambuIndexRateSources { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -333,44 +347,45 @@ export class MambuIndexRateSources { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -378,8 +393,7 @@ export class MambuIndexRateSources { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -387,21 +401,21 @@ export class MambuIndexRateSources { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/index-rates-configuration/rest.client.ts b/src/index-rates-configuration/rest.client.ts index b72fa6a..a10ecd7 100644 --- a/src/index-rates-configuration/rest.client.ts +++ b/src/index-rates-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/indexrates.yaml */ export class MambuIndexRatesConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuIndexRatesConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/indexrates.yaml + * * Get index rates configuration */ public get({ @@ -54,22 +58,24 @@ export class MambuIndexRatesConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/indexrates.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/indexrates.yaml + * * Update index rates configuration */ public update({ @@ -83,15 +89,13 @@ export class MambuIndexRatesConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/indexrates.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/indexrates.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -99,50 +103,52 @@ export class MambuIndexRatesConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -150,8 +156,7 @@ export class MambuIndexRatesConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -159,21 +164,21 @@ export class MambuIndexRatesConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/index.ts b/src/index.ts index 2e7954d..c88b283 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,6 +36,7 @@ export * from './deposit-products-configuration/index.js' export * from './deposit-transactions/index.js' export * from './documents/index.js' export * from './end-of-day-processing-configuration/index.js' +export * from './exchange-rate/index.js' export * from './funding-sources/index.js' export * from './general-ledger-accounts/index.js' export * from './general-setup/index.js' diff --git a/src/installments/rest.client.ts b/src/installments/rest.client.ts index 4ce0b01..d6f51aa 100644 --- a/src/installments/rest.client.ts +++ b/src/installments/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, GetAllResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, GetAllResponse } from './rest.type.js' * installments */ export class MambuInstallments { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuInstallments { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /installments + * * Get installments for `ACTIVE` or `ACTIVE_IN_ARREARS` loan accounts */ public getAll({ @@ -61,6 +65,7 @@ export class MambuInstallments { dueTo: string productTypeKey?: string accountState?: string + installmentState?: string } auth?: string[][] | string[] }): Promise< @@ -72,7 +77,7 @@ export class MambuInstallments { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -81,7 +86,6 @@ export class MambuInstallments { this.buildClient(auth).get('installments', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -90,50 +94,52 @@ export class MambuInstallments { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -141,8 +147,7 @@ export class MambuInstallments { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -150,21 +155,21 @@ export class MambuInstallments { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/internal-controls-configuration/rest.client.ts b/src/internal-controls-configuration/rest.client.ts index 881f4a6..6dade70 100644 --- a/src/internal-controls-configuration/rest.client.ts +++ b/src/internal-controls-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/internalcontrols.yaml */ export class MambuInternalControlsConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuInternalControlsConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/internalcontrols.yaml + * * Get internal controls configuration */ public get({ @@ -57,7 +61,7 @@ export class MambuInternalControlsConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -65,7 +69,6 @@ export class MambuInternalControlsConfiguration { return this.awaitResponse( this.buildClient(auth).get('configuration/internalcontrols.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -73,10 +76,13 @@ export class MambuInternalControlsConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/internalcontrols.yaml + * * Update internal controls configuration */ public update({ @@ -90,15 +96,13 @@ export class MambuInternalControlsConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/internalcontrols.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/internalcontrols.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -106,50 +110,52 @@ export class MambuInternalControlsConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -157,8 +163,7 @@ export class MambuInternalControlsConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -166,21 +171,21 @@ export class MambuInternalControlsConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/journal-entries/rest.client.ts b/src/journal-entries/rest.client.ts index bdca9b0..ed848c1 100644 --- a/src/journal-entries/rest.client.ts +++ b/src/journal-entries/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { CreateResponse, @@ -23,7 +23,7 @@ import { * gljournalentries */ export class MambuJournalEntries { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -38,22 +38,26 @@ export class MambuJournalEntries { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /gljournalentries + * * Create general ledger journal entries. */ public create({ @@ -70,7 +74,7 @@ export class MambuJournalEntries { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -82,9 +86,8 @@ export class MambuJournalEntries { return this.awaitResponse( this.buildClient(auth).post('gljournalentries', { - json: body, + json: _body.right as PostGLJournalEntriesDTO, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -93,10 +96,13 @@ export class MambuJournalEntries { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /gljournalentries + * * Get general ledger journal entries */ public getAll({ @@ -121,7 +127,7 @@ export class MambuJournalEntries { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -130,7 +136,6 @@ export class MambuJournalEntries { this.buildClient(auth).get('gljournalentries', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -138,10 +143,13 @@ export class MambuJournalEntries { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /gljournalentries:search + * * Search for general ledger journal entries */ public search({ @@ -150,7 +158,7 @@ export class MambuJournalEntries { auth = [['apiKey'], ['basic']], }: { body: GLJournalEntrySearchCriteria - query?: { offset?: string; limit?: string; paginationDetails?: string } + query?: { offset?: string; limit?: string; paginationDetails?: string; cursor?: string } auth?: string[][] | string[] }): Promise< | SuccessResponse<'200', SearchResponse> @@ -161,7 +169,7 @@ export class MambuJournalEntries { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -173,10 +181,9 @@ export class MambuJournalEntries { return this.awaitResponse( this.buildClient(auth).post('gljournalentries:search', { - json: body, + json: _body.right as GLJournalEntrySearchCriteria, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: SearchResponse, @@ -184,6 +191,7 @@ export class MambuJournalEntries { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } @@ -208,44 +216,45 @@ export class MambuJournalEntries { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -253,8 +262,7 @@ export class MambuJournalEntries { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -262,21 +270,21 @@ export class MambuJournalEntries { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/loan-account-schedule/rest.client.ts b/src/loan-account-schedule/rest.client.ts index 947158d..d6fce75 100644 --- a/src/loan-account-schedule/rest.client.ts +++ b/src/loan-account-schedule/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { EditScheduleRequest, @@ -23,7 +23,7 @@ import { * loans/schedule */ export class MambuLoanAccountSchedule { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -38,22 +38,26 @@ export class MambuLoanAccountSchedule { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * PUT /loans/{loanAccountId}/schedule + * * Update loan account schedule */ public editSchedule({ @@ -70,7 +74,7 @@ export class MambuLoanAccountSchedule { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -82,9 +86,8 @@ export class MambuLoanAccountSchedule { return this.awaitResponse( this.buildClient(auth).put(`loans/${path.loanAccountId}/schedule`, { - json: body, + json: _body.right as EditScheduleRequest, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: LoanAccountSchedule, @@ -93,10 +96,13 @@ export class MambuLoanAccountSchedule { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/{loanAccountId}/schedule + * * Get loan account schedule */ public getScheduleForLoanAccount({ @@ -112,7 +118,7 @@ export class MambuLoanAccountSchedule { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -121,7 +127,6 @@ export class MambuLoanAccountSchedule { this.buildClient(auth).get(`loans/${path.loanAccountId}/schedule`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: LoanAccountSchedule, @@ -130,10 +135,13 @@ export class MambuLoanAccountSchedule { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/schedule/previewProcessPMTTransactionally + * * Preview loan account schedule using transactional processing for PMT. */ public previewProcessPmtTransactionally({ @@ -149,7 +157,7 @@ export class MambuLoanAccountSchedule { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -157,7 +165,6 @@ export class MambuLoanAccountSchedule { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/schedule/previewProcessPMTTransactionally`, { headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 200: LoanAccountPreviewProcessPMTTransactionally, @@ -166,10 +173,13 @@ export class MambuLoanAccountSchedule { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/schedule:preview + * * Preview loan account schedule for non-existent loan account */ public previewSchedule({ @@ -185,7 +195,7 @@ export class MambuLoanAccountSchedule { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -197,9 +207,8 @@ export class MambuLoanAccountSchedule { return this.awaitResponse( this.buildClient(auth).post('loans/schedule:preview', { - json: body, + json: _body.right as PreviewLoanAccountSchedule, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 200: LoanAccountSchedule, @@ -207,10 +216,13 @@ export class MambuLoanAccountSchedule { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/schedule:previewTranches + * * Preview loan account schedule for non-existent loan account */ public previewTranchesOnSchedule({ @@ -232,7 +244,7 @@ export class MambuLoanAccountSchedule { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -244,9 +256,8 @@ export class MambuLoanAccountSchedule { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/schedule:previewTranches`, { - json: body, + json: _body.right as PreviewTranchesOnScheduleRequest, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 200: LoanAccountSchedule, @@ -254,6 +265,7 @@ export class MambuLoanAccountSchedule { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } @@ -278,44 +290,45 @@ export class MambuLoanAccountSchedule { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -323,8 +336,7 @@ export class MambuLoanAccountSchedule { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -332,21 +344,21 @@ export class MambuLoanAccountSchedule { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/loan-account-tranches/rest.client.ts b/src/loan-account-tranches/rest.client.ts index 7ef0cf4..e1f4855 100644 --- a/src/loan-account-tranches/rest.client.ts +++ b/src/loan-account-tranches/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { EditTranchesRequest, EditTranchesResponse, ErrorResponse, GetTranchesResponse } from './rest.type.js' @@ -16,7 +16,7 @@ import { EditTranchesRequest, EditTranchesResponse, ErrorResponse, GetTranchesRe * loans/tranches */ export class MambuLoanAccountTranches { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuLoanAccountTranches { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * PUT /loans/{loanAccountId}/tranches + * * Update loan account tranches list */ public editTranches({ @@ -63,7 +67,7 @@ export class MambuLoanAccountTranches { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -75,9 +79,8 @@ export class MambuLoanAccountTranches { return this.awaitResponse( this.buildClient(auth).put(`loans/${path.loanAccountId}/tranches`, { - json: body, + json: _body.right as EditTranchesRequest, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: EditTranchesResponse, @@ -86,10 +89,13 @@ export class MambuLoanAccountTranches { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/{loanAccountId}/tranches + * * Get loan account tranches list */ public getTranches({ @@ -103,7 +109,7 @@ export class MambuLoanAccountTranches { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -111,7 +117,6 @@ export class MambuLoanAccountTranches { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/tranches`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetTranchesResponse, @@ -119,6 +124,7 @@ export class MambuLoanAccountTranches { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } @@ -143,44 +149,45 @@ export class MambuLoanAccountTranches { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -188,8 +195,7 @@ export class MambuLoanAccountTranches { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -197,21 +203,21 @@ export class MambuLoanAccountTranches { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/loan-accounts/rest.client.ts b/src/loan-accounts/rest.client.ts index f60aa25..7dd85c3 100644 --- a/src/loan-accounts/rest.client.ts +++ b/src/loan-accounts/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ApplyInterestInput, @@ -58,7 +58,7 @@ import { * loans */ export class MambuLoanAccounts { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -73,22 +73,26 @@ export class MambuLoanAccounts { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /loans/{loanAccountId}:applyInterest + * * Apply accrued interest */ public applyInterest({ @@ -112,7 +116,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -124,9 +128,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:applyInterest`, { - json: body, + json: _body.right as ApplyInterestInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -136,10 +139,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}/plannedfees:apply + * * ApplY planned fees from the past installments, as backdated or from future installments, on the first pending installment */ public applyPlannedFees({ @@ -163,7 +169,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -175,9 +181,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/plannedfees:apply`, { - json: body, + json: _body.right as PlannedFeeKeys, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -187,10 +192,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}:changeArrearsSettings + * * Change arrears settings for loan account */ public changeArrearsSettings({ @@ -214,7 +222,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -226,9 +234,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changeArrearsSettings`, { - json: body, + json: _body.right as ChangeArrearsSettingsInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -238,10 +245,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}:changeDueDatesSettings + * * Change due dates settings for loan account */ public changeDueDatesSettings({ @@ -265,7 +275,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -277,9 +287,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changeDueDatesSettings`, { - json: body, + json: _body.right as ChangeDueDatesSettingsInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -289,10 +298,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}:changeInterestRate + * * Change loan account interest rate */ public changeInterestRate({ @@ -316,7 +328,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -328,9 +340,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changeInterestRate`, { - json: body, + json: _body.right as ChangeInterestRateLoanAccountInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -340,10 +351,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}:changePeriodicPayment + * * Change the periodic payment amount for an active loan, so that it is still possible to have principal and interest installments, but with a smaller or greater total due amount than the initial one. */ public changePeriodicPayment({ @@ -367,7 +381,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -379,9 +393,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changePeriodicPayment`, { - json: body, + json: _body.right as ChangePeriodicPaymentLoanAccountInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -391,10 +404,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}:changeRepaymentValue + * * Change repayment value for loan account */ public changeRepaymentValue({ @@ -418,7 +434,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -430,9 +446,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changeRepaymentValue`, { - json: body, + json: _body.right as ChangeRepaymentValueLoanAccountInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -442,10 +457,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}:changeState + * * Change loan account state */ public changeState({ @@ -469,7 +487,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -481,9 +499,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changeState`, { - json: body, + json: _body.right as LoanAccountAction, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -493,10 +510,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans + * * Create loan account */ public create({ @@ -513,7 +533,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -525,9 +545,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post('loans', { - json: body, + json: _body.right as LoanAccount, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -536,10 +555,13 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/cards + * * Represents the information needed to create and associate a new card to an account. */ public createCard({ @@ -563,7 +585,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -575,9 +597,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/cards`, { - json: body, + json: _body.right as Card, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -587,10 +608,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}/funding + * * Create funding sources for a loan account */ public createLoanAccountFundingSources({ @@ -614,7 +638,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -626,9 +650,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/funding`, { - json: body, + json: _body.right as CreateLoanAccountFundingSourcesRequest, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -638,10 +661,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/plannedfees + * * Create planned fees */ public createPlannedFees({ @@ -665,7 +691,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -677,9 +703,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/plannedfees`, { - json: body, + json: _body.right as CreatePlannedFeesRequest, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -689,10 +714,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /loans/{loanAccountId} + * * Delete loan account */ public delete({ @@ -707,15 +735,13 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`loans/${path.loanAccountId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`loans/${path.loanAccountId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -723,10 +749,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * DELETE /loans/{loanAccountId}/cards/{cardReferenceToken} + * * Represents the information needed to delete a card associated to an account using its reference token. */ public deleteCard({ @@ -741,15 +770,13 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`loans/${path.loanAccountId}/cards/${path.cardReferenceToken}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`loans/${path.loanAccountId}/cards/${path.cardReferenceToken}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -757,10 +784,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * DELETE /loans/{loanAccountId}/funding + * * Delete loan account funding sources */ public deleteFundingSources({ @@ -775,15 +805,13 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`loans/${path.loanAccountId}/funding`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`loans/${path.loanAccountId}/funding`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -791,10 +819,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * DELETE /loans/{loanAccountId}/plannedfees/{plannedInstallmentFeeKey} + * * Delete planned fee */ public deletePlannedFees({ @@ -809,15 +840,13 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`loans/${path.loanAccountId}/plannedfees/${path.plannedInstallmentFeeKey}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`loans/${path.loanAccountId}/plannedfees/${path.plannedInstallmentFeeKey}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -825,10 +854,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * DELETE /loans/{loanAccountId}/funding/{fundEncodedKey} + * * Delete loan account funding source */ public deleteSingleFundingSource({ @@ -843,15 +875,13 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`loans/${path.loanAccountId}/funding/${path.fundEncodedKey}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`loans/${path.loanAccountId}/funding/${path.fundEncodedKey}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -859,10 +889,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /loans + * * Get loan accounts */ public getAll({ @@ -891,7 +924,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -900,7 +933,6 @@ export class MambuLoanAccounts { this.buildClient(auth).get('loans', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -908,10 +940,13 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/{loanAccountId}/authorizationholds + * * Get authorization holds related to a loan account, ordered from newest to oldest by creation date */ public getAllAuthorizationHolds({ @@ -931,7 +966,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -940,7 +975,6 @@ export class MambuLoanAccounts { this.buildClient(auth).get(`loans/${path.loanAccountId}/authorizationholds`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllAuthorizationHoldsResponse, @@ -949,10 +983,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/{loanAccountId}/cards + * * Get cards associated with an account */ public getAllCards({ @@ -967,7 +1004,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -975,7 +1012,6 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/cards`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllCardsResponse, @@ -984,10 +1020,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/{loanAccountId}/plannedfees + * * Get planned fees */ public getAllPlannedFees({ @@ -1001,7 +1040,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1009,7 +1048,6 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/plannedfees`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllPlannedFeesResponse, @@ -1017,10 +1055,13 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/{loanAccountId} + * * Get loan account */ public getById({ @@ -1036,7 +1077,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1045,7 +1086,6 @@ export class MambuLoanAccounts { this.buildClient(auth).get(`loans/${path.loanAccountId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: LoanAccount, @@ -1054,10 +1094,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/{loanAccountId}/templates/{templateId} + * * Get loan account document */ public getLoanAccountDocument({ @@ -1077,7 +1120,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1086,7 +1129,6 @@ export class MambuLoanAccounts { this.buildClient(auth).get(`loans/${path.loanAccountId}/templates/${path.templateId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetLoanAccountDocumentResponse, @@ -1095,10 +1137,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/{loanAccountId}/templates/{templateId}/pdf + * * Download loan account document PDF */ public getPdfDocument({ @@ -1118,7 +1163,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1126,7 +1171,6 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/templates/${path.templateId}/pdf`, { searchParams: query ?? {}, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -1135,10 +1179,13 @@ export class MambuLoanAccounts { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * POST /loans:previewSchedule + * * Preview loan account schedule for non-existent loan account */ public getPreviewLoanAccountSchedule({ @@ -1153,7 +1200,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1165,9 +1212,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post('loans:previewSchedule', { - json: body, + json: _body.right as PreviewLoanAccountSchedule, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: LoanAccountSchedule, @@ -1175,10 +1221,13 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/{loanAccountId}:versions + * * Get all versions of loan account */ public getVersionsById({ @@ -1194,7 +1243,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1203,7 +1252,6 @@ export class MambuLoanAccounts { this.buildClient(auth).get(`loans/${path.loanAccountId}:versions`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetVersionsByIdResponse, @@ -1212,10 +1260,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /loans/{loanAccountId} + * * Partially update loan account */ public patch({ @@ -1232,7 +1283,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1244,8 +1295,7 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).patch(`loans/${path.loanAccountId}`, { - json: body, - responseType: 'text', + json: _body.right as PatchRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -1254,10 +1304,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PATCH /loans/{loanAccountId}/funding/{fundEncodedKey} + * * Update loan account funding source */ public patchFundingSource({ @@ -1278,7 +1331,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1290,8 +1343,7 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).patch(`loans/${path.loanAccountId}/funding/${path.fundEncodedKey}`, { - json: body, - responseType: 'text', + json: _body.right as PatchFundingSourceRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -1300,10 +1352,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}:payOff + * * Pay off loan account */ public payOff({ @@ -1327,7 +1382,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1339,9 +1394,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:payOff`, { - json: body, + json: _body.right as LoanAccountPayOffInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1351,10 +1405,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}:previewPayOffAmounts + * * Preview pay off due amounts in a future date */ public previewPayOffAmounts({ @@ -1378,7 +1435,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1390,9 +1447,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:previewPayOffAmounts`, { - json: body, + json: _body.right as PreviewPayOffDueAmountsInAFutureDateInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1402,10 +1458,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans:reevaluateCollateral + * * Update collateral asset amounts */ public reevaluateCollateralAssets({ @@ -1422,7 +1481,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1434,9 +1493,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post('loans:reevaluateCollateral', { - json: body, + json: _body.right as CollateralAssetFilter, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1445,10 +1503,13 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}:refinance + * * Refinance loan account */ public refinance({ @@ -1472,7 +1533,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1484,9 +1545,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:refinance`, { - json: body, + json: _body.right as RefinanceLoanAccountAction, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1496,10 +1556,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}:reschedule + * * Reschedule loan account */ public reschedule({ @@ -1523,7 +1586,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1535,9 +1598,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:reschedule`, { - json: body, + json: _body.right as RescheduleLoanAccountAction, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1547,10 +1609,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans:search + * * Search loan accounts */ public search({ @@ -1559,7 +1624,7 @@ export class MambuLoanAccounts { auth = [['apiKey'], ['basic']], }: { body: LoanAccountSearchCriteria - query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } + query?: { offset?: string; limit?: string; paginationDetails?: string; cursor?: string; detailsLevel?: string } auth?: string[][] | string[] }): Promise< | SuccessResponse<'200', SearchResponse> @@ -1571,7 +1636,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1583,10 +1648,9 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post('loans:search', { - json: body, + json: _body.right as LoanAccountSearchCriteria, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: SearchResponse, @@ -1595,10 +1659,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}:terminate + * * Terminate loan account */ public terminateLoanAccount({ @@ -1622,7 +1689,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1634,9 +1701,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:terminate`, { - json: body, + json: _body.right as TerminateLoanAccountInput, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1646,10 +1712,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}:undoRefinance + * * Undo loan account refinance action */ public undoRefinance({ @@ -1673,7 +1742,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1685,9 +1754,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:undoRefinance`, { - json: body, + json: _body.right as LoanActionDetails, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1697,10 +1765,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}:undoReschedule + * * Undo loan account reschedule action */ public undoReschedule({ @@ -1724,7 +1795,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1736,9 +1807,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:undoReschedule`, { - json: body, + json: _body.right as LoanActionDetails, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1748,10 +1818,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * POST /loans/{loanAccountId}:undoWriteOff + * * Undo write off for loan account */ public undoWriteOff({ @@ -1775,7 +1848,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1787,9 +1860,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:undoWriteOff`, { - json: body, + json: _body.right as LoanActionDetails, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1799,10 +1871,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PUT /loans/{loanAccountId} + * * Update loan account */ public update({ @@ -1819,7 +1894,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1831,9 +1906,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).put(`loans/${path.loanAccountId}`, { - json: body, + json: _body.right as LoanAccount, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: LoanAccount, @@ -1842,10 +1916,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /loans/{loanAccountId}/funding + * * Update loan account funding sources */ public updateLoanAccountFundingSources({ @@ -1862,7 +1939,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1874,9 +1951,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).put(`loans/${path.loanAccountId}/funding`, { - json: body, + json: _body.right as UpdateLoanAccountFundingSourcesRequest, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: UpdateLoanAccountFundingSourcesResponse, @@ -1885,10 +1961,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /loans/{loanAccountId}/plannedfees + * * Update planned fees */ public updatePlannedFees({ @@ -1905,7 +1984,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1917,9 +1996,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).put(`loans/${path.loanAccountId}/plannedfees`, { - json: body, + json: _body.right as UpdatePlannedFeesRequest, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: UpdatePlannedFeesResponse, @@ -1928,10 +2006,13 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}:writeOff + * * Write off loan account */ public writeOff({ @@ -1955,7 +2036,7 @@ export class MambuLoanAccounts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -1967,9 +2048,8 @@ export class MambuLoanAccounts { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:writeOff`, { - json: body, + json: _body.right as LoanActionDetails, headers: headers ?? {}, - responseType: 'text', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -1979,6 +2059,7 @@ export class MambuLoanAccounts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } @@ -2003,44 +2084,45 @@ export class MambuLoanAccounts { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -2048,8 +2130,7 @@ export class MambuLoanAccounts { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -2057,21 +2138,21 @@ export class MambuLoanAccounts { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/loan-accounts/rest.type.ts b/src/loan-accounts/rest.type.ts index dfb7d88..3dc5c6c 100644 --- a/src/loan-accounts/rest.type.ts +++ b/src/loan-accounts/rest.type.ts @@ -214,6 +214,10 @@ export interface ApplyInterestInput { * The date up to which interest is to be posted */ interestApplicationDate: string + /** + * Whether the interest amount to apply should be the regular one or interest from arrears. If nothing specified it will be the regular one. + */ + isInterestFromArrears?: boolean | undefined /** * Whether the interest amount to apply should be the regular one or the one accrued during the Payment Holidays. If nothing specified it will be the regular one. */ @@ -1048,6 +1052,7 @@ export interface CustomPaymentAmount { | 'LATE_REPAYMENT_FEE' | 'PAYMENT_DUE_FEE' | 'PENALTY' + | 'INTEREST_FROM_ARREARS' /** * The encodedKey of the predefined fee to be paid. */ @@ -1557,6 +1562,10 @@ export interface InterestSettings { * Indicates whether late interest is accrued for this loan account */ accrueLateInterest?: boolean | undefined + /** + * The effective interest rate. Represents the interest rate for the loan accounts with semi-annually compounding product. + */ + effectiveInterestRate?: number | undefined interestApplicationDays?: DaysInMonth | undefined /** * The interest application method. Represents the interest application method that determines whether the interest gets applied on the account's disbursement or on each repayment. @@ -2504,12 +2513,15 @@ export interface LoanTransaction { | 'WITHDRAWAL_REDRAW_ADJUSTMENT' | 'FEE_APPLIED' | 'FEE_CHARGED' + | 'FEE_CAPITALISED' + | 'SCHEDULE_FIX_APPLIED' | 'FEES_DUE_REDUCED' | 'FEE_ADJUSTMENT' | 'PENALTY_APPLIED' | 'PENALTY_ADJUSTMENT' | 'PENALTIES_DUE_REDUCED' | 'REPAYMENT_ADJUSTMENT' + | 'FEE_CAPITALISED_ADJUSTMENT' | 'PAYMENT_MADE_ADJUSTMENT' | 'INTEREST_RATE_CHANGED' | 'TAX_RATE_CHANGED' @@ -2544,6 +2556,8 @@ export interface LoanTransaction { | 'DUE_DATE_CHANGED_ADJUSTMENT' | 'ACCOUNT_TERMINATED' | 'ACCOUNT_TERMINATED_ADJUSTMENT' + | 'REFUND' + | 'REFUND_ADJUSTMENT' | undefined /** * The user that performed the transaction. @@ -2649,6 +2663,10 @@ export interface PayOffAdjustableAmounts { * The fee amount to be paid for Pay Off action */ feesPaid?: number | undefined + /** + * The interest from arrears amount to be paid for Pay Off action + */ + interestFromArrearsPaid?: number | undefined /** * The interest amount to be paid for Pay Off action */ @@ -2911,6 +2929,10 @@ export interface PreviewPayOffDueAmountsInAFutureDateWrapper { * The interest balance due when pay off the account in a future date */ interestBalance?: number | undefined + /** + * The interest from arrears balance due when pay off the account in a future date + */ + interestFromArrearsBalance?: number | undefined /** * The penalty balance due when pay off the account in a future date */ @@ -3103,6 +3125,7 @@ export interface RefinanceWriteOffAmounts { * Interest write-off amount */ interest?: number | undefined + interestFromArrears?: number | undefined /** * Penalty write-off amount */ @@ -3200,6 +3223,10 @@ export interface RescheduleWriteOffAmounts { * Interest write-off amount */ interest?: number | undefined + /** + * Interest from Arrears write-off amount + */ + interestFromArrears?: number | undefined /** * Penalty write-off amount */ diff --git a/src/loan-accounts/schemas/apply-interest-input.schema.js b/src/loan-accounts/schemas/apply-interest-input.schema.js index 1efa2d8..f80ad72 100644 --- a/src/loan-accounts/schemas/apply-interest-input.schema.js +++ b/src/loan-accounts/schemas/apply-interest-input.schema.js @@ -5,4 +5,4 @@ */ "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApplyInterestInput","type":"object","description":"Represents a request for applying the accrued interest ","properties":{"interestApplicationDate":{"type":"string","description":"The date up to which interest is to be posted","format":"date-time"},"isPaymentHolidaysInterest":{"type":"boolean","description":"Whether the interest amount to apply should be the regular one or the one accrued during the Payment Holidays. If nothing specified it will be the regular one."},"notes":{"type":"string","description":"Additional information for this action"},"paymentHolidaysInterestAmount":{"type":"number","description":"The amount of the Payment Holidays interest to apply"}},"required":["interestApplicationDate"],"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.interestApplicationDate === undefined) && (missing0 = "interestApplicationDate")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.interestApplicationDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.interestApplicationDate === "string")){validate10.errors = [{instancePath:instancePath+"/interestApplicationDate",schemaPath:"#/properties/interestApplicationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.isPaymentHolidaysInterest !== undefined){const _errs4 = errors;if(typeof data.isPaymentHolidaysInterest !== "boolean"){validate10.errors = [{instancePath:instancePath+"/isPaymentHolidaysInterest",schemaPath:"#/properties/isPaymentHolidaysInterest/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs6 = errors;if(typeof data.notes !== "string"){validate10.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentHolidaysInterestAmount !== undefined){let data3 = data.paymentHolidaysInterestAmount;const _errs8 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate10.errors = [{instancePath:instancePath+"/paymentHolidaysInterestAmount",schemaPath:"#/properties/paymentHolidaysInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}}}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApplyInterestInput","type":"object","description":"Represents a request for applying the accrued interest ","properties":{"interestApplicationDate":{"type":"string","description":"The date up to which interest is to be posted","format":"date-time"},"isInterestFromArrears":{"type":"boolean","description":"Whether the interest amount to apply should be the regular one or interest from arrears. If nothing specified it will be the regular one."},"isPaymentHolidaysInterest":{"type":"boolean","description":"Whether the interest amount to apply should be the regular one or the one accrued during the Payment Holidays. If nothing specified it will be the regular one."},"notes":{"type":"string","description":"Additional information for this action"},"paymentHolidaysInterestAmount":{"type":"number","description":"The amount of the Payment Holidays interest to apply"}},"required":["interestApplicationDate"],"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.interestApplicationDate === undefined) && (missing0 = "interestApplicationDate")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.interestApplicationDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.interestApplicationDate === "string")){validate10.errors = [{instancePath:instancePath+"/interestApplicationDate",schemaPath:"#/properties/interestApplicationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.isInterestFromArrears !== undefined){const _errs4 = errors;if(typeof data.isInterestFromArrears !== "boolean"){validate10.errors = [{instancePath:instancePath+"/isInterestFromArrears",schemaPath:"#/properties/isInterestFromArrears/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.isPaymentHolidaysInterest !== undefined){const _errs6 = errors;if(typeof data.isPaymentHolidaysInterest !== "boolean"){validate10.errors = [{instancePath:instancePath+"/isPaymentHolidaysInterest",schemaPath:"#/properties/isPaymentHolidaysInterest/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs8 = errors;if(typeof data.notes !== "string"){validate10.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentHolidaysInterestAmount !== undefined){let data4 = data.paymentHolidaysInterestAmount;const _errs10 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/paymentHolidaysInterestAmount",schemaPath:"#/properties/paymentHolidaysInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}}}}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file diff --git a/src/loan-accounts/schemas/apply-planned-fees-response.schema.js b/src/loan-accounts/schemas/apply-planned-fees-response.schema.js index 5f9c171..1ae8023 100644 --- a/src/loan-accounts/schemas/apply-planned-fees-response.schema.js +++ b/src/loan-accounts/schemas/apply-planned-fees-response.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApplyPlannedFeesResponse","type":"array","items":{"$ref":"#/$defs/LoanTransaction"},"$defs":{"LoanTransaction":{"type":"object","description":"Represents the action performed on a loan account after which the account's amount changes its value.","properties":{"accountBalances":{"$ref":"#/$defs/TransactionBalances"},"adjustmentTransactionKey":{"type":"string","description":"The key of the loan transaction where the adjustment for the transaction was made (if any adjustment was involved)."},"affectedAmounts":{"$ref":"#/$defs/LoanAffectedAmounts"},"amount":{"type":"number","description":"The amount that was added or removed on the loan account."},"bookingDate":{"type":"string","description":"The date when the corresponding journal entry is booked.","format":"date-time"},"branchKey":{"type":"string","description":"The branch where the transaction was performed."},"cardTransaction":{"$ref":"#/$defs/CardTransaction"},"centreKey":{"type":"string","description":"The center where the transaction was performed."},"creationDate":{"type":"string","description":"The date when this loan transaction was created.","format":"date-time"},"currency":{"$ref":"#/$defs/Currency"},"customPaymentAmounts":{"type":"array","description":"The list of custom amounts which the user has paid as part of this transaction.","items":{"$ref":"#/$defs/CustomPaymentAmount"}},"encodedKey":{"type":"string","description":"The encoded key of the loan transaction, which is auto generated, and must be unique."},"externalId":{"type":"string","description":"The external ID of the loan transaction, it is customizable, and must be unique."},"fees":{"type":"array","description":"The amounts that have been applied or paid as part of this transaction and involved predefined fees.","items":{"$ref":"#/$defs/Fee"}},"id":{"type":"string","description":"The ID of the loan transaction, can be generated and customized, and must be unique."},"installmentEncodedKey":{"type":"string","description":"The specific installment encoded key associated to the loan transaction."},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with the loan account. If the account was imported, track which 'migration event' it came from."},"notes":{"type":"string","description":"The notes or description for the loan transaction."},"originalAmount":{"type":"number","description":"The amount that was posted in a foreign currency. This amount was converted using the exchange rate available at entry date and set into the amount field."},"originalCurrencyCode":{"type":"string","description":"The currency in which this transaction was posted. The amounts are stored in the base currency, but the user may enter it in a foreign currency."},"originalTransactionKey":{"type":"string","description":"The encoded key of the transaction that was adjusted as part of this one. Available only for adjustment transactions."},"parentAccountKey":{"type":"string","description":"The key of the parent loan account."},"parentLoanTransactionKey":{"type":"string","description":"The key of the parent loan transaction."},"prepaymentRecalculationMethod":{"description":"The prepayment recalculation method of the loan transaction.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"taxes":{"$ref":"#/$defs/Taxes"},"terms":{"$ref":"#/$defs/LoanTerms"},"tillKey":{"type":"string","description":"The till key associated with the transaction."},"transactionDetails":{"$ref":"#/$defs/TransactionDetails"},"transferDetails":{"$ref":"#/$defs/TransferDetails"},"type":{"description":"The type of loan transaction.","enum":["IMPORT","DISBURSEMENT","DISBURSEMENT_ADJUSTMENT","WRITE_OFF","WRITE_OFF_ADJUSTMENT","REPAYMENT","PAYMENT_MADE","WITHDRAWAL_REDRAW","WITHDRAWAL_REDRAW_ADJUSTMENT","FEE_APPLIED","FEE_CHARGED","FEES_DUE_REDUCED","FEE_ADJUSTMENT","PENALTY_APPLIED","PENALTY_ADJUSTMENT","PENALTIES_DUE_REDUCED","REPAYMENT_ADJUSTMENT","PAYMENT_MADE_ADJUSTMENT","INTEREST_RATE_CHANGED","TAX_RATE_CHANGED","PENALTY_RATE_CHANGED","INTEREST_APPLIED","INTEREST_APPLIED_ADJUSTMENT","INTEREST_DUE_REDUCED","PENALTY_REDUCTION_ADJUSTMENT","FEE_REDUCTION_ADJUSTMENT","INTEREST_REDUCTION_ADJUSTMENT","DEFERRED_INTEREST_APPLIED","DEFERRED_INTEREST_APPLIED_ADJUSTMENT","DEFERRED_INTEREST_PAID","DEFERRED_INTEREST_PAID_ADJUSTMENT","INTEREST_LOCKED","FEE_LOCKED","PENALTY_LOCKED","INTEREST_UNLOCKED","FEE_UNLOCKED","PENALTY_UNLOCKED","REDRAW_TRANSFER","REDRAW_REPAYMENT","REDRAW_TRANSFER_ADJUSTMENT","REDRAW_REPAYMENT_ADJUSTMENT","TRANSFER","TRANSFER_ADJUSTMENT","BRANCH_CHANGED","TERMS_CHANGED","CARD_TRANSACTION_REVERSAL","CARD_TRANSACTION_REVERSAL_ADJUSTMENT","DUE_DATE_CHANGED","DUE_DATE_CHANGED_ADJUSTMENT","ACCOUNT_TERMINATED","ACCOUNT_TERMINATED_ADJUSTMENT"]},"userKey":{"type":"string","description":"The user that performed the transaction."},"valueDate":{"type":"string","description":"The date of the entry in the organization time format and timezone.","format":"date-time"}},"additionalProperties":true},"TransactionBalances":{"type":"object","description":"The balances changed within a transaction.","properties":{"advancePosition":{"type":"number","description":"Captures the advance (prepaid) amount."},"arrearsPosition":{"type":"number","description":"Captures the arrears position amount for the account in arrears."},"expectedPrincipalRedraw":{"type":"number","description":"The difference between principal balance and redraw balance after each transaction performed on the loan account."},"principalBalance":{"type":"number","description":"The account redraw balance captured after the transaction update."},"redrawBalance":{"type":"number","description":"The account redraw balance captured after the transaction update."},"totalBalance":{"type":"number","description":"The running balance still owed for the loan."}},"additionalProperties":true},"LoanAffectedAmounts":{"type":"object","description":"The amounts affected after completing the loan transaction","properties":{"deferredInterestAmount":{"type":"number","description":"How much interest pre-paid was added/removed in account, within this transaction (including taxes)."},"feesAmount":{"type":"number","description":" How much fees was added/removed in account, within this transaction."},"fundersInterestAmount":{"type":"number","description":"How much interest is given to the investors, within this transaction (only for p2p products)"},"interestAmount":{"type":"number","description":"How much interest was added/removed in account, within this transaction (including taxes). If there is any deferred interest amount set in this transaction, that amount should be included in this field."},"interestFromArrearsAmount":{"type":"number","description":"How much interest from arrears was added/removed in account, within this transaction (including taxes)."},"organizationCommissionAmount":{"type":"number","description":"How much interest is given to the organization, within this transaction (only for p2p products)"},"paymentHolidaysInterestAmount":{"type":"number","description":"How much Payment Holidays interest was added/removed in account, within this transaction (including taxes)."},"penaltyAmount":{"type":"number","description":"How much penalties was added/removed in account, within this transaction."},"principalAmount":{"type":"number","description":"How much principal was added/removed in account, within this transaction."}},"additionalProperties":true},"CardTransaction":{"type":"object","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true},"CardAcceptor":{"type":"object","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","description":"The city in which the card acceptor has the business."},"country":{"type":"string","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","description":"The name of the card acceptor."},"state":{"type":"string","description":"The state in which the card acceptor has the business."},"street":{"type":"string","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true},"Currency":{"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true},"CustomPaymentAmount":{"type":"object","description":"Custom payment amount for a specific element type","properties":{"amount":{"type":"number","description":"The amount of the payment paid in the transaction for the given type."},"customPaymentAmountType":{"description":"The type of the custom payment","enum":["PRINCIPAL","INTEREST","MANUAL_FEE","UPFRONT_DISBURSEMENT_FEE","LATE_REPAYMENT_FEE","PAYMENT_DUE_FEE","PENALTY"]},"predefinedFeeKey":{"type":"string","description":"The encodedKey of the predefined fee to be paid."},"taxOnAmount":{"type":"number","description":"The amount of the taxes paid in the transaction for the given type."}},"required":["amount","customPaymentAmountType"],"additionalProperties":true},"Fee":{"type":"object","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MANUAL_PLANNED","DISBURSEMENT","CAPITALIZED_DISBURSEMENT","UPFRONT_DISBURSEMENT","LATE_REPAYMENT","PAYMENT_DUE","PAYMENT_DUE_APPLIED_ON_DUE_DATES","ARBITRARY","IOF","EARLY_REPAYMENT_CHARGE"]}},"required":["predefinedFeeKey"],"additionalProperties":true},"Taxes":{"type":"object","description":"The taxes applied within a transaction.","properties":{"deferredTaxOnInterestAmount":{"type":"number","description":"How much taxes on the interest that was pre-paid were added/removed in account, within this transaction. If there is any deferred tax on interest amount set in this transaction, that amount should be included in this field."},"taxOnFeesAmount":{"type":"number","description":"How much taxes on the fees that were paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestAmount":{"type":"number","description":"How much taxes on the interest that was paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestFromArrearsAmount":{"type":"number","description":"The amount of taxes on the interest from arrears that were applied/paid in account, within this transaction."},"taxOnPaymentHolidaysInterest":{"type":"number","description":"The amount of taxes on the Payment Holidays interest that were added/removed in account, within this transaction."},"taxOnPenaltyAmount":{"type":"number","description":"How much taxes on the penalties that were paid in this transaction were added/removed in account, within this transaction."},"taxRate":{"type":"number","description":"The tax rate that was set or changed in this transaction."}},"additionalProperties":true},"LoanTerms":{"type":"object","description":"The loan transaction terms","properties":{"interestSettings":{"$ref":"#/$defs/TransactionInterestSettings"},"periodicPayment":{"type":"number","description":"The periodic payment value logged when changing it for a Balloon Payments account"},"principalPaymentAmount":{"type":"number","description":"The principal payment flat amount logged when changing it for a Revolving Credit account"},"principalPaymentPercentage":{"type":"number","description":"The principal payment percentage value logged when changing it for a Revolving Credit account"}},"additionalProperties":true},"TransactionInterestSettings":{"type":"object","description":"The interest settings, holds all the properties regarding interests for the loan account.","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate"},"interestRate":{"type":"number","description":"The interest rate. Represents the interest rate for the loan account. The interest on loans is accrued on a daily basis, which allows charging the clients only for the days they actually used the loan amount."}},"additionalProperties":true},"TransactionDetails":{"type":"object","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true},"TransferDetails":{"type":"object","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","description":"The key of the related loan transaction"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents the action performed on a loan account after which the account's amount changes its value.","properties":{"accountBalances":{"$ref":"#/$defs/TransactionBalances"},"adjustmentTransactionKey":{"type":"string","description":"The key of the loan transaction where the adjustment for the transaction was made (if any adjustment was involved)."},"affectedAmounts":{"$ref":"#/$defs/LoanAffectedAmounts"},"amount":{"type":"number","description":"The amount that was added or removed on the loan account."},"bookingDate":{"type":"string","description":"The date when the corresponding journal entry is booked.","format":"date-time"},"branchKey":{"type":"string","description":"The branch where the transaction was performed."},"cardTransaction":{"$ref":"#/$defs/CardTransaction"},"centreKey":{"type":"string","description":"The center where the transaction was performed."},"creationDate":{"type":"string","description":"The date when this loan transaction was created.","format":"date-time"},"currency":{"$ref":"#/$defs/Currency"},"customPaymentAmounts":{"type":"array","description":"The list of custom amounts which the user has paid as part of this transaction.","items":{"$ref":"#/$defs/CustomPaymentAmount"}},"encodedKey":{"type":"string","description":"The encoded key of the loan transaction, which is auto generated, and must be unique."},"externalId":{"type":"string","description":"The external ID of the loan transaction, it is customizable, and must be unique."},"fees":{"type":"array","description":"The amounts that have been applied or paid as part of this transaction and involved predefined fees.","items":{"$ref":"#/$defs/Fee"}},"id":{"type":"string","description":"The ID of the loan transaction, can be generated and customized, and must be unique."},"installmentEncodedKey":{"type":"string","description":"The specific installment encoded key associated to the loan transaction."},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with the loan account. If the account was imported, track which 'migration event' it came from."},"notes":{"type":"string","description":"The notes or description for the loan transaction."},"originalAmount":{"type":"number","description":"The amount that was posted in a foreign currency. This amount was converted using the exchange rate available at entry date and set into the amount field."},"originalCurrencyCode":{"type":"string","description":"The currency in which this transaction was posted. The amounts are stored in the base currency, but the user may enter it in a foreign currency."},"originalTransactionKey":{"type":"string","description":"The encoded key of the transaction that was adjusted as part of this one. Available only for adjustment transactions."},"parentAccountKey":{"type":"string","description":"The key of the parent loan account."},"parentLoanTransactionKey":{"type":"string","description":"The key of the parent loan transaction."},"prepaymentRecalculationMethod":{"description":"The prepayment recalculation method of the loan transaction.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"taxes":{"$ref":"#/$defs/Taxes"},"terms":{"$ref":"#/$defs/LoanTerms"},"tillKey":{"type":"string","description":"The till key associated with the transaction."},"transactionDetails":{"$ref":"#/$defs/TransactionDetails"},"transferDetails":{"$ref":"#/$defs/TransferDetails"},"type":{"description":"The type of loan transaction.","enum":["IMPORT","DISBURSEMENT","DISBURSEMENT_ADJUSTMENT","WRITE_OFF","WRITE_OFF_ADJUSTMENT","REPAYMENT","PAYMENT_MADE","WITHDRAWAL_REDRAW","WITHDRAWAL_REDRAW_ADJUSTMENT","FEE_APPLIED","FEE_CHARGED","FEES_DUE_REDUCED","FEE_ADJUSTMENT","PENALTY_APPLIED","PENALTY_ADJUSTMENT","PENALTIES_DUE_REDUCED","REPAYMENT_ADJUSTMENT","PAYMENT_MADE_ADJUSTMENT","INTEREST_RATE_CHANGED","TAX_RATE_CHANGED","PENALTY_RATE_CHANGED","INTEREST_APPLIED","INTEREST_APPLIED_ADJUSTMENT","INTEREST_DUE_REDUCED","PENALTY_REDUCTION_ADJUSTMENT","FEE_REDUCTION_ADJUSTMENT","INTEREST_REDUCTION_ADJUSTMENT","DEFERRED_INTEREST_APPLIED","DEFERRED_INTEREST_APPLIED_ADJUSTMENT","DEFERRED_INTEREST_PAID","DEFERRED_INTEREST_PAID_ADJUSTMENT","INTEREST_LOCKED","FEE_LOCKED","PENALTY_LOCKED","INTEREST_UNLOCKED","FEE_UNLOCKED","PENALTY_UNLOCKED","REDRAW_TRANSFER","REDRAW_REPAYMENT","REDRAW_TRANSFER_ADJUSTMENT","REDRAW_REPAYMENT_ADJUSTMENT","TRANSFER","TRANSFER_ADJUSTMENT","BRANCH_CHANGED","TERMS_CHANGED","CARD_TRANSACTION_REVERSAL","CARD_TRANSACTION_REVERSAL_ADJUSTMENT","DUE_DATE_CHANGED","DUE_DATE_CHANGED_ADJUSTMENT","ACCOUNT_TERMINATED","ACCOUNT_TERMINATED_ADJUSTMENT"]},"userKey":{"type":"string","description":"The user that performed the transaction."},"valueDate":{"type":"string","description":"The date of the entry in the organization time format and timezone.","format":"date-time"}},"additionalProperties":true};const schema13 = {"type":"object","description":"The balances changed within a transaction.","properties":{"advancePosition":{"type":"number","description":"Captures the advance (prepaid) amount."},"arrearsPosition":{"type":"number","description":"Captures the arrears position amount for the account in arrears."},"expectedPrincipalRedraw":{"type":"number","description":"The difference between principal balance and redraw balance after each transaction performed on the loan account."},"principalBalance":{"type":"number","description":"The account redraw balance captured after the transaction update."},"redrawBalance":{"type":"number","description":"The account redraw balance captured after the transaction update."},"totalBalance":{"type":"number","description":"The running balance still owed for the loan."}},"additionalProperties":true};const schema14 = {"type":"object","description":"The amounts affected after completing the loan transaction","properties":{"deferredInterestAmount":{"type":"number","description":"How much interest pre-paid was added/removed in account, within this transaction (including taxes)."},"feesAmount":{"type":"number","description":" How much fees was added/removed in account, within this transaction."},"fundersInterestAmount":{"type":"number","description":"How much interest is given to the investors, within this transaction (only for p2p products)"},"interestAmount":{"type":"number","description":"How much interest was added/removed in account, within this transaction (including taxes). If there is any deferred interest amount set in this transaction, that amount should be included in this field."},"interestFromArrearsAmount":{"type":"number","description":"How much interest from arrears was added/removed in account, within this transaction (including taxes)."},"organizationCommissionAmount":{"type":"number","description":"How much interest is given to the organization, within this transaction (only for p2p products)"},"paymentHolidaysInterestAmount":{"type":"number","description":"How much Payment Holidays interest was added/removed in account, within this transaction (including taxes)."},"penaltyAmount":{"type":"number","description":"How much penalties was added/removed in account, within this transaction."},"principalAmount":{"type":"number","description":"How much principal was added/removed in account, within this transaction."}},"additionalProperties":true};const schema17 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema18 = {"type":"object","description":"Custom payment amount for a specific element type","properties":{"amount":{"type":"number","description":"The amount of the payment paid in the transaction for the given type."},"customPaymentAmountType":{"description":"The type of the custom payment","enum":["PRINCIPAL","INTEREST","MANUAL_FEE","UPFRONT_DISBURSEMENT_FEE","LATE_REPAYMENT_FEE","PAYMENT_DUE_FEE","PENALTY"]},"predefinedFeeKey":{"type":"string","description":"The encodedKey of the predefined fee to be paid."},"taxOnAmount":{"type":"number","description":"The amount of the taxes paid in the transaction for the given type."}},"required":["amount","customPaymentAmountType"],"additionalProperties":true};const schema19 = {"type":"object","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MANUAL_PLANNED","DISBURSEMENT","CAPITALIZED_DISBURSEMENT","UPFRONT_DISBURSEMENT","LATE_REPAYMENT","PAYMENT_DUE","PAYMENT_DUE_APPLIED_ON_DUE_DATES","ARBITRARY","IOF","EARLY_REPAYMENT_CHARGE"]}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema20 = {"type":"object","description":"The taxes applied within a transaction.","properties":{"deferredTaxOnInterestAmount":{"type":"number","description":"How much taxes on the interest that was pre-paid were added/removed in account, within this transaction. If there is any deferred tax on interest amount set in this transaction, that amount should be included in this field."},"taxOnFeesAmount":{"type":"number","description":"How much taxes on the fees that were paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestAmount":{"type":"number","description":"How much taxes on the interest that was paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestFromArrearsAmount":{"type":"number","description":"The amount of taxes on the interest from arrears that were applied/paid in account, within this transaction."},"taxOnPaymentHolidaysInterest":{"type":"number","description":"The amount of taxes on the Payment Holidays interest that were added/removed in account, within this transaction."},"taxOnPenaltyAmount":{"type":"number","description":"How much taxes on the penalties that were paid in this transaction were added/removed in account, within this transaction."},"taxRate":{"type":"number","description":"The tax rate that was set or changed in this transaction."}},"additionalProperties":true};const schema23 = {"type":"object","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};const schema24 = {"type":"object","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","description":"The key of the related loan transaction"}},"additionalProperties":true};const schema15 = {"type":"object","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true};const schema16 = {"type":"object","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","description":"The city in which the card acceptor has the business."},"country":{"type":"string","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","description":"The name of the card acceptor."},"state":{"type":"string","description":"The state in which the card acceptor has the business."},"street":{"type":"string","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((((data.advice === undefined) && (missing0 = "advice")) || ((data.amount === undefined) && (missing0 = "amount"))) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.advice !== undefined){const _errs2 = errors;if(typeof data.advice !== "boolean"){validate12.errors = [{instancePath:instancePath+"/advice",schemaPath:"#/properties/advice/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data1 = data.amount;const _errs4 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.cardAcceptor !== undefined){let data2 = data.cardAcceptor;const _errs6 = errors;const _errs7 = errors;if(errors === _errs7){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.city !== undefined){const _errs10 = errors;if(typeof data2.city !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptor/properties/city/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data2.country !== undefined){const _errs12 = errors;if(typeof data2.country !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptor/properties/country/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data2.mcc !== undefined){let data5 = data2.mcc;const _errs14 = errors;if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptor/properties/mcc/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data2.name !== undefined){const _errs16 = errors;if(typeof data2.name !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptor/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}if(valid2){if(data2.state !== undefined){const _errs18 = errors;if(typeof data2.state !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptor/properties/state/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs18 === errors;}else {var valid2 = true;}if(valid2){if(data2.street !== undefined){const _errs20 = errors;if(typeof data2.street !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptor/properties/street/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}if(valid2){if(data2.zip !== undefined){const _errs22 = errors;if(typeof data2.zip !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptor/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs22 === errors;}else {var valid2 = true;}}}}}}}}else {validate12.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptor/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.cardToken !== undefined){const _errs24 = errors;if(typeof data.cardToken !== "string"){validate12.errors = [{instancePath:instancePath+"/cardToken",schemaPath:"#/properties/cardToken/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs26 = errors;if(typeof data.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/currencyCode",schemaPath:"#/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs28 = errors;if(typeof data.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs28 === errors;}else {var valid0 = true;}if(valid0){if(data.externalAuthorizationReferenceId !== undefined){const _errs30 = errors;if(typeof data.externalAuthorizationReferenceId !== "string"){validate12.errors = [{instancePath:instancePath+"/externalAuthorizationReferenceId",schemaPath:"#/properties/externalAuthorizationReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs30 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs32 = errors;if(typeof data.externalReferenceId !== "string"){validate12.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs32 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs34 = errors;if(typeof data.userTransactionTime !== "string"){validate12.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs34 === errors;}else {var valid0 = true;}}}}}}}}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}const schema21 = {"type":"object","description":"The loan transaction terms","properties":{"interestSettings":{"$ref":"#/$defs/TransactionInterestSettings"},"periodicPayment":{"type":"number","description":"The periodic payment value logged when changing it for a Balloon Payments account"},"principalPaymentAmount":{"type":"number","description":"The principal payment flat amount logged when changing it for a Revolving Credit account"},"principalPaymentPercentage":{"type":"number","description":"The principal payment percentage value logged when changing it for a Revolving Credit account"}},"additionalProperties":true};const schema22 = {"type":"object","description":"The interest settings, holds all the properties regarding interests for the loan account.","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate"},"interestRate":{"type":"number","description":"The interest rate. Represents the interest rate for the loan account. The interest on loans is accrued on a daily basis, which allows charging the clients only for the days they actually used the loan amount."}},"additionalProperties":true};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.interestSettings !== undefined){let data0 = data.interestSettings;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.indexInterestRate !== undefined){let data1 = data0.indexInterestRate;const _errs6 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate14.errors = [{instancePath:instancePath+"/interestSettings/indexInterestRate",schemaPath:"#/$defs/TransactionInterestSettings/properties/indexInterestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.interestRate !== undefined){let data2 = data0.interestRate;const _errs8 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate14.errors = [{instancePath:instancePath+"/interestSettings/interestRate",schemaPath:"#/$defs/TransactionInterestSettings/properties/interestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}}}else {validate14.errors = [{instancePath:instancePath+"/interestSettings",schemaPath:"#/$defs/TransactionInterestSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.periodicPayment !== undefined){let data3 = data.periodicPayment;const _errs10 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate14.errors = [{instancePath:instancePath+"/periodicPayment",schemaPath:"#/properties/periodicPayment/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.principalPaymentAmount !== undefined){let data4 = data.principalPaymentAmount;const _errs12 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate14.errors = [{instancePath:instancePath+"/principalPaymentAmount",schemaPath:"#/properties/principalPaymentAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.principalPaymentPercentage !== undefined){let data5 = data.principalPaymentPercentage;const _errs14 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate14.errors = [{instancePath:instancePath+"/principalPaymentPercentage",schemaPath:"#/properties/principalPaymentPercentage/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}}}}}else {validate14.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate14.errors = vErrors;return errors === 0;}const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountBalances !== undefined){let data0 = data.accountBalances;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.advancePosition !== undefined){let data1 = data0.advancePosition;const _errs6 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/advancePosition",schemaPath:"#/$defs/TransactionBalances/properties/advancePosition/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.arrearsPosition !== undefined){let data2 = data0.arrearsPosition;const _errs8 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/arrearsPosition",schemaPath:"#/$defs/TransactionBalances/properties/arrearsPosition/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.expectedPrincipalRedraw !== undefined){let data3 = data0.expectedPrincipalRedraw;const _errs10 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/expectedPrincipalRedraw",schemaPath:"#/$defs/TransactionBalances/properties/expectedPrincipalRedraw/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data0.principalBalance !== undefined){let data4 = data0.principalBalance;const _errs12 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/principalBalance",schemaPath:"#/$defs/TransactionBalances/properties/principalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data0.redrawBalance !== undefined){let data5 = data0.redrawBalance;const _errs14 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/redrawBalance",schemaPath:"#/$defs/TransactionBalances/properties/redrawBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data0.totalBalance !== undefined){let data6 = data0.totalBalance;const _errs16 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/totalBalance",schemaPath:"#/$defs/TransactionBalances/properties/totalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}}}}}}}else {validate11.errors = [{instancePath:instancePath+"/accountBalances",schemaPath:"#/$defs/TransactionBalances/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.adjustmentTransactionKey !== undefined){const _errs18 = errors;if(typeof data.adjustmentTransactionKey !== "string"){validate11.errors = [{instancePath:instancePath+"/adjustmentTransactionKey",schemaPath:"#/properties/adjustmentTransactionKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.affectedAmounts !== undefined){let data8 = data.affectedAmounts;const _errs20 = errors;const _errs21 = errors;if(errors === _errs21){if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.deferredInterestAmount !== undefined){let data9 = data8.deferredInterestAmount;const _errs24 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/deferredInterestAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/deferredInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs24 === errors;}else {var valid4 = true;}if(valid4){if(data8.feesAmount !== undefined){let data10 = data8.feesAmount;const _errs26 = errors;if(!((typeof data10 == "number") && (isFinite(data10)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/feesAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/feesAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs26 === errors;}else {var valid4 = true;}if(valid4){if(data8.fundersInterestAmount !== undefined){let data11 = data8.fundersInterestAmount;const _errs28 = errors;if(!((typeof data11 == "number") && (isFinite(data11)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/fundersInterestAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/fundersInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs28 === errors;}else {var valid4 = true;}if(valid4){if(data8.interestAmount !== undefined){let data12 = data8.interestAmount;const _errs30 = errors;if(!((typeof data12 == "number") && (isFinite(data12)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/interestAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/interestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs30 === errors;}else {var valid4 = true;}if(valid4){if(data8.interestFromArrearsAmount !== undefined){let data13 = data8.interestFromArrearsAmount;const _errs32 = errors;if(!((typeof data13 == "number") && (isFinite(data13)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/interestFromArrearsAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/interestFromArrearsAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs32 === errors;}else {var valid4 = true;}if(valid4){if(data8.organizationCommissionAmount !== undefined){let data14 = data8.organizationCommissionAmount;const _errs34 = errors;if(!((typeof data14 == "number") && (isFinite(data14)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/organizationCommissionAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/organizationCommissionAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs34 === errors;}else {var valid4 = true;}if(valid4){if(data8.paymentHolidaysInterestAmount !== undefined){let data15 = data8.paymentHolidaysInterestAmount;const _errs36 = errors;if(!((typeof data15 == "number") && (isFinite(data15)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/paymentHolidaysInterestAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/paymentHolidaysInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs36 === errors;}else {var valid4 = true;}if(valid4){if(data8.penaltyAmount !== undefined){let data16 = data8.penaltyAmount;const _errs38 = errors;if(!((typeof data16 == "number") && (isFinite(data16)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/penaltyAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/penaltyAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs38 === errors;}else {var valid4 = true;}if(valid4){if(data8.principalAmount !== undefined){let data17 = data8.principalAmount;const _errs40 = errors;if(!((typeof data17 == "number") && (isFinite(data17)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/principalAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/principalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs40 === errors;}else {var valid4 = true;}}}}}}}}}}else {validate11.errors = [{instancePath:instancePath+"/affectedAmounts",schemaPath:"#/$defs/LoanAffectedAmounts/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data18 = data.amount;const _errs42 = errors;if(!((typeof data18 == "number") && (isFinite(data18)))){validate11.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs42 === errors;}else {var valid0 = true;}if(valid0){if(data.bookingDate !== undefined){const _errs44 = errors;if(errors === _errs44){if(errors === _errs44){if(!(typeof data.bookingDate === "string")){validate11.errors = [{instancePath:instancePath+"/bookingDate",schemaPath:"#/properties/bookingDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs44 === errors;}else {var valid0 = true;}if(valid0){if(data.branchKey !== undefined){const _errs46 = errors;if(typeof data.branchKey !== "string"){validate11.errors = [{instancePath:instancePath+"/branchKey",schemaPath:"#/properties/branchKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs46 === errors;}else {var valid0 = true;}if(valid0){if(data.cardTransaction !== undefined){const _errs48 = errors;if(!(validate12(data.cardTransaction, {instancePath:instancePath+"/cardTransaction",parentData:data,parentDataProperty:"cardTransaction",rootData}))){vErrors = vErrors === null ? validate12.errors : vErrors.concat(validate12.errors);errors = vErrors.length;}var valid0 = _errs48 === errors;}else {var valid0 = true;}if(valid0){if(data.centreKey !== undefined){const _errs49 = errors;if(typeof data.centreKey !== "string"){validate11.errors = [{instancePath:instancePath+"/centreKey",schemaPath:"#/properties/centreKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs49 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs51 = errors;if(errors === _errs51){if(errors === _errs51){if(!(typeof data.creationDate === "string")){validate11.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs51 === errors;}else {var valid0 = true;}if(valid0){if(data.currency !== undefined){let data24 = data.currency;const _errs53 = errors;const _errs54 = errors;if(errors === _errs54){if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(data24.code !== undefined){const _errs57 = errors;let valid7;valid7 = false;for(const v0 of schema17.properties.code.enum){if(func0(data24.code, v0)){valid7 = true;break;}}if(!valid7){validate11.errors = [{instancePath:instancePath+"/currency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema17.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid6 = _errs57 === errors;}else {var valid6 = true;}if(valid6){if(data24.currencyCode !== undefined){const _errs58 = errors;if(typeof data24.currencyCode !== "string"){validate11.errors = [{instancePath:instancePath+"/currency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs58 === errors;}else {var valid6 = true;}}}else {validate11.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs53 === errors;}else {var valid0 = true;}if(valid0){if(data.customPaymentAmounts !== undefined){let data27 = data.customPaymentAmounts;const _errs60 = errors;if(errors === _errs60){if(Array.isArray(data27)){var valid8 = true;const len0 = data27.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a loan account. A loan account defines the amount that your organization lends to a client. The terms and conditions of a loan account are defined by a loan product. In a loan account, Mambu stores all the information related to disbursements, repayments, interest rates, and withdrawals.","properties":{"accountArrearsSettings":{"$ref":"#/$defs/AccountArrearsSettings"},"accountHolderKey":{"type":"string","description":"The encoded key of the account holder."},"accountHolderType":{"description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"description":"A second state for the loan account. Beside the account state, a second substate is sometimes necessary to provide more information about the exact lifecycle state of a loan account.For example, even if the account state of a loan account is `ACTIVE`, it can also have a substate of `LOCKED`.","enum":["PARTIALLY_DISBURSED","LOCKED","LOCKED_CAPPING","REFINANCED","RESCHEDULED","WITHDRAWN","REPAID","REJECTED","WRITTEN_OFF","TERMINATED"]},"accruedInterest":{"type":"number","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Asset"}},"assignedBranchKey":{"type":"string","description":"The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set."},"assignedCentreKey":{"type":"string","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user this loan account is assigned to."},"balances":{"$ref":"#/$defs/Balances"},"closedDate":{"type":"string","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the line of credit where this account is registered to."},"currency":{"$ref":"#/$defs/Currency"},"daysInArrears":{"type":"integer","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"$ref":"#/$defs/DisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFund"}},"futurePaymentsAcceptance":{"description":"Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account.","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"guarantors":{"type":"array","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantor"}},"id":{"type":"string","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","description":"The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled."},"interestFromArrearsAccrued":{"type":"number","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"$ref":"#/$defs/InterestSettings"},"lastAccountAppraisalDate":{"type":"string","description":"The date the loan account has last been evaluated for interest, principal, fees, and penalties calculations expressed in the organization time format and time zone.","format":"date-time"},"lastInterestAppliedDate":{"type":"string","description":"The date of the last time the loan account had interest applied (stored to interest balance), expressed in the organization time format and time zone.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","description":"The date when the loan account was set for the last time in the `LOCKED` state expressed in the organization time format and time zone. If null, the account is not locked anymore.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the loan account was set to last standing or null; if never set, it is expressed in your organization time format and time zone.","format":"date-time"},"lastTaxRateReviewDate":{"type":"string","description":"The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone.","format":"date-time"},"latePaymentsRecalculationMethod":{"description":"The overdue payments recalculation method inherited from the loan product on which this loan account is based.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"loanAmount":{"type":"number","description":"The loan amount."},"loanName":{"type":"string","description":"The name of the loan account."},"lockedAccountTotalDueType":{"description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","description":"A list with operations which are locked when the account is in the AccountState.LOCKED substate.","items":{"enum":["APPLY_INTEREST","APPLY_FEES","APPLY_PENALTIES"]}},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from."},"modifyInterestForFirstInstallment":{"type":"boolean","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"description":"The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account).","enum":["HORIZONTAL","VERTICAL"]},"penaltySettings":{"$ref":"#/$defs/PenaltySettings"},"plannedInstallmentFees":{"type":"array","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFee"}},"prepaymentSettings":{"$ref":"#/$defs/PrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentAccountSettings"},"productTypeKey":{"type":"string","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"$ref":"#/$defs/LoanAccountRedrawSettings"},"rescheduledAccountKey":{"type":"string","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"$ref":"#/$defs/ScheduleSettings"},"settlementAccountKey":{"type":"string","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","description":"The tax rate."},"terminationDate":{"type":"string","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTranche"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","description":"The interest from arrears balance. Indicates interest from arrears owned by the client, from now on. (total interest from arrears accrued for account - interest from arrears paid)."},"interestFromArrearsDue":{"type":"number","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","description":"The constraint minimum value"},"sharePercentage":{"type":"number","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","description":"Guarantor, holds information about a client guaranty entry. It can be defined based on another client which guarantees (including or not a savings account whether it is a client of the organization using Mambu or not) or based on a value the client holds (an asset)","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true};const schema30 = {"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true};const schema31 = {"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema14 = {"type":"object","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"$ref":"#/$defs/Currency"}},"required":["amount","assetName"],"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.amount === undefined) && (missing0 = "amount")) || ((data.assetName === undefined) && (missing0 = "assetName"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.assetName !== undefined){const _errs4 = errors;if(typeof data.assetName !== "string"){validate12.errors = [{instancePath:instancePath+"/assetName",schemaPath:"#/properties/assetName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.depositAccountKey !== undefined){const _errs6 = errors;if(typeof data.depositAccountKey !== "string"){validate12.errors = [{instancePath:instancePath+"/depositAccountKey",schemaPath:"#/properties/depositAccountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = errors;if(typeof data.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorKey !== undefined){const _errs10 = errors;if(typeof data.guarantorKey !== "string"){validate12.errors = [{instancePath:instancePath+"/guarantorKey",schemaPath:"#/properties/guarantorKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorType !== undefined){let data5 = data.guarantorType;const _errs12 = errors;if(!((data5 === "CLIENT") || (data5 === "GROUP"))){validate12.errors = [{instancePath:instancePath+"/guarantorType",schemaPath:"#/properties/guarantorType/enum",keyword:"enum",params:{allowedValues: schema14.properties.guarantorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data6 = data.originalAmount;const _errs13 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate12.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){let data7 = data.originalCurrency;const _errs15 = errors;const _errs16 = errors;if(errors === _errs16){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.code !== undefined){const _errs19 = errors;let valid3;valid3 = false;for(const v0 of schema15.properties.code.enum){if(func0(data7.code, v0)){valid3 = true;break;}}if(!valid3){validate12.errors = [{instancePath:instancePath+"/originalCurrency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema15.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data7.currencyCode !== undefined){const _errs20 = errors;if(typeof data7.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/originalCurrency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}}}else {validate12.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}const schema18 = {"type":"object","description":"The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees.","properties":{"disbursementDate":{"type":"string","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"firstRepaymentDate":{"type":"string","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"$ref":"#/$defs/LoanTransactionDetails"}},"additionalProperties":true};const schema19 = {"type":"object","description":"The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement.","properties":{"amount":{"type":"number","description":"The amount of the custom fee."},"encodedKey":{"type":"string","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","description":"In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made."},"transactionChannelId":{"type":"string","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.disbursementDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.disbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = errors;if(typeof data.encodedKey !== "string"){validate14.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.expectedDisbursementDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(!(typeof data.expectedDisbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data3 = data.fees;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid1 = true;const len0 = data3.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema26 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate16(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema33 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate18.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate18.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate18.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a loan account. A loan account defines the amount that your organization lends to a client. The terms and conditions of a loan account are defined by a loan product. In a loan account, Mambu stores all the information related to disbursements, repayments, interest rates, and withdrawals.","properties":{"accountArrearsSettings":{"$ref":"#/$defs/AccountArrearsSettings"},"accountHolderKey":{"type":"string","description":"The encoded key of the account holder."},"accountHolderType":{"description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"description":"A second state for the loan account. Beside the account state, a second substate is sometimes necessary to provide more information about the exact lifecycle state of a loan account.For example, even if the account state of a loan account is `ACTIVE`, it can also have a substate of `LOCKED`.","enum":["PARTIALLY_DISBURSED","LOCKED","LOCKED_CAPPING","REFINANCED","RESCHEDULED","WITHDRAWN","REPAID","REJECTED","WRITTEN_OFF","TERMINATED"]},"accruedInterest":{"type":"number","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Asset"}},"assignedBranchKey":{"type":"string","description":"The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set."},"assignedCentreKey":{"type":"string","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user this loan account is assigned to."},"balances":{"$ref":"#/$defs/Balances"},"closedDate":{"type":"string","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the line of credit where this account is registered to."},"currency":{"$ref":"#/$defs/Currency"},"daysInArrears":{"type":"integer","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"$ref":"#/$defs/DisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFund"}},"futurePaymentsAcceptance":{"description":"Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account.","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"guarantors":{"type":"array","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantor"}},"id":{"type":"string","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","description":"The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled."},"interestFromArrearsAccrued":{"type":"number","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"$ref":"#/$defs/InterestSettings"},"lastAccountAppraisalDate":{"type":"string","description":"The date the loan account has last been evaluated for interest, principal, fees, and penalties calculations expressed in the organization time format and time zone.","format":"date-time"},"lastInterestAppliedDate":{"type":"string","description":"The date of the last time the loan account had interest applied (stored to interest balance), expressed in the organization time format and time zone.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","description":"The date when the loan account was set for the last time in the `LOCKED` state expressed in the organization time format and time zone. If null, the account is not locked anymore.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the loan account was set to last standing or null; if never set, it is expressed in your organization time format and time zone.","format":"date-time"},"lastTaxRateReviewDate":{"type":"string","description":"The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone.","format":"date-time"},"latePaymentsRecalculationMethod":{"description":"The overdue payments recalculation method inherited from the loan product on which this loan account is based.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"loanAmount":{"type":"number","description":"The loan amount."},"loanName":{"type":"string","description":"The name of the loan account."},"lockedAccountTotalDueType":{"description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","description":"A list with operations which are locked when the account is in the AccountState.LOCKED substate.","items":{"enum":["APPLY_INTEREST","APPLY_FEES","APPLY_PENALTIES"]}},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from."},"modifyInterestForFirstInstallment":{"type":"boolean","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"description":"The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account).","enum":["HORIZONTAL","VERTICAL"]},"penaltySettings":{"$ref":"#/$defs/PenaltySettings"},"plannedInstallmentFees":{"type":"array","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFee"}},"prepaymentSettings":{"$ref":"#/$defs/PrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentAccountSettings"},"productTypeKey":{"type":"string","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"$ref":"#/$defs/LoanAccountRedrawSettings"},"rescheduledAccountKey":{"type":"string","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"$ref":"#/$defs/ScheduleSettings"},"settlementAccountKey":{"type":"string","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","description":"The tax rate."},"terminationDate":{"type":"string","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTranche"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","description":"The interest from arrears balance. Indicates interest from arrears owned by the client, from now on. (total interest from arrears accrued for account - interest from arrears paid)."},"interestFromArrearsDue":{"type":"number","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","description":"The constraint minimum value"},"sharePercentage":{"type":"number","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","description":"Guarantor, holds information about a client guaranty entry. It can be defined based on another client which guarantees (including or not a savings account whether it is a client of the organization using Mambu or not) or based on a value the client holds (an asset)","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true};const schema30 = {"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true};const schema31 = {"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema14 = {"type":"object","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"$ref":"#/$defs/Currency"}},"required":["amount","assetName"],"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.amount === undefined) && (missing0 = "amount")) || ((data.assetName === undefined) && (missing0 = "assetName"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.assetName !== undefined){const _errs4 = errors;if(typeof data.assetName !== "string"){validate12.errors = [{instancePath:instancePath+"/assetName",schemaPath:"#/properties/assetName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.depositAccountKey !== undefined){const _errs6 = errors;if(typeof data.depositAccountKey !== "string"){validate12.errors = [{instancePath:instancePath+"/depositAccountKey",schemaPath:"#/properties/depositAccountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = errors;if(typeof data.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorKey !== undefined){const _errs10 = errors;if(typeof data.guarantorKey !== "string"){validate12.errors = [{instancePath:instancePath+"/guarantorKey",schemaPath:"#/properties/guarantorKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorType !== undefined){let data5 = data.guarantorType;const _errs12 = errors;if(!((data5 === "CLIENT") || (data5 === "GROUP"))){validate12.errors = [{instancePath:instancePath+"/guarantorType",schemaPath:"#/properties/guarantorType/enum",keyword:"enum",params:{allowedValues: schema14.properties.guarantorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data6 = data.originalAmount;const _errs13 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate12.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){let data7 = data.originalCurrency;const _errs15 = errors;const _errs16 = errors;if(errors === _errs16){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.code !== undefined){const _errs19 = errors;let valid3;valid3 = false;for(const v0 of schema15.properties.code.enum){if(func0(data7.code, v0)){valid3 = true;break;}}if(!valid3){validate12.errors = [{instancePath:instancePath+"/originalCurrency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema15.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data7.currencyCode !== undefined){const _errs20 = errors;if(typeof data7.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/originalCurrency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}}}else {validate12.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}const schema18 = {"type":"object","description":"The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees.","properties":{"disbursementDate":{"type":"string","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"firstRepaymentDate":{"type":"string","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"$ref":"#/$defs/LoanTransactionDetails"}},"additionalProperties":true};const schema19 = {"type":"object","description":"The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement.","properties":{"amount":{"type":"number","description":"The amount of the custom fee."},"encodedKey":{"type":"string","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","description":"In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made."},"transactionChannelId":{"type":"string","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.disbursementDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.disbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = errors;if(typeof data.encodedKey !== "string"){validate14.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.expectedDisbursementDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(!(typeof data.expectedDisbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data3 = data.fees;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid1 = true;const len0 = data3.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema26 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate16(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema33 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate18.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate18.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate18.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a loan account. A loan account defines the amount that your organization lends to a client. The terms and conditions of a loan account are defined by a loan product. In a loan account, Mambu stores all the information related to disbursements, repayments, interest rates, and withdrawals.","properties":{"accountArrearsSettings":{"$ref":"#/$defs/AccountArrearsSettings"},"accountHolderKey":{"type":"string","description":"The encoded key of the account holder."},"accountHolderType":{"description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"description":"A second state for the loan account. Beside the account state, a second substate is sometimes necessary to provide more information about the exact lifecycle state of a loan account.For example, even if the account state of a loan account is `ACTIVE`, it can also have a substate of `LOCKED`.","enum":["PARTIALLY_DISBURSED","LOCKED","LOCKED_CAPPING","REFINANCED","RESCHEDULED","WITHDRAWN","REPAID","REJECTED","WRITTEN_OFF","TERMINATED"]},"accruedInterest":{"type":"number","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Asset"}},"assignedBranchKey":{"type":"string","description":"The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set."},"assignedCentreKey":{"type":"string","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user this loan account is assigned to."},"balances":{"$ref":"#/$defs/Balances"},"closedDate":{"type":"string","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the line of credit where this account is registered to."},"currency":{"$ref":"#/$defs/Currency"},"daysInArrears":{"type":"integer","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"$ref":"#/$defs/DisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFund"}},"futurePaymentsAcceptance":{"description":"Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account.","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"guarantors":{"type":"array","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantor"}},"id":{"type":"string","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","description":"The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled."},"interestFromArrearsAccrued":{"type":"number","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"$ref":"#/$defs/InterestSettings"},"lastAccountAppraisalDate":{"type":"string","description":"The date the loan account has last been evaluated for interest, principal, fees, and penalties calculations expressed in the organization time format and time zone.","format":"date-time"},"lastInterestAppliedDate":{"type":"string","description":"The date of the last time the loan account had interest applied (stored to interest balance), expressed in the organization time format and time zone.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","description":"The date when the loan account was set for the last time in the `LOCKED` state expressed in the organization time format and time zone. If null, the account is not locked anymore.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the loan account was set to last standing or null; if never set, it is expressed in your organization time format and time zone.","format":"date-time"},"lastTaxRateReviewDate":{"type":"string","description":"The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone.","format":"date-time"},"latePaymentsRecalculationMethod":{"description":"The overdue payments recalculation method inherited from the loan product on which this loan account is based.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"loanAmount":{"type":"number","description":"The loan amount."},"loanName":{"type":"string","description":"The name of the loan account."},"lockedAccountTotalDueType":{"description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","description":"A list with operations which are locked when the account is in the AccountState.LOCKED substate.","items":{"enum":["APPLY_INTEREST","APPLY_FEES","APPLY_PENALTIES"]}},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from."},"modifyInterestForFirstInstallment":{"type":"boolean","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"description":"The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account).","enum":["HORIZONTAL","VERTICAL"]},"penaltySettings":{"$ref":"#/$defs/PenaltySettings"},"plannedInstallmentFees":{"type":"array","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFee"}},"prepaymentSettings":{"$ref":"#/$defs/PrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentAccountSettings"},"productTypeKey":{"type":"string","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"$ref":"#/$defs/LoanAccountRedrawSettings"},"rescheduledAccountKey":{"type":"string","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"$ref":"#/$defs/ScheduleSettings"},"settlementAccountKey":{"type":"string","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","description":"The tax rate."},"terminationDate":{"type":"string","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTranche"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","description":"The interest from arrears balance. Indicates interest from arrears owned by the client, from now on. (total interest from arrears accrued for account - interest from arrears paid)."},"interestFromArrearsDue":{"type":"number","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","description":"The constraint minimum value"},"sharePercentage":{"type":"number","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","description":"Guarantor, holds information about a client guaranty entry. It can be defined based on another client which guarantees (including or not a savings account whether it is a client of the organization using Mambu or not) or based on a value the client holds (an asset)","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true};const schema30 = {"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true};const schema31 = {"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema14 = {"type":"object","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"$ref":"#/$defs/Currency"}},"required":["amount","assetName"],"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.amount === undefined) && (missing0 = "amount")) || ((data.assetName === undefined) && (missing0 = "assetName"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.assetName !== undefined){const _errs4 = errors;if(typeof data.assetName !== "string"){validate12.errors = [{instancePath:instancePath+"/assetName",schemaPath:"#/properties/assetName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.depositAccountKey !== undefined){const _errs6 = errors;if(typeof data.depositAccountKey !== "string"){validate12.errors = [{instancePath:instancePath+"/depositAccountKey",schemaPath:"#/properties/depositAccountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = errors;if(typeof data.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorKey !== undefined){const _errs10 = errors;if(typeof data.guarantorKey !== "string"){validate12.errors = [{instancePath:instancePath+"/guarantorKey",schemaPath:"#/properties/guarantorKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorType !== undefined){let data5 = data.guarantorType;const _errs12 = errors;if(!((data5 === "CLIENT") || (data5 === "GROUP"))){validate12.errors = [{instancePath:instancePath+"/guarantorType",schemaPath:"#/properties/guarantorType/enum",keyword:"enum",params:{allowedValues: schema14.properties.guarantorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data6 = data.originalAmount;const _errs13 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate12.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){let data7 = data.originalCurrency;const _errs15 = errors;const _errs16 = errors;if(errors === _errs16){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.code !== undefined){const _errs19 = errors;let valid3;valid3 = false;for(const v0 of schema15.properties.code.enum){if(func0(data7.code, v0)){valid3 = true;break;}}if(!valid3){validate12.errors = [{instancePath:instancePath+"/originalCurrency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema15.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data7.currencyCode !== undefined){const _errs20 = errors;if(typeof data7.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/originalCurrency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}}}else {validate12.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}const schema18 = {"type":"object","description":"The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees.","properties":{"disbursementDate":{"type":"string","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"firstRepaymentDate":{"type":"string","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"$ref":"#/$defs/LoanTransactionDetails"}},"additionalProperties":true};const schema19 = {"type":"object","description":"The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement.","properties":{"amount":{"type":"number","description":"The amount of the custom fee."},"encodedKey":{"type":"string","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","description":"In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made."},"transactionChannelId":{"type":"string","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.disbursementDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.disbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = errors;if(typeof data.encodedKey !== "string"){validate14.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.expectedDisbursementDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(!(typeof data.expectedDisbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data3 = data.fees;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid1 = true;const len0 = data3.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema26 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate16(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema33 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate18.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate18.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate18.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a loan account. A loan account defines the amount that your organization lends to a client. The terms and conditions of a loan account are defined by a loan product. In a loan account, Mambu stores all the information related to disbursements, repayments, interest rates, and withdrawals.","properties":{"accountArrearsSettings":{"$ref":"#/$defs/AccountArrearsSettings"},"accountHolderKey":{"type":"string","description":"The encoded key of the account holder."},"accountHolderType":{"description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"description":"A second state for the loan account. Beside the account state, a second substate is sometimes necessary to provide more information about the exact lifecycle state of a loan account.For example, even if the account state of a loan account is `ACTIVE`, it can also have a substate of `LOCKED`.","enum":["PARTIALLY_DISBURSED","LOCKED","LOCKED_CAPPING","REFINANCED","RESCHEDULED","WITHDRAWN","REPAID","REJECTED","WRITTEN_OFF","TERMINATED"]},"accruedInterest":{"type":"number","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Asset"}},"assignedBranchKey":{"type":"string","description":"The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set."},"assignedCentreKey":{"type":"string","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user this loan account is assigned to."},"balances":{"$ref":"#/$defs/Balances"},"closedDate":{"type":"string","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the line of credit where this account is registered to."},"currency":{"$ref":"#/$defs/Currency"},"daysInArrears":{"type":"integer","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"$ref":"#/$defs/DisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFund"}},"futurePaymentsAcceptance":{"description":"Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account.","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"guarantors":{"type":"array","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantor"}},"id":{"type":"string","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","description":"The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled."},"interestFromArrearsAccrued":{"type":"number","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"$ref":"#/$defs/InterestSettings"},"lastAccountAppraisalDate":{"type":"string","description":"The date the loan account has last been evaluated for interest, principal, fees, and penalties calculations expressed in the organization time format and time zone.","format":"date-time"},"lastInterestAppliedDate":{"type":"string","description":"The date of the last time the loan account had interest applied (stored to interest balance), expressed in the organization time format and time zone.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","description":"The date when the loan account was set for the last time in the `LOCKED` state expressed in the organization time format and time zone. If null, the account is not locked anymore.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the loan account was set to last standing or null; if never set, it is expressed in your organization time format and time zone.","format":"date-time"},"lastTaxRateReviewDate":{"type":"string","description":"The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone.","format":"date-time"},"latePaymentsRecalculationMethod":{"description":"The overdue payments recalculation method inherited from the loan product on which this loan account is based.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"loanAmount":{"type":"number","description":"The loan amount."},"loanName":{"type":"string","description":"The name of the loan account."},"lockedAccountTotalDueType":{"description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","description":"A list with operations which are locked when the account is in the AccountState.LOCKED substate.","items":{"enum":["APPLY_INTEREST","APPLY_FEES","APPLY_PENALTIES"]}},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from."},"modifyInterestForFirstInstallment":{"type":"boolean","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"description":"The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account).","enum":["HORIZONTAL","VERTICAL"]},"penaltySettings":{"$ref":"#/$defs/PenaltySettings"},"plannedInstallmentFees":{"type":"array","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFee"}},"prepaymentSettings":{"$ref":"#/$defs/PrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentAccountSettings"},"productTypeKey":{"type":"string","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"$ref":"#/$defs/LoanAccountRedrawSettings"},"rescheduledAccountKey":{"type":"string","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"$ref":"#/$defs/ScheduleSettings"},"settlementAccountKey":{"type":"string","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","description":"The tax rate."},"terminationDate":{"type":"string","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTranche"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","description":"The interest from arrears balance. Indicates interest from arrears owned by the client, from now on. (total interest from arrears accrued for account - interest from arrears paid)."},"interestFromArrearsDue":{"type":"number","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","description":"The constraint minimum value"},"sharePercentage":{"type":"number","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","description":"Guarantor, holds information about a client guaranty entry. It can be defined based on another client which guarantees (including or not a savings account whether it is a client of the organization using Mambu or not) or based on a value the client holds (an asset)","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true};const schema30 = {"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true};const schema31 = {"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema14 = {"type":"object","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"$ref":"#/$defs/Currency"}},"required":["amount","assetName"],"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.amount === undefined) && (missing0 = "amount")) || ((data.assetName === undefined) && (missing0 = "assetName"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.assetName !== undefined){const _errs4 = errors;if(typeof data.assetName !== "string"){validate12.errors = [{instancePath:instancePath+"/assetName",schemaPath:"#/properties/assetName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.depositAccountKey !== undefined){const _errs6 = errors;if(typeof data.depositAccountKey !== "string"){validate12.errors = [{instancePath:instancePath+"/depositAccountKey",schemaPath:"#/properties/depositAccountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = errors;if(typeof data.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorKey !== undefined){const _errs10 = errors;if(typeof data.guarantorKey !== "string"){validate12.errors = [{instancePath:instancePath+"/guarantorKey",schemaPath:"#/properties/guarantorKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorType !== undefined){let data5 = data.guarantorType;const _errs12 = errors;if(!((data5 === "CLIENT") || (data5 === "GROUP"))){validate12.errors = [{instancePath:instancePath+"/guarantorType",schemaPath:"#/properties/guarantorType/enum",keyword:"enum",params:{allowedValues: schema14.properties.guarantorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data6 = data.originalAmount;const _errs13 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate12.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){let data7 = data.originalCurrency;const _errs15 = errors;const _errs16 = errors;if(errors === _errs16){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.code !== undefined){const _errs19 = errors;let valid3;valid3 = false;for(const v0 of schema15.properties.code.enum){if(func0(data7.code, v0)){valid3 = true;break;}}if(!valid3){validate12.errors = [{instancePath:instancePath+"/originalCurrency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema15.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data7.currencyCode !== undefined){const _errs20 = errors;if(typeof data7.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/originalCurrency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}}}else {validate12.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}const schema18 = {"type":"object","description":"The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees.","properties":{"disbursementDate":{"type":"string","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"firstRepaymentDate":{"type":"string","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"$ref":"#/$defs/LoanTransactionDetails"}},"additionalProperties":true};const schema19 = {"type":"object","description":"The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement.","properties":{"amount":{"type":"number","description":"The amount of the custom fee."},"encodedKey":{"type":"string","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","description":"In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made."},"transactionChannelId":{"type":"string","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.disbursementDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.disbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = errors;if(typeof data.encodedKey !== "string"){validate14.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.expectedDisbursementDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(!(typeof data.expectedDisbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data3 = data.fees;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid1 = true;const len0 = data3.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema26 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate16(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema33 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate18.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate18.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate18.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema15 = {"type":"object","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","description":"The interest from arrears balance. Indicates interest from arrears owned by the client, from now on. (total interest from arrears accrued for account - interest from arrears paid)."},"interestFromArrearsDue":{"type":"number","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema14 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema20 = {"type":"object","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","description":"The constraint minimum value"},"sharePercentage":{"type":"number","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema21 = {"type":"object","description":"Guarantor, holds information about a client guaranty entry. It can be defined based on another client which guarantees (including or not a savings account whether it is a client of the organization using Mambu or not) or based on a value the client holds (an asset)","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema26 = {"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema27 = {"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema28 = {"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true};const schema29 = {"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true};const schema30 = {"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema13 = {"type":"object","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"$ref":"#/$defs/Currency"}},"required":["amount","assetName"],"additionalProperties":true};function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.amount === undefined) && (missing0 = "amount")) || ((data.assetName === undefined) && (missing0 = "assetName"))){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate11.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.assetName !== undefined){const _errs4 = errors;if(typeof data.assetName !== "string"){validate11.errors = [{instancePath:instancePath+"/assetName",schemaPath:"#/properties/assetName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.depositAccountKey !== undefined){const _errs6 = errors;if(typeof data.depositAccountKey !== "string"){validate11.errors = [{instancePath:instancePath+"/depositAccountKey",schemaPath:"#/properties/depositAccountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = errors;if(typeof data.encodedKey !== "string"){validate11.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorKey !== undefined){const _errs10 = errors;if(typeof data.guarantorKey !== "string"){validate11.errors = [{instancePath:instancePath+"/guarantorKey",schemaPath:"#/properties/guarantorKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorType !== undefined){let data5 = data.guarantorType;const _errs12 = errors;if(!((data5 === "CLIENT") || (data5 === "GROUP"))){validate11.errors = [{instancePath:instancePath+"/guarantorType",schemaPath:"#/properties/guarantorType/enum",keyword:"enum",params:{allowedValues: schema13.properties.guarantorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data6 = data.originalAmount;const _errs13 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate11.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){let data7 = data.originalCurrency;const _errs15 = errors;const _errs16 = errors;if(errors === _errs16){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.code !== undefined){const _errs19 = errors;let valid3;valid3 = false;for(const v0 of schema14.properties.code.enum){if(func0(data7.code, v0)){valid3 = true;break;}}if(!valid3){validate11.errors = [{instancePath:instancePath+"/originalCurrency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema14.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data7.currencyCode !== undefined){const _errs20 = errors;if(typeof data7.currencyCode !== "string"){validate11.errors = [{instancePath:instancePath+"/originalCurrency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}}}else {validate11.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate11.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11.errors = vErrors;return errors === 0;}const schema17 = {"type":"object","description":"The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees.","properties":{"disbursementDate":{"type":"string","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"firstRepaymentDate":{"type":"string","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"$ref":"#/$defs/LoanTransactionDetails"}},"additionalProperties":true};const schema18 = {"type":"object","description":"The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement.","properties":{"amount":{"type":"number","description":"The amount of the custom fee."},"encodedKey":{"type":"string","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema19 = {"type":"object","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","description":"In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made."},"transactionChannelId":{"type":"string","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.disbursementDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.disbursementDate === "string")){validate13.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = errors;if(typeof data.encodedKey !== "string"){validate13.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.expectedDisbursementDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(!(typeof data.expectedDisbursementDate === "string")){validate13.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data3 = data.fees;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid1 = true;const len0 = data3.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema25 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate15(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema32 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema33 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema34 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate17(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate17.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate17.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate17.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate17.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate17.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate17.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema15 = {"type":"object","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","description":"The interest from arrears balance. Indicates interest from arrears owned by the client, from now on. (total interest from arrears accrued for account - interest from arrears paid)."},"interestFromArrearsDue":{"type":"number","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema14 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema20 = {"type":"object","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","description":"The constraint minimum value"},"sharePercentage":{"type":"number","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema21 = {"type":"object","description":"Guarantor, holds information about a client guaranty entry. It can be defined based on another client which guarantees (including or not a savings account whether it is a client of the organization using Mambu or not) or based on a value the client holds (an asset)","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema26 = {"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema27 = {"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema28 = {"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true};const schema29 = {"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true};const schema30 = {"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema13 = {"type":"object","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"$ref":"#/$defs/Currency"}},"required":["amount","assetName"],"additionalProperties":true};function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.amount === undefined) && (missing0 = "amount")) || ((data.assetName === undefined) && (missing0 = "assetName"))){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate11.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.assetName !== undefined){const _errs4 = errors;if(typeof data.assetName !== "string"){validate11.errors = [{instancePath:instancePath+"/assetName",schemaPath:"#/properties/assetName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.depositAccountKey !== undefined){const _errs6 = errors;if(typeof data.depositAccountKey !== "string"){validate11.errors = [{instancePath:instancePath+"/depositAccountKey",schemaPath:"#/properties/depositAccountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = errors;if(typeof data.encodedKey !== "string"){validate11.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorKey !== undefined){const _errs10 = errors;if(typeof data.guarantorKey !== "string"){validate11.errors = [{instancePath:instancePath+"/guarantorKey",schemaPath:"#/properties/guarantorKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorType !== undefined){let data5 = data.guarantorType;const _errs12 = errors;if(!((data5 === "CLIENT") || (data5 === "GROUP"))){validate11.errors = [{instancePath:instancePath+"/guarantorType",schemaPath:"#/properties/guarantorType/enum",keyword:"enum",params:{allowedValues: schema13.properties.guarantorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data6 = data.originalAmount;const _errs13 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate11.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){let data7 = data.originalCurrency;const _errs15 = errors;const _errs16 = errors;if(errors === _errs16){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.code !== undefined){const _errs19 = errors;let valid3;valid3 = false;for(const v0 of schema14.properties.code.enum){if(func0(data7.code, v0)){valid3 = true;break;}}if(!valid3){validate11.errors = [{instancePath:instancePath+"/originalCurrency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema14.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data7.currencyCode !== undefined){const _errs20 = errors;if(typeof data7.currencyCode !== "string"){validate11.errors = [{instancePath:instancePath+"/originalCurrency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}}}else {validate11.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate11.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11.errors = vErrors;return errors === 0;}const schema17 = {"type":"object","description":"The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees.","properties":{"disbursementDate":{"type":"string","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"firstRepaymentDate":{"type":"string","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"$ref":"#/$defs/LoanTransactionDetails"}},"additionalProperties":true};const schema18 = {"type":"object","description":"The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement.","properties":{"amount":{"type":"number","description":"The amount of the custom fee."},"encodedKey":{"type":"string","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema19 = {"type":"object","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","description":"In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made."},"transactionChannelId":{"type":"string","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.disbursementDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.disbursementDate === "string")){validate13.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = errors;if(typeof data.encodedKey !== "string"){validate13.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.expectedDisbursementDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(!(typeof data.expectedDisbursementDate === "string")){validate13.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data3 = data.fees;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid1 = true;const len0 = data3.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema25 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate15(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema32 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema33 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema34 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate17(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate17.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate17.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate17.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate17.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate17.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate17.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate16.errors = [{instancePath:instancePath+"/billingCycleDays/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate16.errors = [{instancePath:instancePath+"/billingCycleDays/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate16.errors = [{instancePath:instancePath+"/billingCycleDays",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data4 = data.fixedDaysOfMonth;const _errs12 = errors;if(errors === _errs12){if(Array.isArray(data4)){var valid5 = true;const len1 = data4.length;for(let i2=0; i2 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate16.errors = [{instancePath:instancePath+"/billingCycleDays/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate16.errors = [{instancePath:instancePath+"/billingCycleDays/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate16.errors = [{instancePath:instancePath+"/billingCycleDays",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data4 = data.fixedDaysOfMonth;const _errs12 = errors;if(errors === _errs12){if(Array.isArray(data4)){var valid5 = true;const len1 = data4.length;for(let i2=0; i2 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate14.errors = [{instancePath:instancePath+"/billingCycleDays/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate14.errors = [{instancePath:instancePath+"/billingCycleDays/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate14.errors = [{instancePath:instancePath+"/billingCycleDays",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data4 = data.fixedDaysOfMonth;const _errs12 = errors;if(errors === _errs12){if(Array.isArray(data4)){var valid5 = true;const len1 = data4.length;for(let i2=0; i2 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate14.errors = [{instancePath:instancePath+"/billingCycleDays/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate14.errors = [{instancePath:instancePath+"/billingCycleDays/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate14.errors = [{instancePath:instancePath+"/billingCycleDays",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data4 = data.fixedDaysOfMonth;const _errs12 = errors;if(errors === _errs12){if(Array.isArray(data4)){var valid5 = true;const len1 = data4.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a loan account. A loan account defines the amount that your organization lends to a client. The terms and conditions of a loan account are defined by a loan product. In a loan account, Mambu stores all the information related to disbursements, repayments, interest rates, and withdrawals.","properties":{"accountArrearsSettings":{"$ref":"#/$defs/AccountArrearsSettings"},"accountHolderKey":{"type":"string","description":"The encoded key of the account holder."},"accountHolderType":{"description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"description":"A second state for the loan account. Beside the account state, a second substate is sometimes necessary to provide more information about the exact lifecycle state of a loan account.For example, even if the account state of a loan account is `ACTIVE`, it can also have a substate of `LOCKED`.","enum":["PARTIALLY_DISBURSED","LOCKED","LOCKED_CAPPING","REFINANCED","RESCHEDULED","WITHDRAWN","REPAID","REJECTED","WRITTEN_OFF","TERMINATED"]},"accruedInterest":{"type":"number","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Asset"}},"assignedBranchKey":{"type":"string","description":"The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set."},"assignedCentreKey":{"type":"string","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user this loan account is assigned to."},"balances":{"$ref":"#/$defs/Balances"},"closedDate":{"type":"string","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the line of credit where this account is registered to."},"currency":{"$ref":"#/$defs/Currency"},"daysInArrears":{"type":"integer","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"$ref":"#/$defs/DisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFund"}},"futurePaymentsAcceptance":{"description":"Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account.","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"guarantors":{"type":"array","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantor"}},"id":{"type":"string","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","description":"The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled."},"interestFromArrearsAccrued":{"type":"number","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"$ref":"#/$defs/InterestSettings"},"lastAccountAppraisalDate":{"type":"string","description":"The date the loan account has last been evaluated for interest, principal, fees, and penalties calculations expressed in the organization time format and time zone.","format":"date-time"},"lastInterestAppliedDate":{"type":"string","description":"The date of the last time the loan account had interest applied (stored to interest balance), expressed in the organization time format and time zone.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","description":"The date when the loan account was set for the last time in the `LOCKED` state expressed in the organization time format and time zone. If null, the account is not locked anymore.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the loan account was set to last standing or null; if never set, it is expressed in your organization time format and time zone.","format":"date-time"},"lastTaxRateReviewDate":{"type":"string","description":"The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone.","format":"date-time"},"latePaymentsRecalculationMethod":{"description":"The overdue payments recalculation method inherited from the loan product on which this loan account is based.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"loanAmount":{"type":"number","description":"The loan amount."},"loanName":{"type":"string","description":"The name of the loan account."},"lockedAccountTotalDueType":{"description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","description":"A list with operations which are locked when the account is in the AccountState.LOCKED substate.","items":{"enum":["APPLY_INTEREST","APPLY_FEES","APPLY_PENALTIES"]}},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from."},"modifyInterestForFirstInstallment":{"type":"boolean","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"description":"The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account).","enum":["HORIZONTAL","VERTICAL"]},"penaltySettings":{"$ref":"#/$defs/PenaltySettings"},"plannedInstallmentFees":{"type":"array","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFee"}},"prepaymentSettings":{"$ref":"#/$defs/PrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentAccountSettings"},"productTypeKey":{"type":"string","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"$ref":"#/$defs/LoanAccountRedrawSettings"},"rescheduledAccountKey":{"type":"string","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"$ref":"#/$defs/ScheduleSettings"},"settlementAccountKey":{"type":"string","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","description":"The tax rate."},"terminationDate":{"type":"string","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTranche"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","description":"The interest from arrears balance. Indicates interest from arrears owned by the client, from now on. (total interest from arrears accrued for account - interest from arrears paid)."},"interestFromArrearsDue":{"type":"number","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","description":"The constraint minimum value"},"sharePercentage":{"type":"number","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","description":"Guarantor, holds information about a client guaranty entry. It can be defined based on another client which guarantees (including or not a savings account whether it is a client of the organization using Mambu or not) or based on a value the client holds (an asset)","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true};const schema30 = {"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true};const schema31 = {"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema14 = {"type":"object","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"$ref":"#/$defs/Currency"}},"required":["amount","assetName"],"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.amount === undefined) && (missing0 = "amount")) || ((data.assetName === undefined) && (missing0 = "assetName"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.assetName !== undefined){const _errs4 = errors;if(typeof data.assetName !== "string"){validate12.errors = [{instancePath:instancePath+"/assetName",schemaPath:"#/properties/assetName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.depositAccountKey !== undefined){const _errs6 = errors;if(typeof data.depositAccountKey !== "string"){validate12.errors = [{instancePath:instancePath+"/depositAccountKey",schemaPath:"#/properties/depositAccountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = errors;if(typeof data.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorKey !== undefined){const _errs10 = errors;if(typeof data.guarantorKey !== "string"){validate12.errors = [{instancePath:instancePath+"/guarantorKey",schemaPath:"#/properties/guarantorKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorType !== undefined){let data5 = data.guarantorType;const _errs12 = errors;if(!((data5 === "CLIENT") || (data5 === "GROUP"))){validate12.errors = [{instancePath:instancePath+"/guarantorType",schemaPath:"#/properties/guarantorType/enum",keyword:"enum",params:{allowedValues: schema14.properties.guarantorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data6 = data.originalAmount;const _errs13 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate12.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){let data7 = data.originalCurrency;const _errs15 = errors;const _errs16 = errors;if(errors === _errs16){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.code !== undefined){const _errs19 = errors;let valid3;valid3 = false;for(const v0 of schema15.properties.code.enum){if(func0(data7.code, v0)){valid3 = true;break;}}if(!valid3){validate12.errors = [{instancePath:instancePath+"/originalCurrency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema15.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data7.currencyCode !== undefined){const _errs20 = errors;if(typeof data7.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/originalCurrency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}}}else {validate12.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}const schema18 = {"type":"object","description":"The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees.","properties":{"disbursementDate":{"type":"string","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"firstRepaymentDate":{"type":"string","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"$ref":"#/$defs/LoanTransactionDetails"}},"additionalProperties":true};const schema19 = {"type":"object","description":"The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement.","properties":{"amount":{"type":"number","description":"The amount of the custom fee."},"encodedKey":{"type":"string","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","description":"In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made."},"transactionChannelId":{"type":"string","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.disbursementDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.disbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = errors;if(typeof data.encodedKey !== "string"){validate14.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.expectedDisbursementDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(!(typeof data.expectedDisbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data3 = data.fees;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid1 = true;const len0 = data3.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema26 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate16(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema33 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate18.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate18.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate18.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"PenaltySettings":{"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFee":{"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettings":{"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true},"PrincipalPaymentAccountSettings":{"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"LoanAccountRedrawSettings":{"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettings":{"type":"object","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"$ref":"#/$defs/BillingCycleDays"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","description":"The default first repayment due date offset, indicates how many days the first repayment due date should be extended(all other due dates from the schedule are relative to first repayment due date - they will also be affected by the offset)"},"fixedDaysOfMonth":{"type":"array","description":"Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"gracePeriod":{"type":"integer","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]},"hasCustomSchedule":{"type":"boolean","description":"Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due"},"paymentPlan":{"type":"array","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPayment"}},"periodicPayment":{"type":"number","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"$ref":"#/$defs/RevolvingAccountSettings"},"principalRepaymentInterval":{"type":"integer","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"scheduleDueDatesMethod":{"description":"The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"description":"The short handling method. Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true},"BillingCycleDays":{"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPayment":{"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettings":{"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTranche":{"type":"object","description":"In some cases organizations may approve loans but not disburse the full amount initially. They would like to spread the disbursement (and risk) over time. Likewise for the client, they may not need the full loan amount up front. They may want to have a loan to buy some equipment for their business but will make one purchase today and another purchase in a few months. In these cases, they don't need the full amount and wouldn't want to pay interest on cash they don't need yet. A solution for this matter is the usage of disbursement in tranches. This class holds the information required for one of this tranche. ","properties":{"amount":{"type":"number","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"$ref":"#/$defs/TrancheDisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"trancheNumber":{"type":"integer","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetails":{"type":"object","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","description":"The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement"},"expectedDisbursementDate":{"type":"string","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a loan account. A loan account defines the amount that your organization lends to a client. The terms and conditions of a loan account are defined by a loan product. In a loan account, Mambu stores all the information related to disbursements, repayments, interest rates, and withdrawals.","properties":{"accountArrearsSettings":{"$ref":"#/$defs/AccountArrearsSettings"},"accountHolderKey":{"type":"string","description":"The encoded key of the account holder."},"accountHolderType":{"description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"description":"A second state for the loan account. Beside the account state, a second substate is sometimes necessary to provide more information about the exact lifecycle state of a loan account.For example, even if the account state of a loan account is `ACTIVE`, it can also have a substate of `LOCKED`.","enum":["PARTIALLY_DISBURSED","LOCKED","LOCKED_CAPPING","REFINANCED","RESCHEDULED","WITHDRAWN","REPAID","REJECTED","WRITTEN_OFF","TERMINATED"]},"accruedInterest":{"type":"number","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Asset"}},"assignedBranchKey":{"type":"string","description":"The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set."},"assignedCentreKey":{"type":"string","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","description":"The key of the user this loan account is assigned to."},"balances":{"$ref":"#/$defs/Balances"},"closedDate":{"type":"string","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","description":"The key to the line of credit where this account is registered to."},"currency":{"$ref":"#/$defs/Currency"},"daysInArrears":{"type":"integer","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"$ref":"#/$defs/DisbursementDetails"},"encodedKey":{"type":"string","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFund"}},"futurePaymentsAcceptance":{"description":"Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account.","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"guarantors":{"type":"array","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantor"}},"id":{"type":"string","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","description":"The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled."},"interestFromArrearsAccrued":{"type":"number","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"$ref":"#/$defs/InterestSettings"},"lastAccountAppraisalDate":{"type":"string","description":"The date the loan account has last been evaluated for interest, principal, fees, and penalties calculations expressed in the organization time format and time zone.","format":"date-time"},"lastInterestAppliedDate":{"type":"string","description":"The date of the last time the loan account had interest applied (stored to interest balance), expressed in the organization time format and time zone.","format":"date-time"},"lastInterestReviewDate":{"type":"string","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","description":"The date when the loan account was set for the last time in the `LOCKED` state expressed in the organization time format and time zone. If null, the account is not locked anymore.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","description":"The date when the loan account was set to last standing or null; if never set, it is expressed in your organization time format and time zone.","format":"date-time"},"lastTaxRateReviewDate":{"type":"string","description":"The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone.","format":"date-time"},"latePaymentsRecalculationMethod":{"description":"The overdue payments recalculation method inherited from the loan product on which this loan account is based.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"loanAmount":{"type":"number","description":"The loan amount."},"loanName":{"type":"string","description":"The name of the loan account."},"lockedAccountTotalDueType":{"description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","description":"A list with operations which are locked when the account is in the AccountState.LOCKED substate.","items":{"enum":["APPLY_INTEREST","APPLY_FEES","APPLY_PENALTIES"]}},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from."},"modifyInterestForFirstInstallment":{"type":"boolean","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"description":"The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account).","enum":["HORIZONTAL","VERTICAL"]},"penaltySettings":{"$ref":"#/$defs/PenaltySettings"},"plannedInstallmentFees":{"type":"array","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFee"}},"prepaymentSettings":{"$ref":"#/$defs/PrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentAccountSettings"},"productTypeKey":{"type":"string","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"$ref":"#/$defs/LoanAccountRedrawSettings"},"rescheduledAccountKey":{"type":"string","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"$ref":"#/$defs/ScheduleSettings"},"settlementAccountKey":{"type":"string","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","description":"The tax rate."},"terminationDate":{"type":"string","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTranche"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","description":"The interest from arrears balance. Indicates interest from arrears owned by the client, from now on. (total interest from arrears accrued for account - interest from arrears paid)."},"interestFromArrearsDue":{"type":"number","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","description":"The constraint minimum value"},"sharePercentage":{"type":"number","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","description":"Guarantor, holds information about a client guaranty entry. It can be defined based on another client which guarantees (including or not a savings account whether it is a client of the organization using Mambu or not) or based on a value the client holds (an asset)","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"description":"The last penalty calculation method, represents on what amount are the penalties calculated.","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"penaltyRate":{"type":"number","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","description":"The date when a planned fee should be applied, overriding installment's due date. It should match the interval of the installment. If it belong to first installment, it should be between disbursement date and installment due date.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","description":"The number of the installment on which the predefined fee is planned. It is used only in the case when fees are created at the same time with the loan account creation or during preview schedule, before account creation, otherwise this should be empty and installmentKey will be used to identify an installment."},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated.","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowanceAmount":{"type":"number"},"ercFreeAllowancePercentage":{"type":"number","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product).","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"additionalProperties":true};const schema30 = {"type":"object","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"type":"number","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit.","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true};const schema31 = {"type":"object","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);const schema14 = {"type":"object","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","description":"The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null."},"encodedKey":{"type":"string","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","description":"The key of the client/group used as the guarantor."},"guarantorType":{"description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"$ref":"#/$defs/Currency"}},"required":["amount","assetName"],"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.amount === undefined) && (missing0 = "amount")) || ((data.assetName === undefined) && (missing0 = "assetName"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.assetName !== undefined){const _errs4 = errors;if(typeof data.assetName !== "string"){validate12.errors = [{instancePath:instancePath+"/assetName",schemaPath:"#/properties/assetName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.depositAccountKey !== undefined){const _errs6 = errors;if(typeof data.depositAccountKey !== "string"){validate12.errors = [{instancePath:instancePath+"/depositAccountKey",schemaPath:"#/properties/depositAccountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = errors;if(typeof data.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorKey !== undefined){const _errs10 = errors;if(typeof data.guarantorKey !== "string"){validate12.errors = [{instancePath:instancePath+"/guarantorKey",schemaPath:"#/properties/guarantorKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.guarantorType !== undefined){let data5 = data.guarantorType;const _errs12 = errors;if(!((data5 === "CLIENT") || (data5 === "GROUP"))){validate12.errors = [{instancePath:instancePath+"/guarantorType",schemaPath:"#/properties/guarantorType/enum",keyword:"enum",params:{allowedValues: schema14.properties.guarantorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data6 = data.originalAmount;const _errs13 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate12.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){let data7 = data.originalCurrency;const _errs15 = errors;const _errs16 = errors;if(errors === _errs16){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.code !== undefined){const _errs19 = errors;let valid3;valid3 = false;for(const v0 of schema15.properties.code.enum){if(func0(data7.code, v0)){valid3 = true;break;}}if(!valid3){validate12.errors = [{instancePath:instancePath+"/originalCurrency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema15.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data7.currencyCode !== undefined){const _errs20 = errors;if(typeof data7.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/originalCurrency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}}}else {validate12.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs15 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}const schema18 = {"type":"object","description":"The the disbursement details it holds the information related to the disbursement details as disbursement date, first repayment date, disbursement fees.","properties":{"disbursementDate":{"type":"string","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFee"}},"firstRepaymentDate":{"type":"string","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"$ref":"#/$defs/LoanTransactionDetails"}},"additionalProperties":true};const schema19 = {"type":"object","description":"The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement.","properties":{"amount":{"type":"number","description":"The amount of the custom fee."},"encodedKey":{"type":"string","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","description":"In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made."},"transactionChannelId":{"type":"string","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.disbursementDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.disbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = errors;if(typeof data.encodedKey !== "string"){validate14.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.expectedDisbursementDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(!(typeof data.expectedDisbursementDate === "string")){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data3 = data.fees;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid1 = true;const len0 = data3.length;for(let i0=0; i0 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema26 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};function validate16(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountInterestRateSettings !== undefined){let data0 = data.accountInterestRateSettings;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["gracePeriod"],"additionalProperties":true};const schema33 = {"type":"object","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","description":"For fixed term loans there is the possibility to define a payment plan. A payment plan consists of multiple periodic payments. This class holds information about a periodic payment.","properties":{"amount":{"type":"number","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"The number of previewed instalments"}},"additionalProperties":true};function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.gracePeriod === undefined) && (missing0 = "gracePeriod")){validate18.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate18.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/properties/amortizationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycle !== undefined){let data1 = data.billingCycle;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.days !== undefined){let data2 = data1.days;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data2)){var valid3 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle/days",schemaPath:"#/$defs/BillingCycleDays/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDays/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultFirstRepaymentDueDateOffset !== undefined){let data4 = data.defaultFirstRepaymentDueDateOffset;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate18.errors = [{instancePath:instancePath+"/defaultFirstRepaymentDueDateOffset",schemaPath:"#/properties/defaultFirstRepaymentDueDateOffset/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data5 = data.fixedDaysOfMonth;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid5 = true;const len1 = data5.length;for(let i2=0; i2 Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuLoanProductsConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/loanproducts.yaml + * * Allows you to get or update the loan products configuration. */ public get({ @@ -58,7 +62,7 @@ export class MambuLoanProductsConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -67,7 +71,6 @@ export class MambuLoanProductsConfiguration { this.buildClient(auth).get('configuration/loanproducts.yaml', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -75,10 +78,13 @@ export class MambuLoanProductsConfiguration { 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/loanproducts.yaml + * * Update loan products configuration */ public update({ @@ -94,7 +100,7 @@ export class MambuLoanProductsConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -102,7 +108,6 @@ export class MambuLoanProductsConfiguration { return this.awaitResponse( this.buildClient(auth).put('configuration/loanproducts.yaml', { headers: headers ?? {}, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -112,50 +117,52 @@ export class MambuLoanProductsConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -163,8 +170,7 @@ export class MambuLoanProductsConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -172,21 +178,21 @@ export class MambuLoanProductsConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/loan-products/rest.client.ts b/src/loan-products/rest.client.ts index 5355e39..4d08b47 100644 --- a/src/loan-products/rest.client.ts +++ b/src/loan-products/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, GetAllResponse, LoanProduct, PatchRequest } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, GetAllResponse, LoanProduct, PatchRequest } from './rest * loanproducts */ export class MambuLoanProducts { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuLoanProducts { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /loanproducts + * * Create loan product */ public create({ @@ -63,7 +67,7 @@ export class MambuLoanProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -75,9 +79,8 @@ export class MambuLoanProducts { return this.awaitResponse( this.buildClient(auth).post('loanproducts', { - json: body, + json: _body.right as LoanProduct, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -86,10 +89,13 @@ export class MambuLoanProducts { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /loanproducts/{loanProductId} + * * Delete loan product */ public delete({ @@ -104,15 +110,13 @@ export class MambuLoanProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`loanproducts/${path.loanProductId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`loanproducts/${path.loanProductId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -120,10 +124,13 @@ export class MambuLoanProducts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /loanproducts + * * Get loan products */ public getAll({ @@ -140,7 +147,7 @@ export class MambuLoanProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -149,7 +156,6 @@ export class MambuLoanProducts { this.buildClient(auth).get('loanproducts', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -157,10 +163,13 @@ export class MambuLoanProducts { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loanproducts/{loanProductId} + * * Get loan product */ public getById({ @@ -176,7 +185,7 @@ export class MambuLoanProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -185,7 +194,6 @@ export class MambuLoanProducts { this.buildClient(auth).get(`loanproducts/${path.loanProductId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: LoanProduct, @@ -194,10 +202,13 @@ export class MambuLoanProducts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /loanproducts/{loanProductId} + * * Partially update loan product */ public patch({ @@ -214,7 +225,7 @@ export class MambuLoanProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -226,8 +237,7 @@ export class MambuLoanProducts { return this.awaitResponse( this.buildClient(auth).patch(`loanproducts/${path.loanProductId}`, { - json: body, - responseType: 'text', + json: _body.right as PatchRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -236,10 +246,13 @@ export class MambuLoanProducts { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PUT /loanproducts/{loanProductId} + * * Update loan product */ public update({ @@ -256,7 +269,7 @@ export class MambuLoanProducts { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -268,9 +281,8 @@ export class MambuLoanProducts { return this.awaitResponse( this.buildClient(auth).put(`loanproducts/${path.loanProductId}`, { - json: body, + json: _body.right as LoanProduct, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: LoanProduct, @@ -279,6 +291,7 @@ export class MambuLoanProducts { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -303,44 +316,45 @@ export class MambuLoanProducts { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -348,8 +362,7 @@ export class MambuLoanProducts { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -357,21 +370,21 @@ export class MambuLoanProducts { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/loan-products/rest.type.ts b/src/loan-products/rest.type.ts index 489020e..490e675 100644 --- a/src/loan-products/rest.type.ts +++ b/src/loan-products/rest.type.ts @@ -16,7 +16,7 @@ import { validate as PatchRequestValidator } from './schemas/patch-request.schem */ export interface AccountingSettings { /** - * A list of accounting rules for a product. + * The calculation method used for accounting. */ accountingMethod: 'NONE' | 'CASH' | 'ACCRUAL' /** @@ -28,7 +28,7 @@ export interface AccountingSettings { */ interestAccrualCalculation?: 'NONE' | 'AGGREGATED_AMOUNT' | 'BREAKDOWN_PER_ACCOUNT' | undefined /** - * A list of accounting rules for a product. + * The interval defined for a product when the interest accrues should be maintained. */ interestAccruedAccountingMethod?: 'NONE' | 'DAILY' | 'END_OF_MONTH' | undefined } @@ -513,12 +513,14 @@ export interface GLAccountingRule { | 'FUND_SOURCE' | 'WRITE_OFF_EXPENSE' | 'INTEREST_INCOME' + | 'PAYMENT_HOLIDAY_INTEREST_INCOME' | 'TAXES_PAYABLE' | 'FEE_INCOME' | 'PENALTY_INCOME' | 'NEGATIVE_INTEREST_PAYABLE_RECEIVABLE' | 'NEGATIVE_INTEREST_PAYABLE' | 'INTEREST_RECEIVABLE' + | 'PAYMENT_HOLIDAY_INTEREST_RECEIVABLE' | 'FEE_RECEIVABLE' | 'PENALTY_RECEIVABLE' | 'TAXES_RECEIVABLE' @@ -536,6 +538,9 @@ export interface GLAccountingRule { | 'OVERDRAFT_WRITE_OFF_EXPENSE' | 'OVERDRAFT_INTEREST_RECEIVABLE' | 'INTER_BRANCH_TRANSFER' + | 'INTEREST_FROM_ARREARS_INCOME' + | 'INTEREST_FROM_ARREARS_RECEIVABLE' + | 'INTEREST_FROM_ARREARS_WRITE_OFF_EXPENSE' /** * The encoded key of the account that is mapped to the financialResource */ @@ -1288,11 +1293,15 @@ export interface ProductInterestSettings { /** * The frequency on which the accrued interest will be added to the principal for interest calculation. It is used only for InterestType.COMPOUNDING_INTEREST */ - compoundingFrequency?: 'DAILY' | undefined + compoundingFrequency?: 'DAILY' | 'SEMI_ANNUALLY' | undefined /** * The days in year that should be used for loan calculations. */ daysInYear: 'ACTUAL_365_FIXED' | 'ACTUAL_364' | 'ACTUAL_360' | 'ACTUAL_ACTUAL_ISDA' | 'E30_360' | 'BUS_252' | 'E30_42_365' + /** + * Whether interest from arrears is decoupled from regular interest. (Only accepted or returned if the feature is enabled.) + */ + decoupleInterestFromArrears?: boolean | undefined indexRateSettings?: InterestProductSettings | undefined interestApplicationDays?: DaysInMonth | undefined /** diff --git a/src/loan-products/schemas/get-all-response.schema.js b/src/loan-products/schemas/get-all-response.schema.js index 2fb0207..abd5542 100644 --- a/src/loan-products/schemas/get-all-response.schema.js +++ b/src/loan-products/schemas/get-all-response.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"GetAllResponse","type":"array","items":{"$ref":"#/$defs/LoanProduct"},"$defs":{"LoanProduct":{"type":"object","description":"Represents a loan product.","properties":{"accountingSettings":{"$ref":"#/$defs/AccountingSettings"},"accountLinkSettings":{"$ref":"#/$defs/AccountLinkSettings"},"adjustInterestForFirstInstallment":{"type":"boolean","description":"`TRUE` if it is possible to adjust the interest for the first repayment when the first repayment period is different than the repayment frequency, `FALSE` otherwise."},"allowCustomRepaymentAllocation":{"type":"boolean","description":"`TRUE` if an additional payment may be allocated on the account, ignoring the default repayment allocation order, `FALSE` otherwise."},"arrearsSettings":{"$ref":"#/$defs/ProductArrearsSettings"},"availabilitySettings":{"$ref":"#/$defs/ProductAvailabilitySettings"},"category":{"description":"The category of the loan product.","enum":["PERSONAL_LENDING","PURCHASE_FINANCING","RETAIL_MORTGAGES","SME_LENDING","COMMERCIAL","UNCATEGORIZED"]},"creationDate":{"type":"string","description":"The date the loan product was created.","format":"date-time"},"creditArrangementSettings":{"$ref":"#/$defs/CreditArrangementSettings"},"currency":{"$ref":"#/$defs/Currency"},"encodedKey":{"type":"string","description":"The encoded key of the loan product, it is auto generated, and unique."},"feesSettings":{"$ref":"#/$defs/FeesSettings"},"fundingSettings":{"$ref":"#/$defs/FundingSettings"},"gracePeriodSettings":{"$ref":"#/$defs/GracePeriodSettings"},"id":{"type":"string","description":"The ID of the loan product, can be generated and customized, and must be unique."},"interestSettings":{"$ref":"#/$defs/ProductInterestSettings"},"internalControls":{"$ref":"#/$defs/InternalControls"},"lastModifiedDate":{"type":"string","description":"The last date the loan product was updated.","format":"date-time"},"loanAmountSettings":{"$ref":"#/$defs/LoanAmountSettings"},"name":{"type":"string","description":"The name of the loan product."},"newAccountSettings":{"$ref":"#/$defs/NewAccountSettings"},"notes":{"type":"string","description":"The notes or description of the loan product."},"offsetSettings":{"$ref":"#/$defs/OffsetSettings"},"paymentSettings":{"$ref":"#/$defs/PaymentSettings"},"penaltySettings":{"$ref":"#/$defs/ProductPenaltySettings"},"redrawSettings":{"$ref":"#/$defs/ProductRedrawSettings"},"scheduleSettings":{"$ref":"#/$defs/LoanProductScheduleSettings"},"securitySettings":{"$ref":"#/$defs/SecuritySettings"},"state":{"description":"The current state of the loan product.","enum":["ACTIVE","INACTIVE"]},"taxSettings":{"$ref":"#/$defs/TaxSettings"},"templates":{"type":"array","description":"The template documents of the loan product.","items":{"$ref":"#/$defs/DocumentTemplate"}},"type":{"description":"The type of the loan product.","enum":["FIXED_TERM_LOAN","DYNAMIC_TERM_LOAN","INTEREST_FREE_LOAN","TRANCHED_LOAN","REVOLVING_CREDIT","INTEREST_ONLY_EQUAL_INSTALLMENTS"]}},"required":["creditArrangementSettings","id","name","type"],"additionalProperties":true},"AccountingSettings":{"type":"object","description":"Accounting settings, defines the accounting settings for the product.","properties":{"accountingMethod":{"description":"A list of accounting rules for a product.","enum":["NONE","CASH","ACCRUAL"]},"accountingRules":{"type":"array","description":"A list of accounting rules for the product.","items":{"$ref":"#/$defs/GLAccountingRule"}},"interestAccrualCalculation":{"description":"The accounting interest calculation option selected for the product.","enum":["NONE","AGGREGATED_AMOUNT","BREAKDOWN_PER_ACCOUNT"]},"interestAccruedAccountingMethod":{"description":"A list of accounting rules for a product.","enum":["NONE","DAILY","END_OF_MONTH"]}},"required":["accountingMethod"],"additionalProperties":true},"GLAccountingRule":{"type":"object","description":"The GL accounting rule, it maps a financial resource with a GL account for a specific product (i.e loan or saving).","properties":{"encodedKey":{"type":"string","description":"The encoded key of the accounting rule, auto generated, unique."},"financialResource":{"description":"General Ledger Financial Resources used to setup the product accounting rules and determine the credit and debit accounts when logging journal entries","enum":["PORTFOLIO_CONTROL","FUND_SOURCE","WRITE_OFF_EXPENSE","INTEREST_INCOME","TAXES_PAYABLE","FEE_INCOME","PENALTY_INCOME","NEGATIVE_INTEREST_PAYABLE_RECEIVABLE","NEGATIVE_INTEREST_PAYABLE","INTEREST_RECEIVABLE","FEE_RECEIVABLE","PENALTY_RECEIVABLE","TAXES_RECEIVABLE","DEFERRED_INTERESTS_INCOME","DEFERRED_FEE_INCOME","DEFERRED_TAXES","DEPOSIT_REFERENCE","SAVINGS_CONTROL","INTEREST_EXPENSE","INTEREST_PAYABLE","NEGATIVE_INTEREST_INCOME","NEGATIVE_INTEREST_RECEIVABLE","OVERDRAFT_PORTFOLIO_CONTROL","OVERDRAFT_INTEREST_INCOME","OVERDRAFT_WRITE_OFF_EXPENSE","OVERDRAFT_INTEREST_RECEIVABLE","INTER_BRANCH_TRANSFER"]},"glAccountKey":{"type":"string","description":"The encoded key of the account that is mapped to the financialResource"},"transactionChannelKey":{"type":"string","description":"The key of the transaction rule that uses this rule"}},"required":["financialResource","glAccountKey"],"additionalProperties":true},"AccountLinkSettings":{"type":"object","description":"Defines the settings for account linking.","properties":{"enabled":{"type":"boolean","description":"Shows whether the loan accounts created using this product can be linked to a savings account."},"linkableDepositProductKey":{"type":"string","description":"Loan accounts created for this product can only be linked the the savings accounts that use the savings product with this key. If null, the loan accounts for this product can be linked to any savings account."},"linkedAccountOptions":{"type":"array","description":"A set of linked account options.","items":{"enum":["AUTO_LINK_ACCOUNTS","AUTO_CREATE_LINKED_ACCOUNTS"]},"uniqueItems":true},"settlementMethod":{"description":"Set the option of automated transfer that should be made from linked deposit accounts into loan accounts create from this product.","enum":["FULL_DUE_AMOUNTS","PARTIAL_DUE_AMOUNTS","NO_AUTOMATED_TRANSFERS"]}},"required":["enabled"],"additionalProperties":true},"ProductArrearsSettings":{"type":"object","description":"The product arrears settings, shows whether the non working days are taken in consideration or not when applying penalties/late fees or when setting an account into arrears","properties":{"dateCalculationMethod":{"description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","description":"Defines the tolerance monthly date"},"nonWorkingDaysMethod":{"description":"Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears","enum":["INCLUDED","EXCLUDED"]},"toleranceCalculationMethod":{"description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"$ref":"#/$defs/DecimalInterval"},"tolerancePeriod":{"$ref":"#/$defs/IntegerIntervalConstraints"}},"additionalProperties":true},"DecimalInterval":{"type":"object","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","description":"The default value, will be used in case no other value was filled in by the user."},"maxValue":{"type":"number","description":"The maximum value."},"minValue":{"type":"number","description":"The minimum value."}},"additionalProperties":true},"IntegerIntervalConstraints":{"type":"object","description":"Decimal integer, like min/max/default.","properties":{"defaultValue":{"type":"integer","description":"The default value, will be used in case no other value was filled in by the user."},"encodedKey":{"type":"string","description":"The encoded key of the integer constraint, auto generated, unique"},"maxValue":{"type":"integer","description":"The maximum value."},"minValue":{"type":"integer","description":"The minimum value."}},"additionalProperties":true},"ProductAvailabilitySettings":{"type":"object","description":"Holds information about product availability.","properties":{"availableFor":{"type":"array","description":"Holds the entities this product is available for. i.e Individuals","items":{"enum":["INDIVIDUALS","PURE_GROUPS","SOLIDARITY_GROUPS"]},"uniqueItems":true},"branchSettings":{"$ref":"#/$defs/BranchSettings"}},"additionalProperties":true},"BranchSettings":{"type":"object","description":"Holds information about branch availability for the product.","properties":{"availableProductBranches":{"type":"array","description":"Holds the encoded keys of the branches this product should be available for.","items":{"type":"string"}},"forAllBranches":{"type":"boolean","description":"Indicates if this product should be available for all branches"}},"additionalProperties":true},"CreditArrangementSettings":{"type":"object","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"creditArrangementRequirement":{"description":"Shows whether accounts created after this product can/should be part of a line of credit.","enum":["OPTIONAL","REQUIRED","NOT_REQUIRED"]}},"additionalProperties":true},"Currency":{"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true},"FeesSettings":{"type":"object","description":"Defines fees settings for the product.","properties":{"allowArbitraryFees":{"type":"boolean","description":"Only if true users will be able to apply fees, for current object, of type 'Other'; these fees can have any amount."},"fees":{"type":"array","description":"List of all fees that can be applied for accounts of this loan product.","items":{"$ref":"#/$defs/PredefinedFee"}}},"additionalProperties":true},"PredefinedFee":{"type":"object","description":"The response representation of the PredefinedFee. Represents a fee with a defined name and a fixed value.","properties":{"accountingRules":{"type":"array","description":"A list of accounting rules defined for this fee. If null, product default rules are selected.","items":{"$ref":"#/$defs/GLAccountingRule"}},"amortizationSettings":{"$ref":"#/$defs/PeriodIntervalSettings"},"amount":{"type":"number","description":"The amount of the fee"},"amountCalculationFunctionName":{"type":"string","description":"Mambu Function name used for the fee calculation"},"amountCalculationMethod":{"description":"The amount from which the fee is calculated using percentageAmount","enum":["FLAT","LOAN_AMOUNT_PERCENTAGE","REPAYMENT_PRINCIPAL_AMOUNT_PERCENTAGE","LOAN_AMOUNT_PERCENTAGE_NUMBER_OF_INSTALLMENTS","FLAT_NUMBER_OF_INSTALLMENTS","IOF_PERCENTAGE_OF_DISBURSED_AMOUNT","IOF_PERCENTAGE_OF_INSTALLMENT_PRINCIPAL","IOF_PERCENTAGE_OF_LATE_INSTALLMENT_PRINCIPAL","MAMBU_FUNCTION"]},"applyDateMethod":{"description":"Shows when a fee should be applied; to be used with monthly deposit fees","enum":["MONTHLY_FROM_ACTIVATION","FIRST_OF_EVERY_MONTH"]},"creationDate":{"type":"string","description":"Shows the creation date of the fee","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"feeApplication":{"description":"The type of fee application when disbursement is applied","enum":["REQUIRED","OPTIONAL"]},"id":{"type":"string","description":"The id of the fee"},"lastModifiedDate":{"type":"string","description":"Shows the last modified date of the fee","format":"date-time"},"name":{"type":"string","description":"The name of the fee"},"percentageAmount":{"type":"number","description":"The amount of the fee in percents applied to percentSource"},"state":{"description":"Indicates the state of the fee","enum":["ACTIVE","INACTIVE"]},"taxSettings":{"$ref":"#/$defs/FeeTaxSettings"},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MANUAL_PLANNED","DISBURSEMENT","CAPITALIZED_DISBURSEMENT","UPFRONT_DISBURSEMENT","LATE_REPAYMENT","PAYMENT_DUE","PAYMENT_DUE_APPLIED_ON_DUE_DATES","ARBITRARY","IOF","EARLY_REPAYMENT_CHARGE"]}},"required":["feeApplication","state","trigger"],"additionalProperties":true},"PeriodIntervalSettings":{"type":"object","description":"The settings for defining period intervals.","properties":{"amortizationProfile":{"description":"Type of amortization profile used for fee","enum":["NONE","SUM_OF_YEARS_DIGITS","STRAIGHT_LINE","EFFECTIVE_INTEREST_RATE"]},"encodedKey":{"type":"string","description":"The encoded key of the period interval settings, auto generated, unique."},"feeAmortizationUponRescheduleRefinanceOption":{"description":"Flag for signaling if fee amortization should be continued or finished at account reschedule/refinance","enum":["END_AMORTIZATION_ON_THE_ORIGINAL_ACCOUNT","CONTINUE_AMORTIZATION_ON_THE_RESCHEDULED_REFINANCED_ACCOUNT"]},"frequency":{"description":"Frequency settings of the fee amortization","enum":["ACCOUNT_INSTALLMENTS_DUE_DATES","ACCOUNT_INSTALLMENTS_DUE_DATES_DAILY_BOOKING","CUSTOM_INTERVAL"]},"intervalCount":{"type":"integer","description":"Total number of intervals"},"intervalType":{"description":"Defines the options for an interval","enum":["PREDEFINED_INTERVALS","FULL_TERM"]},"periodCount":{"type":"integer","description":"Period count used in conjunction with periodUnit to determine the next date of the interval"},"periodUnit":{"description":"Amortization unit to determine the interval between amortizations","enum":["DAYS","WEEKS","MONTHS","YEARS"]}},"additionalProperties":true},"FeeTaxSettings":{"type":"object","description":"Tax settings for a specific Predefined fee that overrides the tax settings of Loan Product","properties":{"taxableCalculationMethod":{"description":"Marks a specific fee as non-taxable (taxes are not calculated for it).Feature is in the Early Stage. To be enabled by request.","enum":["DEFAULT","NON_TAXABLE","CUSTOM_TAX"]}},"additionalProperties":true},"FundingSettings":{"type":"object","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"enabled":{"type":"boolean","description":"Indicates whether the product has the investor funds enabled or not."},"funderInterestCommission":{"$ref":"#/$defs/DecimalConstraints"},"funderInterestCommissionAllocationType":{"description":"Define how the Interest is allocated to the investors(if the investors can define their own percentages for their own contribution to the loan, or if all of them are using the same percentage).","enum":["PERCENTAGE_OF_LOAN_FUNDING","FIXED_INTEREST_COMMISSIONS"]},"lockFundsAtApproval":{"type":"boolean","description":"Shows whether investor funds are locked or not at the loan account's approval."},"organizationInterestCommission":{"$ref":"#/$defs/DecimalConstraints"},"requiredFunds":{"type":"number","description":"The required investor funds percentage, for opening an account with external funding. If null, the investor funds are not enabled."}},"additionalProperties":true},"DecimalConstraints":{"type":"object","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","description":"The default value, will be used in case no other value was filled in by the user."},"encodedKey":{"type":"string","description":"The encoded key of the decimal constraint, auto generated, unique"},"maxValue":{"type":"number","description":"The maximum value."},"minValue":{"type":"number","description":"The minimum value."}},"additionalProperties":true},"GracePeriodSettings":{"type":"object","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"gracePeriod":{"$ref":"#/$defs/IntegerIntervalConstraints"},"gracePeriodType":{"description":"The grace period type. Representing the type of grace period which is possible for a loan account.","enum":["NONE","PAY_INTEREST_ONLY","INTEREST_FORGIVENESS"]}},"additionalProperties":true},"ProductInterestSettings":{"type":"object","description":"The interest settings, defines constraints regarding interest that will be used on the loan account crated based on this product.","properties":{"accrueLateInterest":{"type":"boolean","description":"Whether late interest should be accrued, applied and paid"},"compoundingFrequency":{"description":"The frequency on which the accrued interest will be added to the principal for interest calculation. It is used only for InterestType.COMPOUNDING_INTEREST","const":"DAILY"},"daysInYear":{"description":"The days in year that should be used for loan calculations.","enum":["ACTUAL_365_FIXED","ACTUAL_364","ACTUAL_360","ACTUAL_ACTUAL_ISDA","E30_360","BUS_252","E30_42_365"]},"indexRateSettings":{"$ref":"#/$defs/InterestProductSettings"},"interestApplicationDays":{"$ref":"#/$defs/DaysInMonth"},"interestApplicationMethod":{"description":"The interest application method. Represents the interest application method that determines whether the interest gets applied on the account's disbursement or on each repayment.","enum":["AFTER_DISBURSEMENT","REPAYMENT_DUE_DATE","FIXED_DAYS_OF_MONTH"]},"interestBalanceCalculationMethod":{"description":"The interest balance calculation method. Represents the option which determines the way the balance for the account's interest is computed.","enum":["ONLY_PRINCIPAL","PRINCIPAL_AND_INTEREST"]},"interestCalculationMethod":{"description":"The interest calculation method. Holds the type of interest calculation method.","enum":["FLAT","DECLINING_BALANCE","DECLINING_BALANCE_DISCOUNTED","EQUAL_INSTALLMENTS"]},"interestRateSettings":{"type":"array","description":"Adjustable interest rates settings","items":{"$ref":"#/$defs/ProductInterestRateSettings"}},"interestType":{"description":"The possible values for how we compute and apply the interest","enum":["SIMPLE_INTEREST","CAPITALIZED_INTEREST","COMPOUNDING_INTEREST"]},"pmtAdjustmentThreshold":{"$ref":"#/$defs/PMTAdjustmentThreshold"},"scheduleInterestDaysCountMethod":{"description":"Shows whether all the installments should compute the interest based on the actual number of days or based on the defined repayment periodicity.","enum":["REPAYMENT_PERIODICITY","ACTUAL_DAYS_COUNT"]}},"required":["daysInYear","interestCalculationMethod","scheduleInterestDaysCountMethod"],"additionalProperties":true},"InterestProductSettings":{"type":"object","description":"The interest settings, defines constraints regarding interest that will be used on the loan account created based on this product.","properties":{"accrueInterestAfterMaturity":{"type":"boolean","description":"If the product supports this option, specify if the interest should be accrued after the account maturity date"},"allowNegativeInterestRate":{"type":"boolean","description":"Indicator whether the loan product allows negative values for interest rate or interest spread"},"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestChargeFrequency":{"description":"The interval used for determining how often is interest charged","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestChargeFrequencyCount":{"type":"integer","description":"the count of units to apply over the interval"},"interestRate":{"$ref":"#/$defs/DecimalInterval"},"interestRateCeilingValue":{"type":"number","description":"Interest spread + index interest rate can't be more than this amount (valid only for index interest rate products)."},"interestRateFloorValue":{"type":"number","description":"Interest spread + index interest rate can't be less than this amount (valid only for index interest rate products)."},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count"},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"description":"The option for how is the interest rate determined when being accrued for an account","enum":["FIXED","TIERED","TIERED_PERIOD","TIERED_BAND"]},"interestRateTiers":{"type":"array","description":"The list of interest rate tiers available for the current settings instance","items":{"$ref":"#/$defs/InterestRateTier"}}},"additionalProperties":true},"InterestRateTier":{"type":"object","description":"Used or TIERED interest rates, holds the values to define how the interest is computed","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"interestRate":{"type":"number","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true},"DaysInMonth":{"type":"object","description":"Enumeration for days of month and method of handling shorter months.","properties":{"daysInMonth":{"type":"array","description":" Specifies the day(s) of the month when the interest application dates should be. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH. Currently only 1 value can be specified.","items":{"type":"integer"}},"shortMonthHandlingMethod":{"description":"Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"ProductInterestRateSettings":{"type":"object","description":"Adjustable interest rates settings","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate settings, auto generated, unique"},"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestRate":{"$ref":"#/$defs/DecimalInterval"},"interestRateCeilingValue":{"type":"number","description":"Maximum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateFloorValue":{"type":"number","description":"Minimum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count. Valid only for index interest rate."},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit. Valid only for index interest rate.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or indexed(interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]}},"required":["interestRateSource"],"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"InternalControls":{"type":"object","description":"Constraints and automated actions and that will be applied on the accounts.","properties":{"dormancyPeriodDays":{"type":"integer","description":"Specifies the number of days for an account to be fully paid in order to auto close it."},"fourEyesPrinciple":{"$ref":"#/$defs/FourEyesPrinciple"},"lockSettings":{"$ref":"#/$defs/LockSettings"}},"additionalProperties":true},"FourEyesPrinciple":{"type":"object","description":"Settings for Four Eyes Principle","properties":{"activeForLoanApproval":{"type":"boolean","description":"Requires separate users to create and approve loan accounts"}},"additionalProperties":true},"LockSettings":{"type":"object","description":"Settings applied when transitioning accounts to Locked state","properties":{"cappingConstraintType":{"description":"Specifies constraint types for capping charges.","enum":["SOFT_CAP","HARD_CAP"]},"cappingMethod":{"description":"Specifies how principal will be used when calculating capping charges.","enum":["OUTSTANDING_PRINCIPAL_PERCENTAGE","ORIGINAL_PRINCIPAL_PERCENTAGE"]},"cappingPercentage":{"type":"number","description":"Specifies the percentage of principal that cannot be exceeded by the sum of interest, fees and penalty balances."},"lockPeriodDays":{"type":"integer","description":"Specifies the number of days for in which the account will be locked if it stays in arrears."}},"additionalProperties":true},"LoanAmountSettings":{"type":"object","description":"The amount settings, holds all amount properties.","properties":{"loanAmount":{"$ref":"#/$defs/AmountDecimalConstraints"},"trancheSettings":{"$ref":"#/$defs/TrancheSettings"}},"additionalProperties":true},"AmountDecimalConstraints":{"type":"object","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","description":"The default value, will be used in case no other value was filled in by the user."},"encodedKey":{"type":"string","description":"The encoded key of the decimal constraint, auto generated, unique"},"maxValue":{"type":"number","description":"The maximum value."},"minValue":{"type":"number","description":"The minimum value."}},"additionalProperties":true},"TrancheSettings":{"type":"object","description":"The tranche settings, indicates the settings regarding tranches in case the product is configured to support tranches.","properties":{"maxNumberOfTranches":{"type":"integer","description":"The number of tranches supported by the loan product"}},"additionalProperties":true},"NewAccountSettings":{"type":"object","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["accountInitialState","idGeneratorType","idPattern"],"additionalProperties":true},"OffsetSettings":{"type":"object","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","description":"Indicates whether the product supports offset"}},"additionalProperties":true},"PaymentSettings":{"type":"object","description":"Defines the payment settings for the loan product and for loans crated based on this product.","properties":{"amortizationMethod":{"description":"Payments Method used by loan accounts for repayments schedule generation.","enum":["STANDARD_PAYMENTS","BALLOON_PAYMENTS","OPTIMIZED_PAYMENTS","PAYMENT_PLAN"]},"latePaymentsRecalculationMethod":{"description":"Recalculate the schedule when late payments are posted on dynamic Equal Installments loans.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"paymentMethod":{"description":"The payment method. Represents the interest payment method that determines whether the payments are made Horizontally (on the Repayments) or Vertically (on the Loan Account)","enum":["HORIZONTAL","VERTICAL"]},"prepaymentSettings":{"$ref":"#/$defs/ProductPrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentProductSettings"},"repaymentAllocationOrder":{"type":"array","description":"A list of basic repayment allocation elements such as the principal, interest & fees.","items":{"enum":["PRINCIPAL","INTEREST","FEE","PENALTY"]}}},"required":["latePaymentsRecalculationMethod","paymentMethod","repaymentAllocationOrder"],"additionalProperties":true},"ProductPrepaymentSettings":{"type":"object","description":"Defines the prepayment settings for the product","properties":{"applyInterestOnPrepaymentMethod":{"description":"Whether the interest on prepayment is applied manual or automatic.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowance":{"type":"number","description":"ERC free allowance in percentage"},"futurePaymentsAcceptance":{"description":"Shows whether the future payments are allowed or not for this product (repayment transactions with entry date set in the future)","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"prepaymentAcceptance":{"description":"Shows whether the pre-payments are allowed or not for this product.","enum":["ACCEPT_PREPAYMENTS","NO_PREPAYMENTS"]},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product)","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"required":["futurePaymentsAcceptance"],"additionalProperties":true},"PrincipalPaymentProductSettings":{"type":"object","description":"Defines the principal payment settings constraints for the loans that will be created based on this product.","properties":{"amount":{"$ref":"#/$defs/AmountDecimalConstraints"},"defaultPrincipalRepaymentInterval":{"type":"integer","description":"How many repayments the principal has to be paid"},"encodedKey":{"type":"string","description":"The encoded key of the settings, auto generated, unique"},"includeFeesInFloorAmount":{"type":"boolean","description":"If true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"If true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"$ref":"#/$defs/DecimalConstraints"},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"ProductPenaltySettings":{"type":"object","description":"Defines the penalty settings for the product that will be used by the loan accounts based on this product","properties":{"loanPenaltyCalculationMethod":{"description":"The penalty calculation method","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"loanPenaltyGracePeriod":{"type":"integer","description":"Number of days to wait before applying the loan penalty amounts"},"penaltyRate":{"$ref":"#/$defs/DecimalConstraints"}},"required":["loanPenaltyCalculationMethod"],"additionalProperties":true},"ProductRedrawSettings":{"type":"object","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true},"LoanProductScheduleSettings":{"type":"object","description":"Defines the settings and constraints for schedule for the loans that are created based on this product.","properties":{"amortizationPeriod":{"$ref":"#/$defs/ProductAmortizationPeriod"},"billingCycles":{"$ref":"#/$defs/BillingCyclesProductSettings"},"defaultRepaymentPeriodCount":{"type":"integer","description":"Interval Repayment Methodology Settings."},"firstRepaymentDueDateOffset":{"$ref":"#/$defs/IntegerIntervalConstraints"},"fixedDaysOfMonth":{"type":"array","description":" Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"interestAccrualSince":{"description":"Represents the moment the interest will start getting accrued.","enum":["DISBURSEMENT","DUE_DATE"]},"numInstallments":{"$ref":"#/$defs/IntegerIntervalConstraints"},"previewSchedule":{"$ref":"#/$defs/PreviewScheduleSettings"},"repaymentMethod":{"description":"The repayment method value","enum":["AMOUNT","INSTALLMENTS"]},"repaymentPeriodUnit":{"description":"The frequency of the loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentReschedulingMethod":{"description":"The repayment rescheduling method used in calculations.","enum":["NONE","NEXT_WORKING_DAY","PREVIOUS_WORKING_DAY","EXTEND_SCHEDULE"]},"repaymentScheduleEditOptions":{"type":"array","description":"Shows the properties from the repayment schedule can be edited.","items":{"enum":["ADJUST_PAYMENT_DATES","ADJUST_PRINCIPAL_PAYMENT_SCHEDULE","ADJUST_INTEREST_PAYMENT_SCHEDULE","ADJUST_FEE_PAYMENT_SCHEDULE","ADJUST_PENALTY_PAYMENT_SCHEDULE","ADJUST_NUMBER_OF_INSTALLMENTS","ADJUST_PAYMENT_HOLIDAYS"]}},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"roundingSettings":{"$ref":"#/$defs/RoundingSettings"},"scheduleDueDatesMethod":{"description":"The methodology used by this product to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"scheduleEditOptionDetails":{"$ref":"#/$defs/RepaymentScheduleEditOptionDetails"},"shortMonthHandlingMethod":{"description":"Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Schedule Due Dates Method is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTHs.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["repaymentReschedulingMethod","repaymentScheduleMethod","scheduleDueDatesMethod"],"additionalProperties":true},"ProductAmortizationPeriod":{"type":"object","description":"It holds information about the loan product amortization period. The PMT is calculated as the loan would have [amortisationPeriod] instalments","properties":{"defaultValue":{"type":"integer","description":"default value"},"maxValue":{"type":"integer","description":"max value"},"minValue":{"type":"integer","description":"min value"}},"additionalProperties":true},"BillingCyclesProductSettings":{"type":"object","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PreviewScheduleSettings":{"type":"object","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","description":"Preview Schedule status."}},"additionalProperties":true},"RoundingSettings":{"type":"object","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"description":"Specifies the rounding repayment schedule method.","enum":["NO_ROUNDING","ROUND_REMAINDER_INTO_LAST_REPAYMENT","ROUND_PRINCIPAL_AND_INTEREST_REMAINDER_INTO_LAST_REPAYMENT"]}},"required":["repaymentCurrencyRounding","repaymentElementsRoundingMethod","roundingRepaymentScheduleMethod"],"additionalProperties":true},"RepaymentScheduleEditOptionDetails":{"type":"object","description":"Holds Repayments Schedule Editing options","properties":{"paymentHolidaysSettings":{"$ref":"#/$defs/PaymentHolidaysSettings"}},"additionalProperties":true},"PaymentHolidaysSettings":{"type":"object","description":"Holds Payment Holidays Settings","properties":{"paymentHolidaysLoanTermOption":{"description":"payment holiday option","enum":["EXTEND_LOAN_TERM","KEEP_THE_SAME_LOAN_TERM"]}},"additionalProperties":true},"SecuritySettings":{"type":"object","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","description":"Shows whether collateral (assets or other goods) are accepted in order to reach required securities percentage from loan amount, as defined in this product."},"isGuarantorsEnabled":{"type":"boolean","description":"Shows whether guarantors (other clients) are accepted in order to reach the required securities percentage from loan amount, as defined in this product."},"requiredGuaranties":{"type":"number","description":"The securities percentage from loan amount that is needed in order for this account to be approved. Null if the securities are not required."}},"additionalProperties":true},"TaxSettings":{"type":"object","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true},"DocumentTemplate":{"type":"object","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","description":"The name the document"},"type":{"description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a loan product.","properties":{"accountingSettings":{"$ref":"#/$defs/AccountingSettings"},"accountLinkSettings":{"$ref":"#/$defs/AccountLinkSettings"},"adjustInterestForFirstInstallment":{"type":"boolean","description":"`TRUE` if it is possible to adjust the interest for the first repayment when the first repayment period is different than the repayment frequency, `FALSE` otherwise."},"allowCustomRepaymentAllocation":{"type":"boolean","description":"`TRUE` if an additional payment may be allocated on the account, ignoring the default repayment allocation order, `FALSE` otherwise."},"arrearsSettings":{"$ref":"#/$defs/ProductArrearsSettings"},"availabilitySettings":{"$ref":"#/$defs/ProductAvailabilitySettings"},"category":{"description":"The category of the loan product.","enum":["PERSONAL_LENDING","PURCHASE_FINANCING","RETAIL_MORTGAGES","SME_LENDING","COMMERCIAL","UNCATEGORIZED"]},"creationDate":{"type":"string","description":"The date the loan product was created.","format":"date-time"},"creditArrangementSettings":{"$ref":"#/$defs/CreditArrangementSettings"},"currency":{"$ref":"#/$defs/Currency"},"encodedKey":{"type":"string","description":"The encoded key of the loan product, it is auto generated, and unique."},"feesSettings":{"$ref":"#/$defs/FeesSettings"},"fundingSettings":{"$ref":"#/$defs/FundingSettings"},"gracePeriodSettings":{"$ref":"#/$defs/GracePeriodSettings"},"id":{"type":"string","description":"The ID of the loan product, can be generated and customized, and must be unique."},"interestSettings":{"$ref":"#/$defs/ProductInterestSettings"},"internalControls":{"$ref":"#/$defs/InternalControls"},"lastModifiedDate":{"type":"string","description":"The last date the loan product was updated.","format":"date-time"},"loanAmountSettings":{"$ref":"#/$defs/LoanAmountSettings"},"name":{"type":"string","description":"The name of the loan product."},"newAccountSettings":{"$ref":"#/$defs/NewAccountSettings"},"notes":{"type":"string","description":"The notes or description of the loan product."},"offsetSettings":{"$ref":"#/$defs/OffsetSettings"},"paymentSettings":{"$ref":"#/$defs/PaymentSettings"},"penaltySettings":{"$ref":"#/$defs/ProductPenaltySettings"},"redrawSettings":{"$ref":"#/$defs/ProductRedrawSettings"},"scheduleSettings":{"$ref":"#/$defs/LoanProductScheduleSettings"},"securitySettings":{"$ref":"#/$defs/SecuritySettings"},"state":{"description":"The current state of the loan product.","enum":["ACTIVE","INACTIVE"]},"taxSettings":{"$ref":"#/$defs/TaxSettings"},"templates":{"type":"array","description":"The template documents of the loan product.","items":{"$ref":"#/$defs/DocumentTemplate"}},"type":{"description":"The type of the loan product.","enum":["FIXED_TERM_LOAN","DYNAMIC_TERM_LOAN","INTEREST_FREE_LOAN","TRANCHED_LOAN","REVOLVING_CREDIT","INTEREST_ONLY_EQUAL_INSTALLMENTS"]}},"required":["creditArrangementSettings","id","name","type"],"additionalProperties":true};const schema15 = {"type":"object","description":"Defines the settings for account linking.","properties":{"enabled":{"type":"boolean","description":"Shows whether the loan accounts created using this product can be linked to a savings account."},"linkableDepositProductKey":{"type":"string","description":"Loan accounts created for this product can only be linked the the savings accounts that use the savings product with this key. If null, the loan accounts for this product can be linked to any savings account."},"linkedAccountOptions":{"type":"array","description":"A set of linked account options.","items":{"enum":["AUTO_LINK_ACCOUNTS","AUTO_CREATE_LINKED_ACCOUNTS"]},"uniqueItems":true},"settlementMethod":{"description":"Set the option of automated transfer that should be made from linked deposit accounts into loan accounts create from this product.","enum":["FULL_DUE_AMOUNTS","PARTIAL_DUE_AMOUNTS","NO_AUTOMATED_TRANSFERS"]}},"required":["enabled"],"additionalProperties":true};const schema21 = {"type":"object","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"creditArrangementRequirement":{"description":"Shows whether accounts created after this product can/should be part of a line of credit.","enum":["OPTIONAL","REQUIRED","NOT_REQUIRED"]}},"additionalProperties":true};const schema22 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema47 = {"type":"object","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["accountInitialState","idGeneratorType","idPattern"],"additionalProperties":true};const schema48 = {"type":"object","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","description":"Indicates whether the product supports offset"}},"additionalProperties":true};const schema56 = {"type":"object","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true};const schema66 = {"type":"object","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","description":"Shows whether collateral (assets or other goods) are accepted in order to reach required securities percentage from loan amount, as defined in this product."},"isGuarantorsEnabled":{"type":"boolean","description":"Shows whether guarantors (other clients) are accepted in order to reach the required securities percentage from loan amount, as defined in this product."},"requiredGuaranties":{"type":"number","description":"The securities percentage from loan amount that is needed in order for this account to be approved. Null if the securities are not required."}},"additionalProperties":true};const schema67 = {"type":"object","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true};const schema68 = {"type":"object","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","description":"The name the document"},"type":{"description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true};const schema13 = {"type":"object","description":"Accounting settings, defines the accounting settings for the product.","properties":{"accountingMethod":{"description":"A list of accounting rules for a product.","enum":["NONE","CASH","ACCRUAL"]},"accountingRules":{"type":"array","description":"A list of accounting rules for the product.","items":{"$ref":"#/$defs/GLAccountingRule"}},"interestAccrualCalculation":{"description":"The accounting interest calculation option selected for the product.","enum":["NONE","AGGREGATED_AMOUNT","BREAKDOWN_PER_ACCOUNT"]},"interestAccruedAccountingMethod":{"description":"A list of accounting rules for a product.","enum":["NONE","DAILY","END_OF_MONTH"]}},"required":["accountingMethod"],"additionalProperties":true};const schema14 = {"type":"object","description":"The GL accounting rule, it maps a financial resource with a GL account for a specific product (i.e loan or saving).","properties":{"encodedKey":{"type":"string","description":"The encoded key of the accounting rule, auto generated, unique."},"financialResource":{"description":"General Ledger Financial Resources used to setup the product accounting rules and determine the credit and debit accounts when logging journal entries","enum":["PORTFOLIO_CONTROL","FUND_SOURCE","WRITE_OFF_EXPENSE","INTEREST_INCOME","TAXES_PAYABLE","FEE_INCOME","PENALTY_INCOME","NEGATIVE_INTEREST_PAYABLE_RECEIVABLE","NEGATIVE_INTEREST_PAYABLE","INTEREST_RECEIVABLE","FEE_RECEIVABLE","PENALTY_RECEIVABLE","TAXES_RECEIVABLE","DEFERRED_INTERESTS_INCOME","DEFERRED_FEE_INCOME","DEFERRED_TAXES","DEPOSIT_REFERENCE","SAVINGS_CONTROL","INTEREST_EXPENSE","INTEREST_PAYABLE","NEGATIVE_INTEREST_INCOME","NEGATIVE_INTEREST_RECEIVABLE","OVERDRAFT_PORTFOLIO_CONTROL","OVERDRAFT_INTEREST_INCOME","OVERDRAFT_WRITE_OFF_EXPENSE","OVERDRAFT_INTEREST_RECEIVABLE","INTER_BRANCH_TRANSFER"]},"glAccountKey":{"type":"string","description":"The encoded key of the account that is mapped to the financialResource"},"transactionChannelKey":{"type":"string","description":"The key of the transaction rule that uses this rule"}},"required":["financialResource","glAccountKey"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.accountingMethod === undefined) && (missing0 = "accountingMethod")){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountingMethod !== undefined){let data0 = data.accountingMethod;const _errs2 = errors;if(!(((data0 === "NONE") || (data0 === "CASH")) || (data0 === "ACCRUAL"))){validate12.errors = [{instancePath:instancePath+"/accountingMethod",schemaPath:"#/properties/accountingMethod/enum",keyword:"enum",params:{allowedValues: schema13.properties.accountingMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.accountingRules !== undefined){let data1 = data.accountingRules;const _errs3 = errors;if(errors === _errs3){if(Array.isArray(data1)){var valid1 = true;const len0 = data1.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate16.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate16.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.branchSettings !== undefined){let data2 = data.branchSettings;const _errs5 = errors;const _errs6 = errors;if(errors === _errs6){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.availableProductBranches !== undefined){let data3 = data2.availableProductBranches;const _errs9 = errors;if(errors === _errs9){if(Array.isArray(data3)){var valid5 = true;const len1 = data3.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema40 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};const schema34 = {"type":"object","description":"The interest settings, defines constraints regarding interest that will be used on the loan account created based on this product.","properties":{"accrueInterestAfterMaturity":{"type":"boolean","description":"If the product supports this option, specify if the interest should be accrued after the account maturity date"},"allowNegativeInterestRate":{"type":"boolean","description":"Indicator whether the loan product allows negative values for interest rate or interest spread"},"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestChargeFrequency":{"description":"The interval used for determining how often is interest charged","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestChargeFrequencyCount":{"type":"integer","description":"the count of units to apply over the interval"},"interestRate":{"$ref":"#/$defs/DecimalInterval"},"interestRateCeilingValue":{"type":"number","description":"Interest spread + index interest rate can't be more than this amount (valid only for index interest rate products)."},"interestRateFloorValue":{"type":"number","description":"Interest spread + index interest rate can't be less than this amount (valid only for index interest rate products)."},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count"},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"description":"The option for how is the interest rate determined when being accrued for an account","enum":["FIXED","TIERED","TIERED_PERIOD","TIERED_BAND"]},"interestRateTiers":{"type":"array","description":"The list of interest rate tiers available for the current settings instance","items":{"$ref":"#/$defs/InterestRateTier"}}},"additionalProperties":true};const schema36 = {"type":"object","description":"Used or TIERED interest rates, holds the values to define how the interest is computed","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"interestRate":{"type":"number","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true};function validate27(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accrueInterestAfterMaturity !== undefined){const _errs2 = errors;if(typeof data.accrueInterestAfterMaturity !== "boolean"){validate27.errors = [{instancePath:instancePath+"/accrueInterestAfterMaturity",schemaPath:"#/properties/accrueInterestAfterMaturity/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.allowNegativeInterestRate !== undefined){const _errs4 = errors;if(typeof data.allowNegativeInterestRate !== "boolean"){validate27.errors = [{instancePath:instancePath+"/allowNegativeInterestRate",schemaPath:"#/properties/allowNegativeInterestRate/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs6 = errors;if(typeof data.encodedKey !== "string"){validate27.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.indexSourceKey !== undefined){const _errs8 = errors;if(typeof data.indexSourceKey !== "string"){validate27.errors = [{instancePath:instancePath+"/indexSourceKey",schemaPath:"#/properties/indexSourceKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.interestChargeFrequency !== undefined){const _errs10 = errors;let valid1;valid1 = false;for(const v0 of schema34.properties.interestChargeFrequency.enum){if(func0(data.interestChargeFrequency, v0)){valid1 = true;break;}}if(!valid1){validate27.errors = [{instancePath:instancePath+"/interestChargeFrequency",schemaPath:"#/properties/interestChargeFrequency/enum",keyword:"enum",params:{allowedValues: schema34.properties.interestChargeFrequency.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.interestChargeFrequencyCount !== undefined){let data5 = data.interestChargeFrequencyCount;const _errs11 = errors;if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){validate27.errors = [{instancePath:instancePath+"/interestChargeFrequencyCount",schemaPath:"#/properties/interestChargeFrequencyCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs11 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRate !== undefined){let data6 = data.interestRate;const _errs13 = errors;const _errs14 = errors;if(errors === _errs14){if(data6 && typeof data6 == "object" && !Array.isArray(data6)){if(data6.defaultValue !== undefined){let data7 = data6.defaultValue;const _errs17 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate27.errors = [{instancePath:instancePath+"/interestRate/defaultValue",schemaPath:"#/$defs/DecimalInterval/properties/defaultValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs17 === errors;}else {var valid3 = true;}if(valid3){if(data6.maxValue !== undefined){let data8 = data6.maxValue;const _errs19 = errors;if(!((typeof data8 == "number") && (isFinite(data8)))){validate27.errors = [{instancePath:instancePath+"/interestRate/maxValue",schemaPath:"#/$defs/DecimalInterval/properties/maxValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs19 === errors;}else {var valid3 = true;}if(valid3){if(data6.minValue !== undefined){let data9 = data6.minValue;const _errs21 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate27.errors = [{instancePath:instancePath+"/interestRate/minValue",schemaPath:"#/$defs/DecimalInterval/properties/minValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs21 === errors;}else {var valid3 = true;}}}}else {validate27.errors = [{instancePath:instancePath+"/interestRate",schemaPath:"#/$defs/DecimalInterval/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateCeilingValue !== undefined){let data10 = data.interestRateCeilingValue;const _errs23 = errors;if(!((typeof data10 == "number") && (isFinite(data10)))){validate27.errors = [{instancePath:instancePath+"/interestRateCeilingValue",schemaPath:"#/properties/interestRateCeilingValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs23 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateFloorValue !== undefined){let data11 = data.interestRateFloorValue;const _errs25 = errors;if(!((typeof data11 == "number") && (isFinite(data11)))){validate27.errors = [{instancePath:instancePath+"/interestRateFloorValue",schemaPath:"#/properties/interestRateFloorValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs25 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateReviewCount !== undefined){let data12 = data.interestRateReviewCount;const _errs27 = errors;if(!(((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12))) && (isFinite(data12)))){validate27.errors = [{instancePath:instancePath+"/interestRateReviewCount",schemaPath:"#/properties/interestRateReviewCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs27 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateReviewUnit !== undefined){let data13 = data.interestRateReviewUnit;const _errs29 = errors;if(!(((data13 === "DAYS") || (data13 === "WEEKS")) || (data13 === "MONTHS"))){validate27.errors = [{instancePath:instancePath+"/interestRateReviewUnit",schemaPath:"#/properties/interestRateReviewUnit/enum",keyword:"enum",params:{allowedValues: schema34.properties.interestRateReviewUnit.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs29 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateSource !== undefined){let data14 = data.interestRateSource;const _errs30 = errors;if(!((data14 === "FIXED_INTEREST_RATE") || (data14 === "INDEX_INTEREST_RATE"))){validate27.errors = [{instancePath:instancePath+"/interestRateSource",schemaPath:"#/properties/interestRateSource/enum",keyword:"enum",params:{allowedValues: schema34.properties.interestRateSource.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs30 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateTerms !== undefined){let data15 = data.interestRateTerms;const _errs31 = errors;if(!((((data15 === "FIXED") || (data15 === "TIERED")) || (data15 === "TIERED_PERIOD")) || (data15 === "TIERED_BAND"))){validate27.errors = [{instancePath:instancePath+"/interestRateTerms",schemaPath:"#/properties/interestRateTerms/enum",keyword:"enum",params:{allowedValues: schema34.properties.interestRateTerms.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateTiers !== undefined){let data16 = data.interestRateTiers;const _errs32 = errors;if(errors === _errs32){if(Array.isArray(data16)){var valid4 = true;const len0 = data16.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Schedule Due Dates Method is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTHs.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["repaymentReschedulingMethod","repaymentScheduleMethod","scheduleDueDatesMethod"],"additionalProperties":true};const schema58 = {"type":"object","description":"It holds information about the loan product amortization period. The PMT is calculated as the loan would have [amortisationPeriod] instalments","properties":{"defaultValue":{"type":"integer","description":"default value"},"maxValue":{"type":"integer","description":"max value"},"minValue":{"type":"integer","description":"min value"}},"additionalProperties":true};const schema59 = {"type":"object","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema62 = {"type":"object","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","description":"Preview Schedule status."}},"additionalProperties":true};const schema63 = {"type":"object","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"description":"Specifies the rounding repayment schedule method.","enum":["NO_ROUNDING","ROUND_REMAINDER_INTO_LAST_REPAYMENT","ROUND_PRINCIPAL_AND_INTEREST_REMAINDER_INTO_LAST_REPAYMENT"]}},"required":["repaymentCurrencyRounding","repaymentElementsRoundingMethod","roundingRepaymentScheduleMethod"],"additionalProperties":true};const schema64 = {"type":"object","description":"Holds Repayments Schedule Editing options","properties":{"paymentHolidaysSettings":{"$ref":"#/$defs/PaymentHolidaysSettings"}},"additionalProperties":true};const schema65 = {"type":"object","description":"Holds Payment Holidays Settings","properties":{"paymentHolidaysLoanTermOption":{"description":"payment holiday option","enum":["EXTEND_LOAN_TERM","KEEP_THE_SAME_LOAN_TERM"]}},"additionalProperties":true};function validate43(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.paymentHolidaysSettings !== undefined){let data0 = data.paymentHolidaysSettings;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.paymentHolidaysLoanTermOption !== undefined){let data1 = data0.paymentHolidaysLoanTermOption;if(!((data1 === "EXTEND_LOAN_TERM") || (data1 === "KEEP_THE_SAME_LOAN_TERM"))){validate43.errors = [{instancePath:instancePath+"/paymentHolidaysSettings/paymentHolidaysLoanTermOption",schemaPath:"#/$defs/PaymentHolidaysSettings/properties/paymentHolidaysLoanTermOption/enum",keyword:"enum",params:{allowedValues: schema65.properties.paymentHolidaysLoanTermOption.enum},message:"must be equal to one of the allowed values"}];return false;}}}else {validate43.errors = [{instancePath:instancePath+"/paymentHolidaysSettings",schemaPath:"#/$defs/PaymentHolidaysSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate43.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate43.errors = vErrors;return errors === 0;}function validate42(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((((data.repaymentReschedulingMethod === undefined) && (missing0 = "repaymentReschedulingMethod")) || ((data.repaymentScheduleMethod === undefined) && (missing0 = "repaymentScheduleMethod"))) || ((data.scheduleDueDatesMethod === undefined) && (missing0 = "scheduleDueDatesMethod"))){validate42.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.defaultValue !== undefined){let data1 = data0.defaultValue;const _errs6 = errors;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate42.errors = [{instancePath:instancePath+"/amortizationPeriod/defaultValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/defaultValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.maxValue !== undefined){let data2 = data0.maxValue;const _errs8 = errors;if(!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))){validate42.errors = [{instancePath:instancePath+"/amortizationPeriod/maxValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/maxValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.minValue !== undefined){let data3 = data0.minValue;const _errs10 = errors;if(!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))){validate42.errors = [{instancePath:instancePath+"/amortizationPeriod/minValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/minValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}else {validate42.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/$defs/ProductAmortizationPeriod/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycles !== undefined){let data4 = data.billingCycles;const _errs12 = errors;const _errs13 = errors;if(errors === _errs13){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){if(data4.enabled !== undefined){const _errs16 = errors;if(typeof data4.enabled !== "boolean"){validate42.errors = [{instancePath:instancePath+"/billingCycles/enabled",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/enabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid4 = _errs16 === errors;}else {var valid4 = true;}if(valid4){if(data4.startDays !== undefined){let data6 = data4.startDays;const _errs18 = errors;if(errors === _errs18){if(Array.isArray(data6)){var valid5 = true;const len0 = data6.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data6[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate42.errors = [{instancePath:instancePath+"/billingCycles/startDays",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/startDays/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate42.errors = [{instancePath:instancePath+"/billingCycles/startDays",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/startDays/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid4 = _errs18 === errors;}else {var valid4 = true;}}}else {validate42.errors = [{instancePath:instancePath+"/billingCycles",schemaPath:"#/$defs/BillingCyclesProductSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultRepaymentPeriodCount !== undefined){let data8 = data.defaultRepaymentPeriodCount;const _errs22 = errors;if(!(((typeof data8 == "number") && (!(data8 % 1) && !isNaN(data8))) && (isFinite(data8)))){validate42.errors = [{instancePath:instancePath+"/defaultRepaymentPeriodCount",schemaPath:"#/properties/defaultRepaymentPeriodCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.firstRepaymentDueDateOffset !== undefined){let data9 = data.firstRepaymentDueDateOffset;const _errs24 = errors;const _errs25 = errors;if(errors === _errs25){if(data9 && typeof data9 == "object" && !Array.isArray(data9)){if(data9.defaultValue !== undefined){let data10 = data9.defaultValue;const _errs28 = errors;if(!(((typeof data10 == "number") && (!(data10 % 1) && !isNaN(data10))) && (isFinite(data10)))){validate42.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/defaultValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/defaultValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs28 === errors;}else {var valid8 = true;}if(valid8){if(data9.encodedKey !== undefined){const _errs30 = errors;if(typeof data9.encodedKey !== "string"){validate42.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/encodedKey",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid8 = _errs30 === errors;}else {var valid8 = true;}if(valid8){if(data9.maxValue !== undefined){let data12 = data9.maxValue;const _errs32 = errors;if(!(((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12))) && (isFinite(data12)))){validate42.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/maxValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/maxValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs32 === errors;}else {var valid8 = true;}if(valid8){if(data9.minValue !== undefined){let data13 = data9.minValue;const _errs34 = errors;if(!(((typeof data13 == "number") && (!(data13 % 1) && !isNaN(data13))) && (isFinite(data13)))){validate42.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/minValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/minValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs34 === errors;}else {var valid8 = true;}}}}}else {validate42.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset",schemaPath:"#/$defs/IntegerIntervalConstraints/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data14 = data.fixedDaysOfMonth;const _errs36 = errors;if(errors === _errs36){if(Array.isArray(data14)){var valid9 = true;const len1 = data14.length;for(let i2=0; i2 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data4[i1], data4[j0])){validate11.errors = [{instancePath:instancePath+"/accountLinkSettings/linkedAccountOptions",schemaPath:"#/$defs/AccountLinkSettings/properties/linkedAccountOptions/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate11.errors = [{instancePath:instancePath+"/accountLinkSettings/linkedAccountOptions",schemaPath:"#/$defs/AccountLinkSettings/properties/linkedAccountOptions/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid2 = _errs11 === errors;}else {var valid2 = true;}if(valid2){if(data1.settlementMethod !== undefined){let data6 = data1.settlementMethod;const _errs14 = errors;if(!(((data6 === "FULL_DUE_AMOUNTS") || (data6 === "PARTIAL_DUE_AMOUNTS")) || (data6 === "NO_AUTOMATED_TRANSFERS"))){validate11.errors = [{instancePath:instancePath+"/accountLinkSettings/settlementMethod",schemaPath:"#/$defs/AccountLinkSettings/properties/settlementMethod/enum",keyword:"enum",params:{allowedValues: schema15.properties.settlementMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}}}}}}else {validate11.errors = [{instancePath:instancePath+"/accountLinkSettings",schemaPath:"#/$defs/AccountLinkSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs3 === errors;}else {var valid0 = true;}if(valid0){if(data.adjustInterestForFirstInstallment !== undefined){const _errs15 = errors;if(typeof data.adjustInterestForFirstInstallment !== "boolean"){validate11.errors = [{instancePath:instancePath+"/adjustInterestForFirstInstallment",schemaPath:"#/properties/adjustInterestForFirstInstallment/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs15 === errors;}else {var valid0 = true;}if(valid0){if(data.allowCustomRepaymentAllocation !== undefined){const _errs17 = errors;if(typeof data.allowCustomRepaymentAllocation !== "boolean"){validate11.errors = [{instancePath:instancePath+"/allowCustomRepaymentAllocation",schemaPath:"#/properties/allowCustomRepaymentAllocation/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.arrearsSettings !== undefined){const _errs19 = errors;if(!(validate14(data.arrearsSettings, {instancePath:instancePath+"/arrearsSettings",parentData:data,parentDataProperty:"arrearsSettings",rootData}))){vErrors = vErrors === null ? validate14.errors : vErrors.concat(validate14.errors);errors = vErrors.length;}var valid0 = _errs19 === errors;}else {var valid0 = true;}if(valid0){if(data.availabilitySettings !== undefined){const _errs20 = errors;if(!(validate16(data.availabilitySettings, {instancePath:instancePath+"/availabilitySettings",parentData:data,parentDataProperty:"availabilitySettings",rootData}))){vErrors = vErrors === null ? validate16.errors : vErrors.concat(validate16.errors);errors = vErrors.length;}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.category !== undefined){const _errs21 = errors;let valid5;valid5 = false;for(const v0 of schema12.properties.category.enum){if(func0(data.category, v0)){valid5 = true;break;}}if(!valid5){validate11.errors = [{instancePath:instancePath+"/category",schemaPath:"#/properties/category/enum",keyword:"enum",params:{allowedValues: schema12.properties.category.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs21 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs22 = errors;if(errors === _errs22){if(errors === _errs22){if(!(typeof data.creationDate === "string")){validate11.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.creditArrangementSettings !== undefined){let data13 = data.creditArrangementSettings;const _errs24 = errors;const _errs25 = errors;if(errors === _errs25){if(data13 && typeof data13 == "object" && !Array.isArray(data13)){if(data13.creditArrangementRequirement !== undefined){let data14 = data13.creditArrangementRequirement;if(!(((data14 === "OPTIONAL") || (data14 === "REQUIRED")) || (data14 === "NOT_REQUIRED"))){validate11.errors = [{instancePath:instancePath+"/creditArrangementSettings/creditArrangementRequirement",schemaPath:"#/$defs/CreditArrangementSettings/properties/creditArrangementRequirement/enum",keyword:"enum",params:{allowedValues: schema21.properties.creditArrangementRequirement.enum},message:"must be equal to one of the allowed values"}];return false;}}}else {validate11.errors = [{instancePath:instancePath+"/creditArrangementSettings",schemaPath:"#/$defs/CreditArrangementSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.currency !== undefined){let data15 = data.currency;const _errs29 = errors;const _errs30 = errors;if(errors === _errs30){if(data15 && typeof data15 == "object" && !Array.isArray(data15)){if(data15.code !== undefined){const _errs33 = errors;let valid10;valid10 = false;for(const v1 of schema22.properties.code.enum){if(func0(data15.code, v1)){valid10 = true;break;}}if(!valid10){validate11.errors = [{instancePath:instancePath+"/currency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema22.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid9 = _errs33 === errors;}else {var valid9 = true;}if(valid9){if(data15.currencyCode !== undefined){const _errs34 = errors;if(typeof data15.currencyCode !== "string"){validate11.errors = [{instancePath:instancePath+"/currency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid9 = _errs34 === errors;}else {var valid9 = true;}}}else {validate11.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs29 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs36 = errors;if(typeof data.encodedKey !== "string"){validate11.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs36 === errors;}else {var valid0 = true;}if(valid0){if(data.feesSettings !== undefined){const _errs38 = errors;if(!(validate18(data.feesSettings, {instancePath:instancePath+"/feesSettings",parentData:data,parentDataProperty:"feesSettings",rootData}))){vErrors = vErrors === null ? validate18.errors : vErrors.concat(validate18.errors);errors = vErrors.length;}var valid0 = _errs38 === errors;}else {var valid0 = true;}if(valid0){if(data.fundingSettings !== undefined){const _errs39 = errors;if(!(validate22(data.fundingSettings, {instancePath:instancePath+"/fundingSettings",parentData:data,parentDataProperty:"fundingSettings",rootData}))){vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors);errors = vErrors.length;}var valid0 = _errs39 === errors;}else {var valid0 = true;}if(valid0){if(data.gracePeriodSettings !== undefined){const _errs40 = errors;if(!(validate24(data.gracePeriodSettings, {instancePath:instancePath+"/gracePeriodSettings",parentData:data,parentDataProperty:"gracePeriodSettings",rootData}))){vErrors = vErrors === null ? validate24.errors : vErrors.concat(validate24.errors);errors = vErrors.length;}var valid0 = _errs40 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs41 = errors;if(typeof data.id !== "string"){validate11.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.interestSettings !== undefined){const _errs43 = errors;if(!(validate26(data.interestSettings, {instancePath:instancePath+"/interestSettings",parentData:data,parentDataProperty:"interestSettings",rootData}))){vErrors = vErrors === null ? validate26.errors : vErrors.concat(validate26.errors);errors = vErrors.length;}var valid0 = _errs43 === errors;}else {var valid0 = true;}if(valid0){if(data.internalControls !== undefined){const _errs44 = errors;if(!(validate32(data.internalControls, {instancePath:instancePath+"/internalControls",parentData:data,parentDataProperty:"internalControls",rootData}))){vErrors = vErrors === null ? validate32.errors : vErrors.concat(validate32.errors);errors = vErrors.length;}var valid0 = _errs44 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){const _errs45 = errors;if(errors === _errs45){if(errors === _errs45){if(!(typeof data.lastModifiedDate === "string")){validate11.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs45 === errors;}else {var valid0 = true;}if(valid0){if(data.loanAmountSettings !== undefined){const _errs47 = errors;if(!(validate34(data.loanAmountSettings, {instancePath:instancePath+"/loanAmountSettings",parentData:data,parentDataProperty:"loanAmountSettings",rootData}))){vErrors = vErrors === null ? validate34.errors : vErrors.concat(validate34.errors);errors = vErrors.length;}var valid0 = _errs47 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs48 = errors;if(typeof data.name !== "string"){validate11.errors = [{instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs48 === errors;}else {var valid0 = true;}if(valid0){if(data.newAccountSettings !== undefined){let data28 = data.newAccountSettings;const _errs50 = errors;const _errs51 = errors;if(errors === _errs51){if(data28 && typeof data28 == "object" && !Array.isArray(data28)){let missing2;if((((data28.accountInitialState === undefined) && (missing2 = "accountInitialState")) || ((data28.idGeneratorType === undefined) && (missing2 = "idGeneratorType"))) || ((data28.idPattern === undefined) && (missing2 = "idPattern"))){validate11.errors = [{instancePath:instancePath+"/newAccountSettings",schemaPath:"#/$defs/NewAccountSettings/required",keyword:"required",params:{missingProperty: missing2},message:"must have required property '"+missing2+"'"}];return false;}else {if(data28.accountInitialState !== undefined){const _errs54 = errors;let valid13;valid13 = false;for(const v2 of schema47.properties.accountInitialState.enum){if(func0(data28.accountInitialState, v2)){valid13 = true;break;}}if(!valid13){validate11.errors = [{instancePath:instancePath+"/newAccountSettings/accountInitialState",schemaPath:"#/$defs/NewAccountSettings/properties/accountInitialState/enum",keyword:"enum",params:{allowedValues: schema47.properties.accountInitialState.enum},message:"must be equal to one of the allowed values"}];return false;}var valid12 = _errs54 === errors;}else {var valid12 = true;}if(valid12){if(data28.idGeneratorType !== undefined){let data30 = data28.idGeneratorType;const _errs55 = errors;if(!((data30 === "INCREMENTAL_NUMBER") || (data30 === "RANDOM_PATTERN"))){validate11.errors = [{instancePath:instancePath+"/newAccountSettings/idGeneratorType",schemaPath:"#/$defs/NewAccountSettings/properties/idGeneratorType/enum",keyword:"enum",params:{allowedValues: schema47.properties.idGeneratorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid12 = _errs55 === errors;}else {var valid12 = true;}if(valid12){if(data28.idPattern !== undefined){const _errs56 = errors;if(typeof data28.idPattern !== "string"){validate11.errors = [{instancePath:instancePath+"/newAccountSettings/idPattern",schemaPath:"#/$defs/NewAccountSettings/properties/idPattern/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid12 = _errs56 === errors;}else {var valid12 = true;}}}}}else {validate11.errors = [{instancePath:instancePath+"/newAccountSettings",schemaPath:"#/$defs/NewAccountSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs50 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs58 = errors;if(typeof data.notes !== "string"){validate11.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs58 === errors;}else {var valid0 = true;}if(valid0){if(data.offsetSettings !== undefined){let data33 = data.offsetSettings;const _errs60 = errors;const _errs61 = errors;if(errors === _errs61){if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(data33.allowOffset !== undefined){if(typeof data33.allowOffset !== "boolean"){validate11.errors = [{instancePath:instancePath+"/offsetSettings/allowOffset",schemaPath:"#/$defs/OffsetSettings/properties/allowOffset/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}else {validate11.errors = [{instancePath:instancePath+"/offsetSettings",schemaPath:"#/$defs/OffsetSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs60 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentSettings !== undefined){const _errs66 = errors;if(!(validate36(data.paymentSettings, {instancePath:instancePath+"/paymentSettings",parentData:data,parentDataProperty:"paymentSettings",rootData}))){vErrors = vErrors === null ? validate36.errors : vErrors.concat(validate36.errors);errors = vErrors.length;}var valid0 = _errs66 === errors;}else {var valid0 = true;}if(valid0){if(data.penaltySettings !== undefined){const _errs67 = errors;if(!(validate40(data.penaltySettings, {instancePath:instancePath+"/penaltySettings",parentData:data,parentDataProperty:"penaltySettings",rootData}))){vErrors = vErrors === null ? validate40.errors : vErrors.concat(validate40.errors);errors = vErrors.length;}var valid0 = _errs67 === errors;}else {var valid0 = true;}if(valid0){if(data.redrawSettings !== undefined){let data37 = data.redrawSettings;const _errs68 = errors;const _errs69 = errors;if(errors === _errs69){if(data37 && typeof data37 == "object" && !Array.isArray(data37)){let missing3;if((data37.allowRedraw === undefined) && (missing3 = "allowRedraw")){validate11.errors = [{instancePath:instancePath+"/redrawSettings",schemaPath:"#/$defs/ProductRedrawSettings/required",keyword:"required",params:{missingProperty: missing3},message:"must have required property '"+missing3+"'"}];return false;}else {if(data37.allowRedraw !== undefined){if(typeof data37.allowRedraw !== "boolean"){validate11.errors = [{instancePath:instancePath+"/redrawSettings/allowRedraw",schemaPath:"#/$defs/ProductRedrawSettings/properties/allowRedraw/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}}else {validate11.errors = [{instancePath:instancePath+"/redrawSettings",schemaPath:"#/$defs/ProductRedrawSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs68 === errors;}else {var valid0 = true;}if(valid0){if(data.scheduleSettings !== undefined){const _errs74 = errors;if(!(validate42(data.scheduleSettings, {instancePath:instancePath+"/scheduleSettings",parentData:data,parentDataProperty:"scheduleSettings",rootData}))){vErrors = vErrors === null ? validate42.errors : vErrors.concat(validate42.errors);errors = vErrors.length;}var valid0 = _errs74 === errors;}else {var valid0 = true;}if(valid0){if(data.securitySettings !== undefined){let data40 = data.securitySettings;const _errs75 = errors;const _errs76 = errors;if(errors === _errs76){if(data40 && typeof data40 == "object" && !Array.isArray(data40)){if(data40.isCollateralEnabled !== undefined){const _errs79 = errors;if(typeof data40.isCollateralEnabled !== "boolean"){validate11.errors = [{instancePath:instancePath+"/securitySettings/isCollateralEnabled",schemaPath:"#/$defs/SecuritySettings/properties/isCollateralEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid19 = _errs79 === errors;}else {var valid19 = true;}if(valid19){if(data40.isGuarantorsEnabled !== undefined){const _errs81 = errors;if(typeof data40.isGuarantorsEnabled !== "boolean"){validate11.errors = [{instancePath:instancePath+"/securitySettings/isGuarantorsEnabled",schemaPath:"#/$defs/SecuritySettings/properties/isGuarantorsEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid19 = _errs81 === errors;}else {var valid19 = true;}if(valid19){if(data40.requiredGuaranties !== undefined){let data43 = data40.requiredGuaranties;const _errs83 = errors;if(!((typeof data43 == "number") && (isFinite(data43)))){validate11.errors = [{instancePath:instancePath+"/securitySettings/requiredGuaranties",schemaPath:"#/$defs/SecuritySettings/properties/requiredGuaranties/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid19 = _errs83 === errors;}else {var valid19 = true;}}}}else {validate11.errors = [{instancePath:instancePath+"/securitySettings",schemaPath:"#/$defs/SecuritySettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs75 === errors;}else {var valid0 = true;}if(valid0){if(data.state !== undefined){let data44 = data.state;const _errs85 = errors;if(!((data44 === "ACTIVE") || (data44 === "INACTIVE"))){validate11.errors = [{instancePath:instancePath+"/state",schemaPath:"#/properties/state/enum",keyword:"enum",params:{allowedValues: schema12.properties.state.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs85 === errors;}else {var valid0 = true;}if(valid0){if(data.taxSettings !== undefined){let data45 = data.taxSettings;const _errs86 = errors;const _errs87 = errors;if(errors === _errs87){if(data45 && typeof data45 == "object" && !Array.isArray(data45)){if(data45.taxCalculationMethod !== undefined){let data46 = data45.taxCalculationMethod;const _errs90 = errors;if(!((data46 === "INCLUSIVE") || (data46 === "EXCLUSIVE"))){validate11.errors = [{instancePath:instancePath+"/taxSettings/taxCalculationMethod",schemaPath:"#/$defs/TaxSettings/properties/taxCalculationMethod/enum",keyword:"enum",params:{allowedValues: schema67.properties.taxCalculationMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid21 = _errs90 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnFeesEnabled !== undefined){const _errs91 = errors;if(typeof data45.taxesOnFeesEnabled !== "boolean"){validate11.errors = [{instancePath:instancePath+"/taxSettings/taxesOnFeesEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnFeesEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs91 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnInterestEnabled !== undefined){const _errs93 = errors;if(typeof data45.taxesOnInterestEnabled !== "boolean"){validate11.errors = [{instancePath:instancePath+"/taxSettings/taxesOnInterestEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnInterestEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs93 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnPenaltyEnabled !== undefined){const _errs95 = errors;if(typeof data45.taxesOnPenaltyEnabled !== "boolean"){validate11.errors = [{instancePath:instancePath+"/taxSettings/taxesOnPenaltyEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnPenaltyEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs95 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxSourceKey !== undefined){const _errs97 = errors;if(typeof data45.taxSourceKey !== "string"){validate11.errors = [{instancePath:instancePath+"/taxSettings/taxSourceKey",schemaPath:"#/$defs/TaxSettings/properties/taxSourceKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid21 = _errs97 === errors;}else {var valid21 = true;}}}}}}else {validate11.errors = [{instancePath:instancePath+"/taxSettings",schemaPath:"#/$defs/TaxSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs86 === errors;}else {var valid0 = true;}if(valid0){if(data.templates !== undefined){let data51 = data.templates;const _errs99 = errors;if(errors === _errs99){if(Array.isArray(data51)){var valid22 = true;const len1 = data51.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"ProductInterestRateSettings":{"type":"object","description":"Adjustable interest rates settings","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate settings, auto generated, unique"},"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestRate":{"$ref":"#/$defs/DecimalInterval"},"interestRateCeilingValue":{"type":"number","description":"Maximum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateFloorValue":{"type":"number","description":"Minimum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count. Valid only for index interest rate."},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit. Valid only for index interest rate.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or indexed(interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]}},"required":["interestRateSource"],"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"InternalControls":{"type":"object","description":"Constraints and automated actions and that will be applied on the accounts.","properties":{"dormancyPeriodDays":{"type":"integer","description":"Specifies the number of days for an account to be fully paid in order to auto close it."},"fourEyesPrinciple":{"$ref":"#/$defs/FourEyesPrinciple"},"lockSettings":{"$ref":"#/$defs/LockSettings"}},"additionalProperties":true},"FourEyesPrinciple":{"type":"object","description":"Settings for Four Eyes Principle","properties":{"activeForLoanApproval":{"type":"boolean","description":"Requires separate users to create and approve loan accounts"}},"additionalProperties":true},"LockSettings":{"type":"object","description":"Settings applied when transitioning accounts to Locked state","properties":{"cappingConstraintType":{"description":"Specifies constraint types for capping charges.","enum":["SOFT_CAP","HARD_CAP"]},"cappingMethod":{"description":"Specifies how principal will be used when calculating capping charges.","enum":["OUTSTANDING_PRINCIPAL_PERCENTAGE","ORIGINAL_PRINCIPAL_PERCENTAGE"]},"cappingPercentage":{"type":"number","description":"Specifies the percentage of principal that cannot be exceeded by the sum of interest, fees and penalty balances."},"lockPeriodDays":{"type":"integer","description":"Specifies the number of days for in which the account will be locked if it stays in arrears."}},"additionalProperties":true},"LoanAmountSettings":{"type":"object","description":"The amount settings, holds all amount properties.","properties":{"loanAmount":{"$ref":"#/$defs/AmountDecimalConstraints"},"trancheSettings":{"$ref":"#/$defs/TrancheSettings"}},"additionalProperties":true},"AmountDecimalConstraints":{"type":"object","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","description":"The default value, will be used in case no other value was filled in by the user."},"encodedKey":{"type":"string","description":"The encoded key of the decimal constraint, auto generated, unique"},"maxValue":{"type":"number","description":"The maximum value."},"minValue":{"type":"number","description":"The minimum value."}},"additionalProperties":true},"TrancheSettings":{"type":"object","description":"The tranche settings, indicates the settings regarding tranches in case the product is configured to support tranches.","properties":{"maxNumberOfTranches":{"type":"integer","description":"The number of tranches supported by the loan product"}},"additionalProperties":true},"NewAccountSettings":{"type":"object","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["accountInitialState","idGeneratorType","idPattern"],"additionalProperties":true},"OffsetSettings":{"type":"object","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","description":"Indicates whether the product supports offset"}},"additionalProperties":true},"PaymentSettings":{"type":"object","description":"Defines the payment settings for the loan product and for loans crated based on this product.","properties":{"amortizationMethod":{"description":"Payments Method used by loan accounts for repayments schedule generation.","enum":["STANDARD_PAYMENTS","BALLOON_PAYMENTS","OPTIMIZED_PAYMENTS","PAYMENT_PLAN"]},"latePaymentsRecalculationMethod":{"description":"Recalculate the schedule when late payments are posted on dynamic Equal Installments loans.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"paymentMethod":{"description":"The payment method. Represents the interest payment method that determines whether the payments are made Horizontally (on the Repayments) or Vertically (on the Loan Account)","enum":["HORIZONTAL","VERTICAL"]},"prepaymentSettings":{"$ref":"#/$defs/ProductPrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentProductSettings"},"repaymentAllocationOrder":{"type":"array","description":"A list of basic repayment allocation elements such as the principal, interest & fees.","items":{"enum":["PRINCIPAL","INTEREST","FEE","PENALTY"]}}},"required":["latePaymentsRecalculationMethod","paymentMethod","repaymentAllocationOrder"],"additionalProperties":true},"ProductPrepaymentSettings":{"type":"object","description":"Defines the prepayment settings for the product","properties":{"applyInterestOnPrepaymentMethod":{"description":"Whether the interest on prepayment is applied manual or automatic.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowance":{"type":"number","description":"ERC free allowance in percentage"},"futurePaymentsAcceptance":{"description":"Shows whether the future payments are allowed or not for this product (repayment transactions with entry date set in the future)","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"prepaymentAcceptance":{"description":"Shows whether the pre-payments are allowed or not for this product.","enum":["ACCEPT_PREPAYMENTS","NO_PREPAYMENTS"]},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product)","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"required":["futurePaymentsAcceptance"],"additionalProperties":true},"PrincipalPaymentProductSettings":{"type":"object","description":"Defines the principal payment settings constraints for the loans that will be created based on this product.","properties":{"amount":{"$ref":"#/$defs/AmountDecimalConstraints"},"defaultPrincipalRepaymentInterval":{"type":"integer","description":"How many repayments the principal has to be paid"},"encodedKey":{"type":"string","description":"The encoded key of the settings, auto generated, unique"},"includeFeesInFloorAmount":{"type":"boolean","description":"If true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"If true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"$ref":"#/$defs/DecimalConstraints"},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"ProductPenaltySettings":{"type":"object","description":"Defines the penalty settings for the product that will be used by the loan accounts based on this product","properties":{"loanPenaltyCalculationMethod":{"description":"The penalty calculation method","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"loanPenaltyGracePeriod":{"type":"integer","description":"Number of days to wait before applying the loan penalty amounts"},"penaltyRate":{"$ref":"#/$defs/DecimalConstraints"}},"required":["loanPenaltyCalculationMethod"],"additionalProperties":true},"ProductRedrawSettings":{"type":"object","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true},"LoanProductScheduleSettings":{"type":"object","description":"Defines the settings and constraints for schedule for the loans that are created based on this product.","properties":{"amortizationPeriod":{"$ref":"#/$defs/ProductAmortizationPeriod"},"billingCycles":{"$ref":"#/$defs/BillingCyclesProductSettings"},"defaultRepaymentPeriodCount":{"type":"integer","description":"Interval Repayment Methodology Settings."},"firstRepaymentDueDateOffset":{"$ref":"#/$defs/IntegerIntervalConstraints"},"fixedDaysOfMonth":{"type":"array","description":" Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"interestAccrualSince":{"description":"Represents the moment the interest will start getting accrued.","enum":["DISBURSEMENT","DUE_DATE"]},"numInstallments":{"$ref":"#/$defs/IntegerIntervalConstraints"},"previewSchedule":{"$ref":"#/$defs/PreviewScheduleSettings"},"repaymentMethod":{"description":"The repayment method value","enum":["AMOUNT","INSTALLMENTS"]},"repaymentPeriodUnit":{"description":"The frequency of the loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentReschedulingMethod":{"description":"The repayment rescheduling method used in calculations.","enum":["NONE","NEXT_WORKING_DAY","PREVIOUS_WORKING_DAY","EXTEND_SCHEDULE"]},"repaymentScheduleEditOptions":{"type":"array","description":"Shows the properties from the repayment schedule can be edited.","items":{"enum":["ADJUST_PAYMENT_DATES","ADJUST_PRINCIPAL_PAYMENT_SCHEDULE","ADJUST_INTEREST_PAYMENT_SCHEDULE","ADJUST_FEE_PAYMENT_SCHEDULE","ADJUST_PENALTY_PAYMENT_SCHEDULE","ADJUST_NUMBER_OF_INSTALLMENTS","ADJUST_PAYMENT_HOLIDAYS"]}},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"roundingSettings":{"$ref":"#/$defs/RoundingSettings"},"scheduleDueDatesMethod":{"description":"The methodology used by this product to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"scheduleEditOptionDetails":{"$ref":"#/$defs/RepaymentScheduleEditOptionDetails"},"shortMonthHandlingMethod":{"description":"Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Schedule Due Dates Method is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTHs.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["repaymentReschedulingMethod","repaymentScheduleMethod","scheduleDueDatesMethod"],"additionalProperties":true},"ProductAmortizationPeriod":{"type":"object","description":"It holds information about the loan product amortization period. The PMT is calculated as the loan would have [amortisationPeriod] instalments","properties":{"defaultValue":{"type":"integer","description":"default value"},"maxValue":{"type":"integer","description":"max value"},"minValue":{"type":"integer","description":"min value"}},"additionalProperties":true},"BillingCyclesProductSettings":{"type":"object","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PreviewScheduleSettings":{"type":"object","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","description":"Preview Schedule status."}},"additionalProperties":true},"RoundingSettings":{"type":"object","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"description":"Specifies the rounding repayment schedule method.","enum":["NO_ROUNDING","ROUND_REMAINDER_INTO_LAST_REPAYMENT","ROUND_PRINCIPAL_AND_INTEREST_REMAINDER_INTO_LAST_REPAYMENT"]}},"required":["repaymentCurrencyRounding","repaymentElementsRoundingMethod","roundingRepaymentScheduleMethod"],"additionalProperties":true},"RepaymentScheduleEditOptionDetails":{"type":"object","description":"Holds Repayments Schedule Editing options","properties":{"paymentHolidaysSettings":{"$ref":"#/$defs/PaymentHolidaysSettings"}},"additionalProperties":true},"PaymentHolidaysSettings":{"type":"object","description":"Holds Payment Holidays Settings","properties":{"paymentHolidaysLoanTermOption":{"description":"payment holiday option","enum":["EXTEND_LOAN_TERM","KEEP_THE_SAME_LOAN_TERM"]}},"additionalProperties":true},"SecuritySettings":{"type":"object","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","description":"Shows whether collateral (assets or other goods) are accepted in order to reach required securities percentage from loan amount, as defined in this product."},"isGuarantorsEnabled":{"type":"boolean","description":"Shows whether guarantors (other clients) are accepted in order to reach the required securities percentage from loan amount, as defined in this product."},"requiredGuaranties":{"type":"number","description":"The securities percentage from loan amount that is needed in order for this account to be approved. Null if the securities are not required."}},"additionalProperties":true},"TaxSettings":{"type":"object","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true},"DocumentTemplate":{"type":"object","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","description":"The name the document"},"type":{"description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a loan product.","properties":{"accountingSettings":{"$ref":"#/$defs/AccountingSettings"},"accountLinkSettings":{"$ref":"#/$defs/AccountLinkSettings"},"adjustInterestForFirstInstallment":{"type":"boolean","description":"`TRUE` if it is possible to adjust the interest for the first repayment when the first repayment period is different than the repayment frequency, `FALSE` otherwise."},"allowCustomRepaymentAllocation":{"type":"boolean","description":"`TRUE` if an additional payment may be allocated on the account, ignoring the default repayment allocation order, `FALSE` otherwise."},"arrearsSettings":{"$ref":"#/$defs/ProductArrearsSettings"},"availabilitySettings":{"$ref":"#/$defs/ProductAvailabilitySettings"},"category":{"description":"The category of the loan product.","enum":["PERSONAL_LENDING","PURCHASE_FINANCING","RETAIL_MORTGAGES","SME_LENDING","COMMERCIAL","UNCATEGORIZED"]},"creationDate":{"type":"string","description":"The date the loan product was created.","format":"date-time"},"creditArrangementSettings":{"$ref":"#/$defs/CreditArrangementSettings"},"currency":{"$ref":"#/$defs/Currency"},"encodedKey":{"type":"string","description":"The encoded key of the loan product, it is auto generated, and unique."},"feesSettings":{"$ref":"#/$defs/FeesSettings"},"fundingSettings":{"$ref":"#/$defs/FundingSettings"},"gracePeriodSettings":{"$ref":"#/$defs/GracePeriodSettings"},"id":{"type":"string","description":"The ID of the loan product, can be generated and customized, and must be unique."},"interestSettings":{"$ref":"#/$defs/ProductInterestSettings"},"internalControls":{"$ref":"#/$defs/InternalControls"},"lastModifiedDate":{"type":"string","description":"The last date the loan product was updated.","format":"date-time"},"loanAmountSettings":{"$ref":"#/$defs/LoanAmountSettings"},"name":{"type":"string","description":"The name of the loan product."},"newAccountSettings":{"$ref":"#/$defs/NewAccountSettings"},"notes":{"type":"string","description":"The notes or description of the loan product."},"offsetSettings":{"$ref":"#/$defs/OffsetSettings"},"paymentSettings":{"$ref":"#/$defs/PaymentSettings"},"penaltySettings":{"$ref":"#/$defs/ProductPenaltySettings"},"redrawSettings":{"$ref":"#/$defs/ProductRedrawSettings"},"scheduleSettings":{"$ref":"#/$defs/LoanProductScheduleSettings"},"securitySettings":{"$ref":"#/$defs/SecuritySettings"},"state":{"description":"The current state of the loan product.","enum":["ACTIVE","INACTIVE"]},"taxSettings":{"$ref":"#/$defs/TaxSettings"},"templates":{"type":"array","description":"The template documents of the loan product.","items":{"$ref":"#/$defs/DocumentTemplate"}},"type":{"description":"The type of the loan product.","enum":["FIXED_TERM_LOAN","DYNAMIC_TERM_LOAN","INTEREST_FREE_LOAN","TRANCHED_LOAN","REVOLVING_CREDIT","INTEREST_ONLY_EQUAL_INSTALLMENTS"]}},"required":["creditArrangementSettings","id","name","type"],"additionalProperties":true};const schema15 = {"type":"object","description":"Defines the settings for account linking.","properties":{"enabled":{"type":"boolean","description":"Shows whether the loan accounts created using this product can be linked to a savings account."},"linkableDepositProductKey":{"type":"string","description":"Loan accounts created for this product can only be linked the the savings accounts that use the savings product with this key. If null, the loan accounts for this product can be linked to any savings account."},"linkedAccountOptions":{"type":"array","description":"A set of linked account options.","items":{"enum":["AUTO_LINK_ACCOUNTS","AUTO_CREATE_LINKED_ACCOUNTS"]},"uniqueItems":true},"settlementMethod":{"description":"Set the option of automated transfer that should be made from linked deposit accounts into loan accounts create from this product.","enum":["FULL_DUE_AMOUNTS","PARTIAL_DUE_AMOUNTS","NO_AUTOMATED_TRANSFERS"]}},"required":["enabled"],"additionalProperties":true};const schema21 = {"type":"object","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"creditArrangementRequirement":{"description":"Shows whether accounts created after this product can/should be part of a line of credit.","enum":["OPTIONAL","REQUIRED","NOT_REQUIRED"]}},"additionalProperties":true};const schema22 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema47 = {"type":"object","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["accountInitialState","idGeneratorType","idPattern"],"additionalProperties":true};const schema48 = {"type":"object","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","description":"Indicates whether the product supports offset"}},"additionalProperties":true};const schema56 = {"type":"object","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true};const schema66 = {"type":"object","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","description":"Shows whether collateral (assets or other goods) are accepted in order to reach required securities percentage from loan amount, as defined in this product."},"isGuarantorsEnabled":{"type":"boolean","description":"Shows whether guarantors (other clients) are accepted in order to reach the required securities percentage from loan amount, as defined in this product."},"requiredGuaranties":{"type":"number","description":"The securities percentage from loan amount that is needed in order for this account to be approved. Null if the securities are not required."}},"additionalProperties":true};const schema67 = {"type":"object","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true};const schema68 = {"type":"object","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","description":"The name the document"},"type":{"description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true};const schema13 = {"type":"object","description":"Accounting settings, defines the accounting settings for the product.","properties":{"accountingMethod":{"description":"The calculation method used for accounting.","enum":["NONE","CASH","ACCRUAL"]},"accountingRules":{"type":"array","description":"A list of accounting rules for the product.","items":{"$ref":"#/$defs/GLAccountingRule"}},"interestAccrualCalculation":{"description":"The accounting interest calculation option selected for the product.","enum":["NONE","AGGREGATED_AMOUNT","BREAKDOWN_PER_ACCOUNT"]},"interestAccruedAccountingMethod":{"description":"The interval defined for a product when the interest accrues should be maintained.","enum":["NONE","DAILY","END_OF_MONTH"]}},"required":["accountingMethod"],"additionalProperties":true};const schema14 = {"type":"object","description":"The GL accounting rule, it maps a financial resource with a GL account for a specific product (i.e loan or saving).","properties":{"encodedKey":{"type":"string","description":"The encoded key of the accounting rule, auto generated, unique."},"financialResource":{"description":"General Ledger Financial Resources used to setup the product accounting rules and determine the credit and debit accounts when logging journal entries","enum":["PORTFOLIO_CONTROL","FUND_SOURCE","WRITE_OFF_EXPENSE","INTEREST_INCOME","PAYMENT_HOLIDAY_INTEREST_INCOME","TAXES_PAYABLE","FEE_INCOME","PENALTY_INCOME","NEGATIVE_INTEREST_PAYABLE_RECEIVABLE","NEGATIVE_INTEREST_PAYABLE","INTEREST_RECEIVABLE","PAYMENT_HOLIDAY_INTEREST_RECEIVABLE","FEE_RECEIVABLE","PENALTY_RECEIVABLE","TAXES_RECEIVABLE","DEFERRED_INTERESTS_INCOME","DEFERRED_FEE_INCOME","DEFERRED_TAXES","DEPOSIT_REFERENCE","SAVINGS_CONTROL","INTEREST_EXPENSE","INTEREST_PAYABLE","NEGATIVE_INTEREST_INCOME","NEGATIVE_INTEREST_RECEIVABLE","OVERDRAFT_PORTFOLIO_CONTROL","OVERDRAFT_INTEREST_INCOME","OVERDRAFT_WRITE_OFF_EXPENSE","OVERDRAFT_INTEREST_RECEIVABLE","INTER_BRANCH_TRANSFER","INTEREST_FROM_ARREARS_INCOME","INTEREST_FROM_ARREARS_RECEIVABLE","INTEREST_FROM_ARREARS_WRITE_OFF_EXPENSE"]},"glAccountKey":{"type":"string","description":"The encoded key of the account that is mapped to the financialResource"},"transactionChannelKey":{"type":"string","description":"The key of the transaction rule that uses this rule"}},"required":["financialResource","glAccountKey"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.accountingMethod === undefined) && (missing0 = "accountingMethod")){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountingMethod !== undefined){let data0 = data.accountingMethod;const _errs2 = errors;if(!(((data0 === "NONE") || (data0 === "CASH")) || (data0 === "ACCRUAL"))){validate12.errors = [{instancePath:instancePath+"/accountingMethod",schemaPath:"#/properties/accountingMethod/enum",keyword:"enum",params:{allowedValues: schema13.properties.accountingMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.accountingRules !== undefined){let data1 = data.accountingRules;const _errs3 = errors;if(errors === _errs3){if(Array.isArray(data1)){var valid1 = true;const len0 = data1.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate16.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate16.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.branchSettings !== undefined){let data2 = data.branchSettings;const _errs5 = errors;const _errs6 = errors;if(errors === _errs6){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.availableProductBranches !== undefined){let data3 = data2.availableProductBranches;const _errs9 = errors;if(errors === _errs9){if(Array.isArray(data3)){var valid5 = true;const len1 = data3.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema40 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};const schema34 = {"type":"object","description":"The interest settings, defines constraints regarding interest that will be used on the loan account created based on this product.","properties":{"accrueInterestAfterMaturity":{"type":"boolean","description":"If the product supports this option, specify if the interest should be accrued after the account maturity date"},"allowNegativeInterestRate":{"type":"boolean","description":"Indicator whether the loan product allows negative values for interest rate or interest spread"},"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestChargeFrequency":{"description":"The interval used for determining how often is interest charged","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestChargeFrequencyCount":{"type":"integer","description":"the count of units to apply over the interval"},"interestRate":{"$ref":"#/$defs/DecimalInterval"},"interestRateCeilingValue":{"type":"number","description":"Interest spread + index interest rate can't be more than this amount (valid only for index interest rate products)."},"interestRateFloorValue":{"type":"number","description":"Interest spread + index interest rate can't be less than this amount (valid only for index interest rate products)."},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count"},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"description":"The option for how is the interest rate determined when being accrued for an account","enum":["FIXED","TIERED","TIERED_PERIOD","TIERED_BAND"]},"interestRateTiers":{"type":"array","description":"The list of interest rate tiers available for the current settings instance","items":{"$ref":"#/$defs/InterestRateTier"}}},"additionalProperties":true};const schema36 = {"type":"object","description":"Used or TIERED interest rates, holds the values to define how the interest is computed","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"interestRate":{"type":"number","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true};function validate27(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accrueInterestAfterMaturity !== undefined){const _errs2 = errors;if(typeof data.accrueInterestAfterMaturity !== "boolean"){validate27.errors = [{instancePath:instancePath+"/accrueInterestAfterMaturity",schemaPath:"#/properties/accrueInterestAfterMaturity/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.allowNegativeInterestRate !== undefined){const _errs4 = errors;if(typeof data.allowNegativeInterestRate !== "boolean"){validate27.errors = [{instancePath:instancePath+"/allowNegativeInterestRate",schemaPath:"#/properties/allowNegativeInterestRate/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs6 = errors;if(typeof data.encodedKey !== "string"){validate27.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.indexSourceKey !== undefined){const _errs8 = errors;if(typeof data.indexSourceKey !== "string"){validate27.errors = [{instancePath:instancePath+"/indexSourceKey",schemaPath:"#/properties/indexSourceKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.interestChargeFrequency !== undefined){const _errs10 = errors;let valid1;valid1 = false;for(const v0 of schema34.properties.interestChargeFrequency.enum){if(func0(data.interestChargeFrequency, v0)){valid1 = true;break;}}if(!valid1){validate27.errors = [{instancePath:instancePath+"/interestChargeFrequency",schemaPath:"#/properties/interestChargeFrequency/enum",keyword:"enum",params:{allowedValues: schema34.properties.interestChargeFrequency.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.interestChargeFrequencyCount !== undefined){let data5 = data.interestChargeFrequencyCount;const _errs11 = errors;if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){validate27.errors = [{instancePath:instancePath+"/interestChargeFrequencyCount",schemaPath:"#/properties/interestChargeFrequencyCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs11 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRate !== undefined){let data6 = data.interestRate;const _errs13 = errors;const _errs14 = errors;if(errors === _errs14){if(data6 && typeof data6 == "object" && !Array.isArray(data6)){if(data6.defaultValue !== undefined){let data7 = data6.defaultValue;const _errs17 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate27.errors = [{instancePath:instancePath+"/interestRate/defaultValue",schemaPath:"#/$defs/DecimalInterval/properties/defaultValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs17 === errors;}else {var valid3 = true;}if(valid3){if(data6.maxValue !== undefined){let data8 = data6.maxValue;const _errs19 = errors;if(!((typeof data8 == "number") && (isFinite(data8)))){validate27.errors = [{instancePath:instancePath+"/interestRate/maxValue",schemaPath:"#/$defs/DecimalInterval/properties/maxValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs19 === errors;}else {var valid3 = true;}if(valid3){if(data6.minValue !== undefined){let data9 = data6.minValue;const _errs21 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate27.errors = [{instancePath:instancePath+"/interestRate/minValue",schemaPath:"#/$defs/DecimalInterval/properties/minValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs21 === errors;}else {var valid3 = true;}}}}else {validate27.errors = [{instancePath:instancePath+"/interestRate",schemaPath:"#/$defs/DecimalInterval/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateCeilingValue !== undefined){let data10 = data.interestRateCeilingValue;const _errs23 = errors;if(!((typeof data10 == "number") && (isFinite(data10)))){validate27.errors = [{instancePath:instancePath+"/interestRateCeilingValue",schemaPath:"#/properties/interestRateCeilingValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs23 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateFloorValue !== undefined){let data11 = data.interestRateFloorValue;const _errs25 = errors;if(!((typeof data11 == "number") && (isFinite(data11)))){validate27.errors = [{instancePath:instancePath+"/interestRateFloorValue",schemaPath:"#/properties/interestRateFloorValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs25 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateReviewCount !== undefined){let data12 = data.interestRateReviewCount;const _errs27 = errors;if(!(((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12))) && (isFinite(data12)))){validate27.errors = [{instancePath:instancePath+"/interestRateReviewCount",schemaPath:"#/properties/interestRateReviewCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs27 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateReviewUnit !== undefined){let data13 = data.interestRateReviewUnit;const _errs29 = errors;if(!(((data13 === "DAYS") || (data13 === "WEEKS")) || (data13 === "MONTHS"))){validate27.errors = [{instancePath:instancePath+"/interestRateReviewUnit",schemaPath:"#/properties/interestRateReviewUnit/enum",keyword:"enum",params:{allowedValues: schema34.properties.interestRateReviewUnit.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs29 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateSource !== undefined){let data14 = data.interestRateSource;const _errs30 = errors;if(!((data14 === "FIXED_INTEREST_RATE") || (data14 === "INDEX_INTEREST_RATE"))){validate27.errors = [{instancePath:instancePath+"/interestRateSource",schemaPath:"#/properties/interestRateSource/enum",keyword:"enum",params:{allowedValues: schema34.properties.interestRateSource.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs30 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateTerms !== undefined){let data15 = data.interestRateTerms;const _errs31 = errors;if(!((((data15 === "FIXED") || (data15 === "TIERED")) || (data15 === "TIERED_PERIOD")) || (data15 === "TIERED_BAND"))){validate27.errors = [{instancePath:instancePath+"/interestRateTerms",schemaPath:"#/properties/interestRateTerms/enum",keyword:"enum",params:{allowedValues: schema34.properties.interestRateTerms.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateTiers !== undefined){let data16 = data.interestRateTiers;const _errs32 = errors;if(errors === _errs32){if(Array.isArray(data16)){var valid4 = true;const len0 = data16.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Schedule Due Dates Method is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTHs.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["repaymentReschedulingMethod","repaymentScheduleMethod","scheduleDueDatesMethod"],"additionalProperties":true};const schema58 = {"type":"object","description":"It holds information about the loan product amortization period. The PMT is calculated as the loan would have [amortisationPeriod] instalments","properties":{"defaultValue":{"type":"integer","description":"default value"},"maxValue":{"type":"integer","description":"max value"},"minValue":{"type":"integer","description":"min value"}},"additionalProperties":true};const schema59 = {"type":"object","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema62 = {"type":"object","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","description":"Preview Schedule status."}},"additionalProperties":true};const schema63 = {"type":"object","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"description":"Specifies the rounding repayment schedule method.","enum":["NO_ROUNDING","ROUND_REMAINDER_INTO_LAST_REPAYMENT","ROUND_PRINCIPAL_AND_INTEREST_REMAINDER_INTO_LAST_REPAYMENT"]}},"required":["repaymentCurrencyRounding","repaymentElementsRoundingMethod","roundingRepaymentScheduleMethod"],"additionalProperties":true};const schema64 = {"type":"object","description":"Holds Repayments Schedule Editing options","properties":{"paymentHolidaysSettings":{"$ref":"#/$defs/PaymentHolidaysSettings"}},"additionalProperties":true};const schema65 = {"type":"object","description":"Holds Payment Holidays Settings","properties":{"paymentHolidaysLoanTermOption":{"description":"payment holiday option","enum":["EXTEND_LOAN_TERM","KEEP_THE_SAME_LOAN_TERM"]}},"additionalProperties":true};function validate43(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.paymentHolidaysSettings !== undefined){let data0 = data.paymentHolidaysSettings;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.paymentHolidaysLoanTermOption !== undefined){let data1 = data0.paymentHolidaysLoanTermOption;if(!((data1 === "EXTEND_LOAN_TERM") || (data1 === "KEEP_THE_SAME_LOAN_TERM"))){validate43.errors = [{instancePath:instancePath+"/paymentHolidaysSettings/paymentHolidaysLoanTermOption",schemaPath:"#/$defs/PaymentHolidaysSettings/properties/paymentHolidaysLoanTermOption/enum",keyword:"enum",params:{allowedValues: schema65.properties.paymentHolidaysLoanTermOption.enum},message:"must be equal to one of the allowed values"}];return false;}}}else {validate43.errors = [{instancePath:instancePath+"/paymentHolidaysSettings",schemaPath:"#/$defs/PaymentHolidaysSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate43.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate43.errors = vErrors;return errors === 0;}function validate42(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((((data.repaymentReschedulingMethod === undefined) && (missing0 = "repaymentReschedulingMethod")) || ((data.repaymentScheduleMethod === undefined) && (missing0 = "repaymentScheduleMethod"))) || ((data.scheduleDueDatesMethod === undefined) && (missing0 = "scheduleDueDatesMethod"))){validate42.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.defaultValue !== undefined){let data1 = data0.defaultValue;const _errs6 = errors;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate42.errors = [{instancePath:instancePath+"/amortizationPeriod/defaultValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/defaultValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.maxValue !== undefined){let data2 = data0.maxValue;const _errs8 = errors;if(!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))){validate42.errors = [{instancePath:instancePath+"/amortizationPeriod/maxValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/maxValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.minValue !== undefined){let data3 = data0.minValue;const _errs10 = errors;if(!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))){validate42.errors = [{instancePath:instancePath+"/amortizationPeriod/minValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/minValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}else {validate42.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/$defs/ProductAmortizationPeriod/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycles !== undefined){let data4 = data.billingCycles;const _errs12 = errors;const _errs13 = errors;if(errors === _errs13){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){if(data4.enabled !== undefined){const _errs16 = errors;if(typeof data4.enabled !== "boolean"){validate42.errors = [{instancePath:instancePath+"/billingCycles/enabled",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/enabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid4 = _errs16 === errors;}else {var valid4 = true;}if(valid4){if(data4.startDays !== undefined){let data6 = data4.startDays;const _errs18 = errors;if(errors === _errs18){if(Array.isArray(data6)){var valid5 = true;const len0 = data6.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data6[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate42.errors = [{instancePath:instancePath+"/billingCycles/startDays",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/startDays/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate42.errors = [{instancePath:instancePath+"/billingCycles/startDays",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/startDays/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid4 = _errs18 === errors;}else {var valid4 = true;}}}else {validate42.errors = [{instancePath:instancePath+"/billingCycles",schemaPath:"#/$defs/BillingCyclesProductSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultRepaymentPeriodCount !== undefined){let data8 = data.defaultRepaymentPeriodCount;const _errs22 = errors;if(!(((typeof data8 == "number") && (!(data8 % 1) && !isNaN(data8))) && (isFinite(data8)))){validate42.errors = [{instancePath:instancePath+"/defaultRepaymentPeriodCount",schemaPath:"#/properties/defaultRepaymentPeriodCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.firstRepaymentDueDateOffset !== undefined){let data9 = data.firstRepaymentDueDateOffset;const _errs24 = errors;const _errs25 = errors;if(errors === _errs25){if(data9 && typeof data9 == "object" && !Array.isArray(data9)){if(data9.defaultValue !== undefined){let data10 = data9.defaultValue;const _errs28 = errors;if(!(((typeof data10 == "number") && (!(data10 % 1) && !isNaN(data10))) && (isFinite(data10)))){validate42.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/defaultValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/defaultValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs28 === errors;}else {var valid8 = true;}if(valid8){if(data9.encodedKey !== undefined){const _errs30 = errors;if(typeof data9.encodedKey !== "string"){validate42.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/encodedKey",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid8 = _errs30 === errors;}else {var valid8 = true;}if(valid8){if(data9.maxValue !== undefined){let data12 = data9.maxValue;const _errs32 = errors;if(!(((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12))) && (isFinite(data12)))){validate42.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/maxValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/maxValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs32 === errors;}else {var valid8 = true;}if(valid8){if(data9.minValue !== undefined){let data13 = data9.minValue;const _errs34 = errors;if(!(((typeof data13 == "number") && (!(data13 % 1) && !isNaN(data13))) && (isFinite(data13)))){validate42.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/minValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/minValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs34 === errors;}else {var valid8 = true;}}}}}else {validate42.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset",schemaPath:"#/$defs/IntegerIntervalConstraints/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data14 = data.fixedDaysOfMonth;const _errs36 = errors;if(errors === _errs36){if(Array.isArray(data14)){var valid9 = true;const len1 = data14.length;for(let i2=0; i2 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data4[i1], data4[j0])){validate11.errors = [{instancePath:instancePath+"/accountLinkSettings/linkedAccountOptions",schemaPath:"#/$defs/AccountLinkSettings/properties/linkedAccountOptions/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate11.errors = [{instancePath:instancePath+"/accountLinkSettings/linkedAccountOptions",schemaPath:"#/$defs/AccountLinkSettings/properties/linkedAccountOptions/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid2 = _errs11 === errors;}else {var valid2 = true;}if(valid2){if(data1.settlementMethod !== undefined){let data6 = data1.settlementMethod;const _errs14 = errors;if(!(((data6 === "FULL_DUE_AMOUNTS") || (data6 === "PARTIAL_DUE_AMOUNTS")) || (data6 === "NO_AUTOMATED_TRANSFERS"))){validate11.errors = [{instancePath:instancePath+"/accountLinkSettings/settlementMethod",schemaPath:"#/$defs/AccountLinkSettings/properties/settlementMethod/enum",keyword:"enum",params:{allowedValues: schema15.properties.settlementMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}}}}}}else {validate11.errors = [{instancePath:instancePath+"/accountLinkSettings",schemaPath:"#/$defs/AccountLinkSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs3 === errors;}else {var valid0 = true;}if(valid0){if(data.adjustInterestForFirstInstallment !== undefined){const _errs15 = errors;if(typeof data.adjustInterestForFirstInstallment !== "boolean"){validate11.errors = [{instancePath:instancePath+"/adjustInterestForFirstInstallment",schemaPath:"#/properties/adjustInterestForFirstInstallment/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs15 === errors;}else {var valid0 = true;}if(valid0){if(data.allowCustomRepaymentAllocation !== undefined){const _errs17 = errors;if(typeof data.allowCustomRepaymentAllocation !== "boolean"){validate11.errors = [{instancePath:instancePath+"/allowCustomRepaymentAllocation",schemaPath:"#/properties/allowCustomRepaymentAllocation/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.arrearsSettings !== undefined){const _errs19 = errors;if(!(validate14(data.arrearsSettings, {instancePath:instancePath+"/arrearsSettings",parentData:data,parentDataProperty:"arrearsSettings",rootData}))){vErrors = vErrors === null ? validate14.errors : vErrors.concat(validate14.errors);errors = vErrors.length;}var valid0 = _errs19 === errors;}else {var valid0 = true;}if(valid0){if(data.availabilitySettings !== undefined){const _errs20 = errors;if(!(validate16(data.availabilitySettings, {instancePath:instancePath+"/availabilitySettings",parentData:data,parentDataProperty:"availabilitySettings",rootData}))){vErrors = vErrors === null ? validate16.errors : vErrors.concat(validate16.errors);errors = vErrors.length;}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.category !== undefined){const _errs21 = errors;let valid5;valid5 = false;for(const v0 of schema12.properties.category.enum){if(func0(data.category, v0)){valid5 = true;break;}}if(!valid5){validate11.errors = [{instancePath:instancePath+"/category",schemaPath:"#/properties/category/enum",keyword:"enum",params:{allowedValues: schema12.properties.category.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs21 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs22 = errors;if(errors === _errs22){if(errors === _errs22){if(!(typeof data.creationDate === "string")){validate11.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.creditArrangementSettings !== undefined){let data13 = data.creditArrangementSettings;const _errs24 = errors;const _errs25 = errors;if(errors === _errs25){if(data13 && typeof data13 == "object" && !Array.isArray(data13)){if(data13.creditArrangementRequirement !== undefined){let data14 = data13.creditArrangementRequirement;if(!(((data14 === "OPTIONAL") || (data14 === "REQUIRED")) || (data14 === "NOT_REQUIRED"))){validate11.errors = [{instancePath:instancePath+"/creditArrangementSettings/creditArrangementRequirement",schemaPath:"#/$defs/CreditArrangementSettings/properties/creditArrangementRequirement/enum",keyword:"enum",params:{allowedValues: schema21.properties.creditArrangementRequirement.enum},message:"must be equal to one of the allowed values"}];return false;}}}else {validate11.errors = [{instancePath:instancePath+"/creditArrangementSettings",schemaPath:"#/$defs/CreditArrangementSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.currency !== undefined){let data15 = data.currency;const _errs29 = errors;const _errs30 = errors;if(errors === _errs30){if(data15 && typeof data15 == "object" && !Array.isArray(data15)){if(data15.code !== undefined){const _errs33 = errors;let valid10;valid10 = false;for(const v1 of schema22.properties.code.enum){if(func0(data15.code, v1)){valid10 = true;break;}}if(!valid10){validate11.errors = [{instancePath:instancePath+"/currency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema22.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid9 = _errs33 === errors;}else {var valid9 = true;}if(valid9){if(data15.currencyCode !== undefined){const _errs34 = errors;if(typeof data15.currencyCode !== "string"){validate11.errors = [{instancePath:instancePath+"/currency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid9 = _errs34 === errors;}else {var valid9 = true;}}}else {validate11.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs29 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs36 = errors;if(typeof data.encodedKey !== "string"){validate11.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs36 === errors;}else {var valid0 = true;}if(valid0){if(data.feesSettings !== undefined){const _errs38 = errors;if(!(validate18(data.feesSettings, {instancePath:instancePath+"/feesSettings",parentData:data,parentDataProperty:"feesSettings",rootData}))){vErrors = vErrors === null ? validate18.errors : vErrors.concat(validate18.errors);errors = vErrors.length;}var valid0 = _errs38 === errors;}else {var valid0 = true;}if(valid0){if(data.fundingSettings !== undefined){const _errs39 = errors;if(!(validate22(data.fundingSettings, {instancePath:instancePath+"/fundingSettings",parentData:data,parentDataProperty:"fundingSettings",rootData}))){vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors);errors = vErrors.length;}var valid0 = _errs39 === errors;}else {var valid0 = true;}if(valid0){if(data.gracePeriodSettings !== undefined){const _errs40 = errors;if(!(validate24(data.gracePeriodSettings, {instancePath:instancePath+"/gracePeriodSettings",parentData:data,parentDataProperty:"gracePeriodSettings",rootData}))){vErrors = vErrors === null ? validate24.errors : vErrors.concat(validate24.errors);errors = vErrors.length;}var valid0 = _errs40 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs41 = errors;if(typeof data.id !== "string"){validate11.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.interestSettings !== undefined){const _errs43 = errors;if(!(validate26(data.interestSettings, {instancePath:instancePath+"/interestSettings",parentData:data,parentDataProperty:"interestSettings",rootData}))){vErrors = vErrors === null ? validate26.errors : vErrors.concat(validate26.errors);errors = vErrors.length;}var valid0 = _errs43 === errors;}else {var valid0 = true;}if(valid0){if(data.internalControls !== undefined){const _errs44 = errors;if(!(validate32(data.internalControls, {instancePath:instancePath+"/internalControls",parentData:data,parentDataProperty:"internalControls",rootData}))){vErrors = vErrors === null ? validate32.errors : vErrors.concat(validate32.errors);errors = vErrors.length;}var valid0 = _errs44 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){const _errs45 = errors;if(errors === _errs45){if(errors === _errs45){if(!(typeof data.lastModifiedDate === "string")){validate11.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs45 === errors;}else {var valid0 = true;}if(valid0){if(data.loanAmountSettings !== undefined){const _errs47 = errors;if(!(validate34(data.loanAmountSettings, {instancePath:instancePath+"/loanAmountSettings",parentData:data,parentDataProperty:"loanAmountSettings",rootData}))){vErrors = vErrors === null ? validate34.errors : vErrors.concat(validate34.errors);errors = vErrors.length;}var valid0 = _errs47 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs48 = errors;if(typeof data.name !== "string"){validate11.errors = [{instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs48 === errors;}else {var valid0 = true;}if(valid0){if(data.newAccountSettings !== undefined){let data28 = data.newAccountSettings;const _errs50 = errors;const _errs51 = errors;if(errors === _errs51){if(data28 && typeof data28 == "object" && !Array.isArray(data28)){let missing2;if((((data28.accountInitialState === undefined) && (missing2 = "accountInitialState")) || ((data28.idGeneratorType === undefined) && (missing2 = "idGeneratorType"))) || ((data28.idPattern === undefined) && (missing2 = "idPattern"))){validate11.errors = [{instancePath:instancePath+"/newAccountSettings",schemaPath:"#/$defs/NewAccountSettings/required",keyword:"required",params:{missingProperty: missing2},message:"must have required property '"+missing2+"'"}];return false;}else {if(data28.accountInitialState !== undefined){const _errs54 = errors;let valid13;valid13 = false;for(const v2 of schema47.properties.accountInitialState.enum){if(func0(data28.accountInitialState, v2)){valid13 = true;break;}}if(!valid13){validate11.errors = [{instancePath:instancePath+"/newAccountSettings/accountInitialState",schemaPath:"#/$defs/NewAccountSettings/properties/accountInitialState/enum",keyword:"enum",params:{allowedValues: schema47.properties.accountInitialState.enum},message:"must be equal to one of the allowed values"}];return false;}var valid12 = _errs54 === errors;}else {var valid12 = true;}if(valid12){if(data28.idGeneratorType !== undefined){let data30 = data28.idGeneratorType;const _errs55 = errors;if(!((data30 === "INCREMENTAL_NUMBER") || (data30 === "RANDOM_PATTERN"))){validate11.errors = [{instancePath:instancePath+"/newAccountSettings/idGeneratorType",schemaPath:"#/$defs/NewAccountSettings/properties/idGeneratorType/enum",keyword:"enum",params:{allowedValues: schema47.properties.idGeneratorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid12 = _errs55 === errors;}else {var valid12 = true;}if(valid12){if(data28.idPattern !== undefined){const _errs56 = errors;if(typeof data28.idPattern !== "string"){validate11.errors = [{instancePath:instancePath+"/newAccountSettings/idPattern",schemaPath:"#/$defs/NewAccountSettings/properties/idPattern/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid12 = _errs56 === errors;}else {var valid12 = true;}}}}}else {validate11.errors = [{instancePath:instancePath+"/newAccountSettings",schemaPath:"#/$defs/NewAccountSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs50 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs58 = errors;if(typeof data.notes !== "string"){validate11.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs58 === errors;}else {var valid0 = true;}if(valid0){if(data.offsetSettings !== undefined){let data33 = data.offsetSettings;const _errs60 = errors;const _errs61 = errors;if(errors === _errs61){if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(data33.allowOffset !== undefined){if(typeof data33.allowOffset !== "boolean"){validate11.errors = [{instancePath:instancePath+"/offsetSettings/allowOffset",schemaPath:"#/$defs/OffsetSettings/properties/allowOffset/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}else {validate11.errors = [{instancePath:instancePath+"/offsetSettings",schemaPath:"#/$defs/OffsetSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs60 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentSettings !== undefined){const _errs66 = errors;if(!(validate36(data.paymentSettings, {instancePath:instancePath+"/paymentSettings",parentData:data,parentDataProperty:"paymentSettings",rootData}))){vErrors = vErrors === null ? validate36.errors : vErrors.concat(validate36.errors);errors = vErrors.length;}var valid0 = _errs66 === errors;}else {var valid0 = true;}if(valid0){if(data.penaltySettings !== undefined){const _errs67 = errors;if(!(validate40(data.penaltySettings, {instancePath:instancePath+"/penaltySettings",parentData:data,parentDataProperty:"penaltySettings",rootData}))){vErrors = vErrors === null ? validate40.errors : vErrors.concat(validate40.errors);errors = vErrors.length;}var valid0 = _errs67 === errors;}else {var valid0 = true;}if(valid0){if(data.redrawSettings !== undefined){let data37 = data.redrawSettings;const _errs68 = errors;const _errs69 = errors;if(errors === _errs69){if(data37 && typeof data37 == "object" && !Array.isArray(data37)){let missing3;if((data37.allowRedraw === undefined) && (missing3 = "allowRedraw")){validate11.errors = [{instancePath:instancePath+"/redrawSettings",schemaPath:"#/$defs/ProductRedrawSettings/required",keyword:"required",params:{missingProperty: missing3},message:"must have required property '"+missing3+"'"}];return false;}else {if(data37.allowRedraw !== undefined){if(typeof data37.allowRedraw !== "boolean"){validate11.errors = [{instancePath:instancePath+"/redrawSettings/allowRedraw",schemaPath:"#/$defs/ProductRedrawSettings/properties/allowRedraw/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}}else {validate11.errors = [{instancePath:instancePath+"/redrawSettings",schemaPath:"#/$defs/ProductRedrawSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs68 === errors;}else {var valid0 = true;}if(valid0){if(data.scheduleSettings !== undefined){const _errs74 = errors;if(!(validate42(data.scheduleSettings, {instancePath:instancePath+"/scheduleSettings",parentData:data,parentDataProperty:"scheduleSettings",rootData}))){vErrors = vErrors === null ? validate42.errors : vErrors.concat(validate42.errors);errors = vErrors.length;}var valid0 = _errs74 === errors;}else {var valid0 = true;}if(valid0){if(data.securitySettings !== undefined){let data40 = data.securitySettings;const _errs75 = errors;const _errs76 = errors;if(errors === _errs76){if(data40 && typeof data40 == "object" && !Array.isArray(data40)){if(data40.isCollateralEnabled !== undefined){const _errs79 = errors;if(typeof data40.isCollateralEnabled !== "boolean"){validate11.errors = [{instancePath:instancePath+"/securitySettings/isCollateralEnabled",schemaPath:"#/$defs/SecuritySettings/properties/isCollateralEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid19 = _errs79 === errors;}else {var valid19 = true;}if(valid19){if(data40.isGuarantorsEnabled !== undefined){const _errs81 = errors;if(typeof data40.isGuarantorsEnabled !== "boolean"){validate11.errors = [{instancePath:instancePath+"/securitySettings/isGuarantorsEnabled",schemaPath:"#/$defs/SecuritySettings/properties/isGuarantorsEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid19 = _errs81 === errors;}else {var valid19 = true;}if(valid19){if(data40.requiredGuaranties !== undefined){let data43 = data40.requiredGuaranties;const _errs83 = errors;if(!((typeof data43 == "number") && (isFinite(data43)))){validate11.errors = [{instancePath:instancePath+"/securitySettings/requiredGuaranties",schemaPath:"#/$defs/SecuritySettings/properties/requiredGuaranties/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid19 = _errs83 === errors;}else {var valid19 = true;}}}}else {validate11.errors = [{instancePath:instancePath+"/securitySettings",schemaPath:"#/$defs/SecuritySettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs75 === errors;}else {var valid0 = true;}if(valid0){if(data.state !== undefined){let data44 = data.state;const _errs85 = errors;if(!((data44 === "ACTIVE") || (data44 === "INACTIVE"))){validate11.errors = [{instancePath:instancePath+"/state",schemaPath:"#/properties/state/enum",keyword:"enum",params:{allowedValues: schema12.properties.state.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs85 === errors;}else {var valid0 = true;}if(valid0){if(data.taxSettings !== undefined){let data45 = data.taxSettings;const _errs86 = errors;const _errs87 = errors;if(errors === _errs87){if(data45 && typeof data45 == "object" && !Array.isArray(data45)){if(data45.taxCalculationMethod !== undefined){let data46 = data45.taxCalculationMethod;const _errs90 = errors;if(!((data46 === "INCLUSIVE") || (data46 === "EXCLUSIVE"))){validate11.errors = [{instancePath:instancePath+"/taxSettings/taxCalculationMethod",schemaPath:"#/$defs/TaxSettings/properties/taxCalculationMethod/enum",keyword:"enum",params:{allowedValues: schema67.properties.taxCalculationMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid21 = _errs90 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnFeesEnabled !== undefined){const _errs91 = errors;if(typeof data45.taxesOnFeesEnabled !== "boolean"){validate11.errors = [{instancePath:instancePath+"/taxSettings/taxesOnFeesEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnFeesEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs91 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnInterestEnabled !== undefined){const _errs93 = errors;if(typeof data45.taxesOnInterestEnabled !== "boolean"){validate11.errors = [{instancePath:instancePath+"/taxSettings/taxesOnInterestEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnInterestEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs93 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnPenaltyEnabled !== undefined){const _errs95 = errors;if(typeof data45.taxesOnPenaltyEnabled !== "boolean"){validate11.errors = [{instancePath:instancePath+"/taxSettings/taxesOnPenaltyEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnPenaltyEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs95 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxSourceKey !== undefined){const _errs97 = errors;if(typeof data45.taxSourceKey !== "string"){validate11.errors = [{instancePath:instancePath+"/taxSettings/taxSourceKey",schemaPath:"#/$defs/TaxSettings/properties/taxSourceKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid21 = _errs97 === errors;}else {var valid21 = true;}}}}}}else {validate11.errors = [{instancePath:instancePath+"/taxSettings",schemaPath:"#/$defs/TaxSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs86 === errors;}else {var valid0 = true;}if(valid0){if(data.templates !== undefined){let data51 = data.templates;const _errs99 = errors;if(errors === _errs99){if(Array.isArray(data51)){var valid22 = true;const len1 = data51.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"ProductInterestRateSettings":{"type":"object","description":"Adjustable interest rates settings","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate settings, auto generated, unique"},"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestRate":{"$ref":"#/$defs/DecimalInterval"},"interestRateCeilingValue":{"type":"number","description":"Maximum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateFloorValue":{"type":"number","description":"Minimum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count. Valid only for index interest rate."},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit. Valid only for index interest rate.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or indexed(interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]}},"required":["interestRateSource"],"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"InternalControls":{"type":"object","description":"Constraints and automated actions and that will be applied on the accounts.","properties":{"dormancyPeriodDays":{"type":"integer","description":"Specifies the number of days for an account to be fully paid in order to auto close it."},"fourEyesPrinciple":{"$ref":"#/$defs/FourEyesPrinciple"},"lockSettings":{"$ref":"#/$defs/LockSettings"}},"additionalProperties":true},"FourEyesPrinciple":{"type":"object","description":"Settings for Four Eyes Principle","properties":{"activeForLoanApproval":{"type":"boolean","description":"Requires separate users to create and approve loan accounts"}},"additionalProperties":true},"LockSettings":{"type":"object","description":"Settings applied when transitioning accounts to Locked state","properties":{"cappingConstraintType":{"description":"Specifies constraint types for capping charges.","enum":["SOFT_CAP","HARD_CAP"]},"cappingMethod":{"description":"Specifies how principal will be used when calculating capping charges.","enum":["OUTSTANDING_PRINCIPAL_PERCENTAGE","ORIGINAL_PRINCIPAL_PERCENTAGE"]},"cappingPercentage":{"type":"number","description":"Specifies the percentage of principal that cannot be exceeded by the sum of interest, fees and penalty balances."},"lockPeriodDays":{"type":"integer","description":"Specifies the number of days for in which the account will be locked if it stays in arrears."}},"additionalProperties":true},"LoanAmountSettings":{"type":"object","description":"The amount settings, holds all amount properties.","properties":{"loanAmount":{"$ref":"#/$defs/AmountDecimalConstraints"},"trancheSettings":{"$ref":"#/$defs/TrancheSettings"}},"additionalProperties":true},"AmountDecimalConstraints":{"type":"object","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","description":"The default value, will be used in case no other value was filled in by the user."},"encodedKey":{"type":"string","description":"The encoded key of the decimal constraint, auto generated, unique"},"maxValue":{"type":"number","description":"The maximum value."},"minValue":{"type":"number","description":"The minimum value."}},"additionalProperties":true},"TrancheSettings":{"type":"object","description":"The tranche settings, indicates the settings regarding tranches in case the product is configured to support tranches.","properties":{"maxNumberOfTranches":{"type":"integer","description":"The number of tranches supported by the loan product"}},"additionalProperties":true},"NewAccountSettings":{"type":"object","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["accountInitialState","idGeneratorType","idPattern"],"additionalProperties":true},"OffsetSettings":{"type":"object","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","description":"Indicates whether the product supports offset"}},"additionalProperties":true},"PaymentSettings":{"type":"object","description":"Defines the payment settings for the loan product and for loans crated based on this product.","properties":{"amortizationMethod":{"description":"Payments Method used by loan accounts for repayments schedule generation.","enum":["STANDARD_PAYMENTS","BALLOON_PAYMENTS","OPTIMIZED_PAYMENTS","PAYMENT_PLAN"]},"latePaymentsRecalculationMethod":{"description":"Recalculate the schedule when late payments are posted on dynamic Equal Installments loans.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"paymentMethod":{"description":"The payment method. Represents the interest payment method that determines whether the payments are made Horizontally (on the Repayments) or Vertically (on the Loan Account)","enum":["HORIZONTAL","VERTICAL"]},"prepaymentSettings":{"$ref":"#/$defs/ProductPrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentProductSettings"},"repaymentAllocationOrder":{"type":"array","description":"A list of basic repayment allocation elements such as the principal, interest & fees.","items":{"enum":["PRINCIPAL","INTEREST","FEE","PENALTY"]}}},"required":["latePaymentsRecalculationMethod","paymentMethod","repaymentAllocationOrder"],"additionalProperties":true},"ProductPrepaymentSettings":{"type":"object","description":"Defines the prepayment settings for the product","properties":{"applyInterestOnPrepaymentMethod":{"description":"Whether the interest on prepayment is applied manual or automatic.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowance":{"type":"number","description":"ERC free allowance in percentage"},"futurePaymentsAcceptance":{"description":"Shows whether the future payments are allowed or not for this product (repayment transactions with entry date set in the future)","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"prepaymentAcceptance":{"description":"Shows whether the pre-payments are allowed or not for this product.","enum":["ACCEPT_PREPAYMENTS","NO_PREPAYMENTS"]},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product)","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"required":["futurePaymentsAcceptance"],"additionalProperties":true},"PrincipalPaymentProductSettings":{"type":"object","description":"Defines the principal payment settings constraints for the loans that will be created based on this product.","properties":{"amount":{"$ref":"#/$defs/AmountDecimalConstraints"},"defaultPrincipalRepaymentInterval":{"type":"integer","description":"How many repayments the principal has to be paid"},"encodedKey":{"type":"string","description":"The encoded key of the settings, auto generated, unique"},"includeFeesInFloorAmount":{"type":"boolean","description":"If true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"If true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"$ref":"#/$defs/DecimalConstraints"},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"ProductPenaltySettings":{"type":"object","description":"Defines the penalty settings for the product that will be used by the loan accounts based on this product","properties":{"loanPenaltyCalculationMethod":{"description":"The penalty calculation method","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"loanPenaltyGracePeriod":{"type":"integer","description":"Number of days to wait before applying the loan penalty amounts"},"penaltyRate":{"$ref":"#/$defs/DecimalConstraints"}},"required":["loanPenaltyCalculationMethod"],"additionalProperties":true},"ProductRedrawSettings":{"type":"object","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true},"LoanProductScheduleSettings":{"type":"object","description":"Defines the settings and constraints for schedule for the loans that are created based on this product.","properties":{"amortizationPeriod":{"$ref":"#/$defs/ProductAmortizationPeriod"},"billingCycles":{"$ref":"#/$defs/BillingCyclesProductSettings"},"defaultRepaymentPeriodCount":{"type":"integer","description":"Interval Repayment Methodology Settings."},"firstRepaymentDueDateOffset":{"$ref":"#/$defs/IntegerIntervalConstraints"},"fixedDaysOfMonth":{"type":"array","description":" Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"interestAccrualSince":{"description":"Represents the moment the interest will start getting accrued.","enum":["DISBURSEMENT","DUE_DATE"]},"numInstallments":{"$ref":"#/$defs/IntegerIntervalConstraints"},"previewSchedule":{"$ref":"#/$defs/PreviewScheduleSettings"},"repaymentMethod":{"description":"The repayment method value","enum":["AMOUNT","INSTALLMENTS"]},"repaymentPeriodUnit":{"description":"The frequency of the loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentReschedulingMethod":{"description":"The repayment rescheduling method used in calculations.","enum":["NONE","NEXT_WORKING_DAY","PREVIOUS_WORKING_DAY","EXTEND_SCHEDULE"]},"repaymentScheduleEditOptions":{"type":"array","description":"Shows the properties from the repayment schedule can be edited.","items":{"enum":["ADJUST_PAYMENT_DATES","ADJUST_PRINCIPAL_PAYMENT_SCHEDULE","ADJUST_INTEREST_PAYMENT_SCHEDULE","ADJUST_FEE_PAYMENT_SCHEDULE","ADJUST_PENALTY_PAYMENT_SCHEDULE","ADJUST_NUMBER_OF_INSTALLMENTS","ADJUST_PAYMENT_HOLIDAYS"]}},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"roundingSettings":{"$ref":"#/$defs/RoundingSettings"},"scheduleDueDatesMethod":{"description":"The methodology used by this product to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"scheduleEditOptionDetails":{"$ref":"#/$defs/RepaymentScheduleEditOptionDetails"},"shortMonthHandlingMethod":{"description":"Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Schedule Due Dates Method is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTHs.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["repaymentReschedulingMethod","repaymentScheduleMethod","scheduleDueDatesMethod"],"additionalProperties":true},"ProductAmortizationPeriod":{"type":"object","description":"It holds information about the loan product amortization period. The PMT is calculated as the loan would have [amortisationPeriod] instalments","properties":{"defaultValue":{"type":"integer","description":"default value"},"maxValue":{"type":"integer","description":"max value"},"minValue":{"type":"integer","description":"min value"}},"additionalProperties":true},"BillingCyclesProductSettings":{"type":"object","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PreviewScheduleSettings":{"type":"object","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","description":"Preview Schedule status."}},"additionalProperties":true},"RoundingSettings":{"type":"object","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"description":"Specifies the rounding repayment schedule method.","enum":["NO_ROUNDING","ROUND_REMAINDER_INTO_LAST_REPAYMENT","ROUND_PRINCIPAL_AND_INTEREST_REMAINDER_INTO_LAST_REPAYMENT"]}},"required":["repaymentCurrencyRounding","repaymentElementsRoundingMethod","roundingRepaymentScheduleMethod"],"additionalProperties":true},"RepaymentScheduleEditOptionDetails":{"type":"object","description":"Holds Repayments Schedule Editing options","properties":{"paymentHolidaysSettings":{"$ref":"#/$defs/PaymentHolidaysSettings"}},"additionalProperties":true},"PaymentHolidaysSettings":{"type":"object","description":"Holds Payment Holidays Settings","properties":{"paymentHolidaysLoanTermOption":{"description":"payment holiday option","enum":["EXTEND_LOAN_TERM","KEEP_THE_SAME_LOAN_TERM"]}},"additionalProperties":true},"SecuritySettings":{"type":"object","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","description":"Shows whether collateral (assets or other goods) are accepted in order to reach required securities percentage from loan amount, as defined in this product."},"isGuarantorsEnabled":{"type":"boolean","description":"Shows whether guarantors (other clients) are accepted in order to reach the required securities percentage from loan amount, as defined in this product."},"requiredGuaranties":{"type":"number","description":"The securities percentage from loan amount that is needed in order for this account to be approved. Null if the securities are not required."}},"additionalProperties":true},"TaxSettings":{"type":"object","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true},"DocumentTemplate":{"type":"object","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","description":"The name the document"},"type":{"description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true}}};const schema14 = {"type":"object","description":"Defines the settings for account linking.","properties":{"enabled":{"type":"boolean","description":"Shows whether the loan accounts created using this product can be linked to a savings account."},"linkableDepositProductKey":{"type":"string","description":"Loan accounts created for this product can only be linked the the savings accounts that use the savings product with this key. If null, the loan accounts for this product can be linked to any savings account."},"linkedAccountOptions":{"type":"array","description":"A set of linked account options.","items":{"enum":["AUTO_LINK_ACCOUNTS","AUTO_CREATE_LINKED_ACCOUNTS"]},"uniqueItems":true},"settlementMethod":{"description":"Set the option of automated transfer that should be made from linked deposit accounts into loan accounts create from this product.","enum":["FULL_DUE_AMOUNTS","PARTIAL_DUE_AMOUNTS","NO_AUTOMATED_TRANSFERS"]}},"required":["enabled"],"additionalProperties":true};const schema20 = {"type":"object","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"creditArrangementRequirement":{"description":"Shows whether accounts created after this product can/should be part of a line of credit.","enum":["OPTIONAL","REQUIRED","NOT_REQUIRED"]}},"additionalProperties":true};const schema21 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema46 = {"type":"object","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["accountInitialState","idGeneratorType","idPattern"],"additionalProperties":true};const schema47 = {"type":"object","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","description":"Indicates whether the product supports offset"}},"additionalProperties":true};const schema55 = {"type":"object","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true};const schema65 = {"type":"object","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","description":"Shows whether collateral (assets or other goods) are accepted in order to reach required securities percentage from loan amount, as defined in this product."},"isGuarantorsEnabled":{"type":"boolean","description":"Shows whether guarantors (other clients) are accepted in order to reach the required securities percentage from loan amount, as defined in this product."},"requiredGuaranties":{"type":"number","description":"The securities percentage from loan amount that is needed in order for this account to be approved. Null if the securities are not required."}},"additionalProperties":true};const schema66 = {"type":"object","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true};const schema67 = {"type":"object","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","description":"The name the document"},"type":{"description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true};const schema12 = {"type":"object","description":"Accounting settings, defines the accounting settings for the product.","properties":{"accountingMethod":{"description":"A list of accounting rules for a product.","enum":["NONE","CASH","ACCRUAL"]},"accountingRules":{"type":"array","description":"A list of accounting rules for the product.","items":{"$ref":"#/$defs/GLAccountingRule"}},"interestAccrualCalculation":{"description":"The accounting interest calculation option selected for the product.","enum":["NONE","AGGREGATED_AMOUNT","BREAKDOWN_PER_ACCOUNT"]},"interestAccruedAccountingMethod":{"description":"A list of accounting rules for a product.","enum":["NONE","DAILY","END_OF_MONTH"]}},"required":["accountingMethod"],"additionalProperties":true};const schema13 = {"type":"object","description":"The GL accounting rule, it maps a financial resource with a GL account for a specific product (i.e loan or saving).","properties":{"encodedKey":{"type":"string","description":"The encoded key of the accounting rule, auto generated, unique."},"financialResource":{"description":"General Ledger Financial Resources used to setup the product accounting rules and determine the credit and debit accounts when logging journal entries","enum":["PORTFOLIO_CONTROL","FUND_SOURCE","WRITE_OFF_EXPENSE","INTEREST_INCOME","TAXES_PAYABLE","FEE_INCOME","PENALTY_INCOME","NEGATIVE_INTEREST_PAYABLE_RECEIVABLE","NEGATIVE_INTEREST_PAYABLE","INTEREST_RECEIVABLE","FEE_RECEIVABLE","PENALTY_RECEIVABLE","TAXES_RECEIVABLE","DEFERRED_INTERESTS_INCOME","DEFERRED_FEE_INCOME","DEFERRED_TAXES","DEPOSIT_REFERENCE","SAVINGS_CONTROL","INTEREST_EXPENSE","INTEREST_PAYABLE","NEGATIVE_INTEREST_INCOME","NEGATIVE_INTEREST_RECEIVABLE","OVERDRAFT_PORTFOLIO_CONTROL","OVERDRAFT_INTEREST_INCOME","OVERDRAFT_WRITE_OFF_EXPENSE","OVERDRAFT_INTEREST_RECEIVABLE","INTER_BRANCH_TRANSFER"]},"glAccountKey":{"type":"string","description":"The encoded key of the account that is mapped to the financialResource"},"transactionChannelKey":{"type":"string","description":"The key of the transaction rule that uses this rule"}},"required":["financialResource","glAccountKey"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.accountingMethod === undefined) && (missing0 = "accountingMethod")){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountingMethod !== undefined){let data0 = data.accountingMethod;const _errs2 = errors;if(!(((data0 === "NONE") || (data0 === "CASH")) || (data0 === "ACCRUAL"))){validate11.errors = [{instancePath:instancePath+"/accountingMethod",schemaPath:"#/properties/accountingMethod/enum",keyword:"enum",params:{allowedValues: schema12.properties.accountingMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.accountingRules !== undefined){let data1 = data.accountingRules;const _errs3 = errors;if(errors === _errs3){if(Array.isArray(data1)){var valid1 = true;const len0 = data1.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate15.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate15.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.branchSettings !== undefined){let data2 = data.branchSettings;const _errs5 = errors;const _errs6 = errors;if(errors === _errs6){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.availableProductBranches !== undefined){let data3 = data2.availableProductBranches;const _errs9 = errors;if(errors === _errs9){if(Array.isArray(data3)){var valid5 = true;const len1 = data3.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema39 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};const schema33 = {"type":"object","description":"The interest settings, defines constraints regarding interest that will be used on the loan account created based on this product.","properties":{"accrueInterestAfterMaturity":{"type":"boolean","description":"If the product supports this option, specify if the interest should be accrued after the account maturity date"},"allowNegativeInterestRate":{"type":"boolean","description":"Indicator whether the loan product allows negative values for interest rate or interest spread"},"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestChargeFrequency":{"description":"The interval used for determining how often is interest charged","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestChargeFrequencyCount":{"type":"integer","description":"the count of units to apply over the interval"},"interestRate":{"$ref":"#/$defs/DecimalInterval"},"interestRateCeilingValue":{"type":"number","description":"Interest spread + index interest rate can't be more than this amount (valid only for index interest rate products)."},"interestRateFloorValue":{"type":"number","description":"Interest spread + index interest rate can't be less than this amount (valid only for index interest rate products)."},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count"},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"description":"The option for how is the interest rate determined when being accrued for an account","enum":["FIXED","TIERED","TIERED_PERIOD","TIERED_BAND"]},"interestRateTiers":{"type":"array","description":"The list of interest rate tiers available for the current settings instance","items":{"$ref":"#/$defs/InterestRateTier"}}},"additionalProperties":true};const schema35 = {"type":"object","description":"Used or TIERED interest rates, holds the values to define how the interest is computed","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"interestRate":{"type":"number","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true};function validate26(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accrueInterestAfterMaturity !== undefined){const _errs2 = errors;if(typeof data.accrueInterestAfterMaturity !== "boolean"){validate26.errors = [{instancePath:instancePath+"/accrueInterestAfterMaturity",schemaPath:"#/properties/accrueInterestAfterMaturity/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.allowNegativeInterestRate !== undefined){const _errs4 = errors;if(typeof data.allowNegativeInterestRate !== "boolean"){validate26.errors = [{instancePath:instancePath+"/allowNegativeInterestRate",schemaPath:"#/properties/allowNegativeInterestRate/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs6 = errors;if(typeof data.encodedKey !== "string"){validate26.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.indexSourceKey !== undefined){const _errs8 = errors;if(typeof data.indexSourceKey !== "string"){validate26.errors = [{instancePath:instancePath+"/indexSourceKey",schemaPath:"#/properties/indexSourceKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.interestChargeFrequency !== undefined){const _errs10 = errors;let valid1;valid1 = false;for(const v0 of schema33.properties.interestChargeFrequency.enum){if(func0(data.interestChargeFrequency, v0)){valid1 = true;break;}}if(!valid1){validate26.errors = [{instancePath:instancePath+"/interestChargeFrequency",schemaPath:"#/properties/interestChargeFrequency/enum",keyword:"enum",params:{allowedValues: schema33.properties.interestChargeFrequency.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.interestChargeFrequencyCount !== undefined){let data5 = data.interestChargeFrequencyCount;const _errs11 = errors;if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){validate26.errors = [{instancePath:instancePath+"/interestChargeFrequencyCount",schemaPath:"#/properties/interestChargeFrequencyCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs11 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRate !== undefined){let data6 = data.interestRate;const _errs13 = errors;const _errs14 = errors;if(errors === _errs14){if(data6 && typeof data6 == "object" && !Array.isArray(data6)){if(data6.defaultValue !== undefined){let data7 = data6.defaultValue;const _errs17 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate26.errors = [{instancePath:instancePath+"/interestRate/defaultValue",schemaPath:"#/$defs/DecimalInterval/properties/defaultValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs17 === errors;}else {var valid3 = true;}if(valid3){if(data6.maxValue !== undefined){let data8 = data6.maxValue;const _errs19 = errors;if(!((typeof data8 == "number") && (isFinite(data8)))){validate26.errors = [{instancePath:instancePath+"/interestRate/maxValue",schemaPath:"#/$defs/DecimalInterval/properties/maxValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs19 === errors;}else {var valid3 = true;}if(valid3){if(data6.minValue !== undefined){let data9 = data6.minValue;const _errs21 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate26.errors = [{instancePath:instancePath+"/interestRate/minValue",schemaPath:"#/$defs/DecimalInterval/properties/minValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs21 === errors;}else {var valid3 = true;}}}}else {validate26.errors = [{instancePath:instancePath+"/interestRate",schemaPath:"#/$defs/DecimalInterval/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateCeilingValue !== undefined){let data10 = data.interestRateCeilingValue;const _errs23 = errors;if(!((typeof data10 == "number") && (isFinite(data10)))){validate26.errors = [{instancePath:instancePath+"/interestRateCeilingValue",schemaPath:"#/properties/interestRateCeilingValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs23 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateFloorValue !== undefined){let data11 = data.interestRateFloorValue;const _errs25 = errors;if(!((typeof data11 == "number") && (isFinite(data11)))){validate26.errors = [{instancePath:instancePath+"/interestRateFloorValue",schemaPath:"#/properties/interestRateFloorValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs25 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateReviewCount !== undefined){let data12 = data.interestRateReviewCount;const _errs27 = errors;if(!(((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12))) && (isFinite(data12)))){validate26.errors = [{instancePath:instancePath+"/interestRateReviewCount",schemaPath:"#/properties/interestRateReviewCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs27 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateReviewUnit !== undefined){let data13 = data.interestRateReviewUnit;const _errs29 = errors;if(!(((data13 === "DAYS") || (data13 === "WEEKS")) || (data13 === "MONTHS"))){validate26.errors = [{instancePath:instancePath+"/interestRateReviewUnit",schemaPath:"#/properties/interestRateReviewUnit/enum",keyword:"enum",params:{allowedValues: schema33.properties.interestRateReviewUnit.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs29 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateSource !== undefined){let data14 = data.interestRateSource;const _errs30 = errors;if(!((data14 === "FIXED_INTEREST_RATE") || (data14 === "INDEX_INTEREST_RATE"))){validate26.errors = [{instancePath:instancePath+"/interestRateSource",schemaPath:"#/properties/interestRateSource/enum",keyword:"enum",params:{allowedValues: schema33.properties.interestRateSource.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs30 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateTerms !== undefined){let data15 = data.interestRateTerms;const _errs31 = errors;if(!((((data15 === "FIXED") || (data15 === "TIERED")) || (data15 === "TIERED_PERIOD")) || (data15 === "TIERED_BAND"))){validate26.errors = [{instancePath:instancePath+"/interestRateTerms",schemaPath:"#/properties/interestRateTerms/enum",keyword:"enum",params:{allowedValues: schema33.properties.interestRateTerms.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateTiers !== undefined){let data16 = data.interestRateTiers;const _errs32 = errors;if(errors === _errs32){if(Array.isArray(data16)){var valid4 = true;const len0 = data16.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Schedule Due Dates Method is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTHs.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["repaymentReschedulingMethod","repaymentScheduleMethod","scheduleDueDatesMethod"],"additionalProperties":true};const schema57 = {"type":"object","description":"It holds information about the loan product amortization period. The PMT is calculated as the loan would have [amortisationPeriod] instalments","properties":{"defaultValue":{"type":"integer","description":"default value"},"maxValue":{"type":"integer","description":"max value"},"minValue":{"type":"integer","description":"min value"}},"additionalProperties":true};const schema58 = {"type":"object","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema61 = {"type":"object","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","description":"Preview Schedule status."}},"additionalProperties":true};const schema62 = {"type":"object","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"description":"Specifies the rounding repayment schedule method.","enum":["NO_ROUNDING","ROUND_REMAINDER_INTO_LAST_REPAYMENT","ROUND_PRINCIPAL_AND_INTEREST_REMAINDER_INTO_LAST_REPAYMENT"]}},"required":["repaymentCurrencyRounding","repaymentElementsRoundingMethod","roundingRepaymentScheduleMethod"],"additionalProperties":true};const schema63 = {"type":"object","description":"Holds Repayments Schedule Editing options","properties":{"paymentHolidaysSettings":{"$ref":"#/$defs/PaymentHolidaysSettings"}},"additionalProperties":true};const schema64 = {"type":"object","description":"Holds Payment Holidays Settings","properties":{"paymentHolidaysLoanTermOption":{"description":"payment holiday option","enum":["EXTEND_LOAN_TERM","KEEP_THE_SAME_LOAN_TERM"]}},"additionalProperties":true};function validate42(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.paymentHolidaysSettings !== undefined){let data0 = data.paymentHolidaysSettings;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.paymentHolidaysLoanTermOption !== undefined){let data1 = data0.paymentHolidaysLoanTermOption;if(!((data1 === "EXTEND_LOAN_TERM") || (data1 === "KEEP_THE_SAME_LOAN_TERM"))){validate42.errors = [{instancePath:instancePath+"/paymentHolidaysSettings/paymentHolidaysLoanTermOption",schemaPath:"#/$defs/PaymentHolidaysSettings/properties/paymentHolidaysLoanTermOption/enum",keyword:"enum",params:{allowedValues: schema64.properties.paymentHolidaysLoanTermOption.enum},message:"must be equal to one of the allowed values"}];return false;}}}else {validate42.errors = [{instancePath:instancePath+"/paymentHolidaysSettings",schemaPath:"#/$defs/PaymentHolidaysSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate42.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate42.errors = vErrors;return errors === 0;}function validate41(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((((data.repaymentReschedulingMethod === undefined) && (missing0 = "repaymentReschedulingMethod")) || ((data.repaymentScheduleMethod === undefined) && (missing0 = "repaymentScheduleMethod"))) || ((data.scheduleDueDatesMethod === undefined) && (missing0 = "scheduleDueDatesMethod"))){validate41.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.defaultValue !== undefined){let data1 = data0.defaultValue;const _errs6 = errors;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate41.errors = [{instancePath:instancePath+"/amortizationPeriod/defaultValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/defaultValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.maxValue !== undefined){let data2 = data0.maxValue;const _errs8 = errors;if(!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))){validate41.errors = [{instancePath:instancePath+"/amortizationPeriod/maxValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/maxValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.minValue !== undefined){let data3 = data0.minValue;const _errs10 = errors;if(!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))){validate41.errors = [{instancePath:instancePath+"/amortizationPeriod/minValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/minValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}else {validate41.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/$defs/ProductAmortizationPeriod/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycles !== undefined){let data4 = data.billingCycles;const _errs12 = errors;const _errs13 = errors;if(errors === _errs13){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){if(data4.enabled !== undefined){const _errs16 = errors;if(typeof data4.enabled !== "boolean"){validate41.errors = [{instancePath:instancePath+"/billingCycles/enabled",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/enabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid4 = _errs16 === errors;}else {var valid4 = true;}if(valid4){if(data4.startDays !== undefined){let data6 = data4.startDays;const _errs18 = errors;if(errors === _errs18){if(Array.isArray(data6)){var valid5 = true;const len0 = data6.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data6[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate41.errors = [{instancePath:instancePath+"/billingCycles/startDays",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/startDays/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate41.errors = [{instancePath:instancePath+"/billingCycles/startDays",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/startDays/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid4 = _errs18 === errors;}else {var valid4 = true;}}}else {validate41.errors = [{instancePath:instancePath+"/billingCycles",schemaPath:"#/$defs/BillingCyclesProductSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultRepaymentPeriodCount !== undefined){let data8 = data.defaultRepaymentPeriodCount;const _errs22 = errors;if(!(((typeof data8 == "number") && (!(data8 % 1) && !isNaN(data8))) && (isFinite(data8)))){validate41.errors = [{instancePath:instancePath+"/defaultRepaymentPeriodCount",schemaPath:"#/properties/defaultRepaymentPeriodCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.firstRepaymentDueDateOffset !== undefined){let data9 = data.firstRepaymentDueDateOffset;const _errs24 = errors;const _errs25 = errors;if(errors === _errs25){if(data9 && typeof data9 == "object" && !Array.isArray(data9)){if(data9.defaultValue !== undefined){let data10 = data9.defaultValue;const _errs28 = errors;if(!(((typeof data10 == "number") && (!(data10 % 1) && !isNaN(data10))) && (isFinite(data10)))){validate41.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/defaultValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/defaultValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs28 === errors;}else {var valid8 = true;}if(valid8){if(data9.encodedKey !== undefined){const _errs30 = errors;if(typeof data9.encodedKey !== "string"){validate41.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/encodedKey",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid8 = _errs30 === errors;}else {var valid8 = true;}if(valid8){if(data9.maxValue !== undefined){let data12 = data9.maxValue;const _errs32 = errors;if(!(((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12))) && (isFinite(data12)))){validate41.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/maxValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/maxValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs32 === errors;}else {var valid8 = true;}if(valid8){if(data9.minValue !== undefined){let data13 = data9.minValue;const _errs34 = errors;if(!(((typeof data13 == "number") && (!(data13 % 1) && !isNaN(data13))) && (isFinite(data13)))){validate41.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/minValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/minValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs34 === errors;}else {var valid8 = true;}}}}}else {validate41.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset",schemaPath:"#/$defs/IntegerIntervalConstraints/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data14 = data.fixedDaysOfMonth;const _errs36 = errors;if(errors === _errs36){if(Array.isArray(data14)){var valid9 = true;const len1 = data14.length;for(let i2=0; i2 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data4[i1], data4[j0])){validate10.errors = [{instancePath:instancePath+"/accountLinkSettings/linkedAccountOptions",schemaPath:"#/$defs/AccountLinkSettings/properties/linkedAccountOptions/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate10.errors = [{instancePath:instancePath+"/accountLinkSettings/linkedAccountOptions",schemaPath:"#/$defs/AccountLinkSettings/properties/linkedAccountOptions/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid2 = _errs11 === errors;}else {var valid2 = true;}if(valid2){if(data1.settlementMethod !== undefined){let data6 = data1.settlementMethod;const _errs14 = errors;if(!(((data6 === "FULL_DUE_AMOUNTS") || (data6 === "PARTIAL_DUE_AMOUNTS")) || (data6 === "NO_AUTOMATED_TRANSFERS"))){validate10.errors = [{instancePath:instancePath+"/accountLinkSettings/settlementMethod",schemaPath:"#/$defs/AccountLinkSettings/properties/settlementMethod/enum",keyword:"enum",params:{allowedValues: schema14.properties.settlementMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}}}}}}else {validate10.errors = [{instancePath:instancePath+"/accountLinkSettings",schemaPath:"#/$defs/AccountLinkSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs3 === errors;}else {var valid0 = true;}if(valid0){if(data.adjustInterestForFirstInstallment !== undefined){const _errs15 = errors;if(typeof data.adjustInterestForFirstInstallment !== "boolean"){validate10.errors = [{instancePath:instancePath+"/adjustInterestForFirstInstallment",schemaPath:"#/properties/adjustInterestForFirstInstallment/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs15 === errors;}else {var valid0 = true;}if(valid0){if(data.allowCustomRepaymentAllocation !== undefined){const _errs17 = errors;if(typeof data.allowCustomRepaymentAllocation !== "boolean"){validate10.errors = [{instancePath:instancePath+"/allowCustomRepaymentAllocation",schemaPath:"#/properties/allowCustomRepaymentAllocation/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.arrearsSettings !== undefined){const _errs19 = errors;if(!(validate13(data.arrearsSettings, {instancePath:instancePath+"/arrearsSettings",parentData:data,parentDataProperty:"arrearsSettings",rootData}))){vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);errors = vErrors.length;}var valid0 = _errs19 === errors;}else {var valid0 = true;}if(valid0){if(data.availabilitySettings !== undefined){const _errs20 = errors;if(!(validate15(data.availabilitySettings, {instancePath:instancePath+"/availabilitySettings",parentData:data,parentDataProperty:"availabilitySettings",rootData}))){vErrors = vErrors === null ? validate15.errors : vErrors.concat(validate15.errors);errors = vErrors.length;}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.category !== undefined){const _errs21 = errors;let valid5;valid5 = false;for(const v0 of schema11.properties.category.enum){if(func0(data.category, v0)){valid5 = true;break;}}if(!valid5){validate10.errors = [{instancePath:instancePath+"/category",schemaPath:"#/properties/category/enum",keyword:"enum",params:{allowedValues: schema11.properties.category.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs21 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs22 = errors;if(errors === _errs22){if(errors === _errs22){if(!(typeof data.creationDate === "string")){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.creditArrangementSettings !== undefined){let data13 = data.creditArrangementSettings;const _errs24 = errors;const _errs25 = errors;if(errors === _errs25){if(data13 && typeof data13 == "object" && !Array.isArray(data13)){if(data13.creditArrangementRequirement !== undefined){let data14 = data13.creditArrangementRequirement;if(!(((data14 === "OPTIONAL") || (data14 === "REQUIRED")) || (data14 === "NOT_REQUIRED"))){validate10.errors = [{instancePath:instancePath+"/creditArrangementSettings/creditArrangementRequirement",schemaPath:"#/$defs/CreditArrangementSettings/properties/creditArrangementRequirement/enum",keyword:"enum",params:{allowedValues: schema20.properties.creditArrangementRequirement.enum},message:"must be equal to one of the allowed values"}];return false;}}}else {validate10.errors = [{instancePath:instancePath+"/creditArrangementSettings",schemaPath:"#/$defs/CreditArrangementSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.currency !== undefined){let data15 = data.currency;const _errs29 = errors;const _errs30 = errors;if(errors === _errs30){if(data15 && typeof data15 == "object" && !Array.isArray(data15)){if(data15.code !== undefined){const _errs33 = errors;let valid10;valid10 = false;for(const v1 of schema21.properties.code.enum){if(func0(data15.code, v1)){valid10 = true;break;}}if(!valid10){validate10.errors = [{instancePath:instancePath+"/currency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema21.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid9 = _errs33 === errors;}else {var valid9 = true;}if(valid9){if(data15.currencyCode !== undefined){const _errs34 = errors;if(typeof data15.currencyCode !== "string"){validate10.errors = [{instancePath:instancePath+"/currency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid9 = _errs34 === errors;}else {var valid9 = true;}}}else {validate10.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs29 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs36 = errors;if(typeof data.encodedKey !== "string"){validate10.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs36 === errors;}else {var valid0 = true;}if(valid0){if(data.feesSettings !== undefined){const _errs38 = errors;if(!(validate17(data.feesSettings, {instancePath:instancePath+"/feesSettings",parentData:data,parentDataProperty:"feesSettings",rootData}))){vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);errors = vErrors.length;}var valid0 = _errs38 === errors;}else {var valid0 = true;}if(valid0){if(data.fundingSettings !== undefined){const _errs39 = errors;if(!(validate21(data.fundingSettings, {instancePath:instancePath+"/fundingSettings",parentData:data,parentDataProperty:"fundingSettings",rootData}))){vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors);errors = vErrors.length;}var valid0 = _errs39 === errors;}else {var valid0 = true;}if(valid0){if(data.gracePeriodSettings !== undefined){const _errs40 = errors;if(!(validate23(data.gracePeriodSettings, {instancePath:instancePath+"/gracePeriodSettings",parentData:data,parentDataProperty:"gracePeriodSettings",rootData}))){vErrors = vErrors === null ? validate23.errors : vErrors.concat(validate23.errors);errors = vErrors.length;}var valid0 = _errs40 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs41 = errors;if(typeof data.id !== "string"){validate10.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.interestSettings !== undefined){const _errs43 = errors;if(!(validate25(data.interestSettings, {instancePath:instancePath+"/interestSettings",parentData:data,parentDataProperty:"interestSettings",rootData}))){vErrors = vErrors === null ? validate25.errors : vErrors.concat(validate25.errors);errors = vErrors.length;}var valid0 = _errs43 === errors;}else {var valid0 = true;}if(valid0){if(data.internalControls !== undefined){const _errs44 = errors;if(!(validate31(data.internalControls, {instancePath:instancePath+"/internalControls",parentData:data,parentDataProperty:"internalControls",rootData}))){vErrors = vErrors === null ? validate31.errors : vErrors.concat(validate31.errors);errors = vErrors.length;}var valid0 = _errs44 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){const _errs45 = errors;if(errors === _errs45){if(errors === _errs45){if(!(typeof data.lastModifiedDate === "string")){validate10.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs45 === errors;}else {var valid0 = true;}if(valid0){if(data.loanAmountSettings !== undefined){const _errs47 = errors;if(!(validate33(data.loanAmountSettings, {instancePath:instancePath+"/loanAmountSettings",parentData:data,parentDataProperty:"loanAmountSettings",rootData}))){vErrors = vErrors === null ? validate33.errors : vErrors.concat(validate33.errors);errors = vErrors.length;}var valid0 = _errs47 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs48 = errors;if(typeof data.name !== "string"){validate10.errors = [{instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs48 === errors;}else {var valid0 = true;}if(valid0){if(data.newAccountSettings !== undefined){let data28 = data.newAccountSettings;const _errs50 = errors;const _errs51 = errors;if(errors === _errs51){if(data28 && typeof data28 == "object" && !Array.isArray(data28)){let missing2;if((((data28.accountInitialState === undefined) && (missing2 = "accountInitialState")) || ((data28.idGeneratorType === undefined) && (missing2 = "idGeneratorType"))) || ((data28.idPattern === undefined) && (missing2 = "idPattern"))){validate10.errors = [{instancePath:instancePath+"/newAccountSettings",schemaPath:"#/$defs/NewAccountSettings/required",keyword:"required",params:{missingProperty: missing2},message:"must have required property '"+missing2+"'"}];return false;}else {if(data28.accountInitialState !== undefined){const _errs54 = errors;let valid13;valid13 = false;for(const v2 of schema46.properties.accountInitialState.enum){if(func0(data28.accountInitialState, v2)){valid13 = true;break;}}if(!valid13){validate10.errors = [{instancePath:instancePath+"/newAccountSettings/accountInitialState",schemaPath:"#/$defs/NewAccountSettings/properties/accountInitialState/enum",keyword:"enum",params:{allowedValues: schema46.properties.accountInitialState.enum},message:"must be equal to one of the allowed values"}];return false;}var valid12 = _errs54 === errors;}else {var valid12 = true;}if(valid12){if(data28.idGeneratorType !== undefined){let data30 = data28.idGeneratorType;const _errs55 = errors;if(!((data30 === "INCREMENTAL_NUMBER") || (data30 === "RANDOM_PATTERN"))){validate10.errors = [{instancePath:instancePath+"/newAccountSettings/idGeneratorType",schemaPath:"#/$defs/NewAccountSettings/properties/idGeneratorType/enum",keyword:"enum",params:{allowedValues: schema46.properties.idGeneratorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid12 = _errs55 === errors;}else {var valid12 = true;}if(valid12){if(data28.idPattern !== undefined){const _errs56 = errors;if(typeof data28.idPattern !== "string"){validate10.errors = [{instancePath:instancePath+"/newAccountSettings/idPattern",schemaPath:"#/$defs/NewAccountSettings/properties/idPattern/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid12 = _errs56 === errors;}else {var valid12 = true;}}}}}else {validate10.errors = [{instancePath:instancePath+"/newAccountSettings",schemaPath:"#/$defs/NewAccountSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs50 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs58 = errors;if(typeof data.notes !== "string"){validate10.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs58 === errors;}else {var valid0 = true;}if(valid0){if(data.offsetSettings !== undefined){let data33 = data.offsetSettings;const _errs60 = errors;const _errs61 = errors;if(errors === _errs61){if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(data33.allowOffset !== undefined){if(typeof data33.allowOffset !== "boolean"){validate10.errors = [{instancePath:instancePath+"/offsetSettings/allowOffset",schemaPath:"#/$defs/OffsetSettings/properties/allowOffset/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}else {validate10.errors = [{instancePath:instancePath+"/offsetSettings",schemaPath:"#/$defs/OffsetSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs60 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentSettings !== undefined){const _errs66 = errors;if(!(validate35(data.paymentSettings, {instancePath:instancePath+"/paymentSettings",parentData:data,parentDataProperty:"paymentSettings",rootData}))){vErrors = vErrors === null ? validate35.errors : vErrors.concat(validate35.errors);errors = vErrors.length;}var valid0 = _errs66 === errors;}else {var valid0 = true;}if(valid0){if(data.penaltySettings !== undefined){const _errs67 = errors;if(!(validate39(data.penaltySettings, {instancePath:instancePath+"/penaltySettings",parentData:data,parentDataProperty:"penaltySettings",rootData}))){vErrors = vErrors === null ? validate39.errors : vErrors.concat(validate39.errors);errors = vErrors.length;}var valid0 = _errs67 === errors;}else {var valid0 = true;}if(valid0){if(data.redrawSettings !== undefined){let data37 = data.redrawSettings;const _errs68 = errors;const _errs69 = errors;if(errors === _errs69){if(data37 && typeof data37 == "object" && !Array.isArray(data37)){let missing3;if((data37.allowRedraw === undefined) && (missing3 = "allowRedraw")){validate10.errors = [{instancePath:instancePath+"/redrawSettings",schemaPath:"#/$defs/ProductRedrawSettings/required",keyword:"required",params:{missingProperty: missing3},message:"must have required property '"+missing3+"'"}];return false;}else {if(data37.allowRedraw !== undefined){if(typeof data37.allowRedraw !== "boolean"){validate10.errors = [{instancePath:instancePath+"/redrawSettings/allowRedraw",schemaPath:"#/$defs/ProductRedrawSettings/properties/allowRedraw/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}}else {validate10.errors = [{instancePath:instancePath+"/redrawSettings",schemaPath:"#/$defs/ProductRedrawSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs68 === errors;}else {var valid0 = true;}if(valid0){if(data.scheduleSettings !== undefined){const _errs74 = errors;if(!(validate41(data.scheduleSettings, {instancePath:instancePath+"/scheduleSettings",parentData:data,parentDataProperty:"scheduleSettings",rootData}))){vErrors = vErrors === null ? validate41.errors : vErrors.concat(validate41.errors);errors = vErrors.length;}var valid0 = _errs74 === errors;}else {var valid0 = true;}if(valid0){if(data.securitySettings !== undefined){let data40 = data.securitySettings;const _errs75 = errors;const _errs76 = errors;if(errors === _errs76){if(data40 && typeof data40 == "object" && !Array.isArray(data40)){if(data40.isCollateralEnabled !== undefined){const _errs79 = errors;if(typeof data40.isCollateralEnabled !== "boolean"){validate10.errors = [{instancePath:instancePath+"/securitySettings/isCollateralEnabled",schemaPath:"#/$defs/SecuritySettings/properties/isCollateralEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid19 = _errs79 === errors;}else {var valid19 = true;}if(valid19){if(data40.isGuarantorsEnabled !== undefined){const _errs81 = errors;if(typeof data40.isGuarantorsEnabled !== "boolean"){validate10.errors = [{instancePath:instancePath+"/securitySettings/isGuarantorsEnabled",schemaPath:"#/$defs/SecuritySettings/properties/isGuarantorsEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid19 = _errs81 === errors;}else {var valid19 = true;}if(valid19){if(data40.requiredGuaranties !== undefined){let data43 = data40.requiredGuaranties;const _errs83 = errors;if(!((typeof data43 == "number") && (isFinite(data43)))){validate10.errors = [{instancePath:instancePath+"/securitySettings/requiredGuaranties",schemaPath:"#/$defs/SecuritySettings/properties/requiredGuaranties/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid19 = _errs83 === errors;}else {var valid19 = true;}}}}else {validate10.errors = [{instancePath:instancePath+"/securitySettings",schemaPath:"#/$defs/SecuritySettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs75 === errors;}else {var valid0 = true;}if(valid0){if(data.state !== undefined){let data44 = data.state;const _errs85 = errors;if(!((data44 === "ACTIVE") || (data44 === "INACTIVE"))){validate10.errors = [{instancePath:instancePath+"/state",schemaPath:"#/properties/state/enum",keyword:"enum",params:{allowedValues: schema11.properties.state.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs85 === errors;}else {var valid0 = true;}if(valid0){if(data.taxSettings !== undefined){let data45 = data.taxSettings;const _errs86 = errors;const _errs87 = errors;if(errors === _errs87){if(data45 && typeof data45 == "object" && !Array.isArray(data45)){if(data45.taxCalculationMethod !== undefined){let data46 = data45.taxCalculationMethod;const _errs90 = errors;if(!((data46 === "INCLUSIVE") || (data46 === "EXCLUSIVE"))){validate10.errors = [{instancePath:instancePath+"/taxSettings/taxCalculationMethod",schemaPath:"#/$defs/TaxSettings/properties/taxCalculationMethod/enum",keyword:"enum",params:{allowedValues: schema66.properties.taxCalculationMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid21 = _errs90 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnFeesEnabled !== undefined){const _errs91 = errors;if(typeof data45.taxesOnFeesEnabled !== "boolean"){validate10.errors = [{instancePath:instancePath+"/taxSettings/taxesOnFeesEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnFeesEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs91 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnInterestEnabled !== undefined){const _errs93 = errors;if(typeof data45.taxesOnInterestEnabled !== "boolean"){validate10.errors = [{instancePath:instancePath+"/taxSettings/taxesOnInterestEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnInterestEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs93 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnPenaltyEnabled !== undefined){const _errs95 = errors;if(typeof data45.taxesOnPenaltyEnabled !== "boolean"){validate10.errors = [{instancePath:instancePath+"/taxSettings/taxesOnPenaltyEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnPenaltyEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs95 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxSourceKey !== undefined){const _errs97 = errors;if(typeof data45.taxSourceKey !== "string"){validate10.errors = [{instancePath:instancePath+"/taxSettings/taxSourceKey",schemaPath:"#/$defs/TaxSettings/properties/taxSourceKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid21 = _errs97 === errors;}else {var valid21 = true;}}}}}}else {validate10.errors = [{instancePath:instancePath+"/taxSettings",schemaPath:"#/$defs/TaxSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs86 === errors;}else {var valid0 = true;}if(valid0){if(data.templates !== undefined){let data51 = data.templates;const _errs99 = errors;if(errors === _errs99){if(Array.isArray(data51)){var valid22 = true;const len1 = data51.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true},"ProductInterestRateSettings":{"type":"object","description":"Adjustable interest rates settings","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate settings, auto generated, unique"},"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestRate":{"$ref":"#/$defs/DecimalInterval"},"interestRateCeilingValue":{"type":"number","description":"Maximum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateFloorValue":{"type":"number","description":"Minimum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count. Valid only for index interest rate."},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit. Valid only for index interest rate.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or indexed(interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]}},"required":["interestRateSource"],"additionalProperties":true},"PMTAdjustmentThreshold":{"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true},"InternalControls":{"type":"object","description":"Constraints and automated actions and that will be applied on the accounts.","properties":{"dormancyPeriodDays":{"type":"integer","description":"Specifies the number of days for an account to be fully paid in order to auto close it."},"fourEyesPrinciple":{"$ref":"#/$defs/FourEyesPrinciple"},"lockSettings":{"$ref":"#/$defs/LockSettings"}},"additionalProperties":true},"FourEyesPrinciple":{"type":"object","description":"Settings for Four Eyes Principle","properties":{"activeForLoanApproval":{"type":"boolean","description":"Requires separate users to create and approve loan accounts"}},"additionalProperties":true},"LockSettings":{"type":"object","description":"Settings applied when transitioning accounts to Locked state","properties":{"cappingConstraintType":{"description":"Specifies constraint types for capping charges.","enum":["SOFT_CAP","HARD_CAP"]},"cappingMethod":{"description":"Specifies how principal will be used when calculating capping charges.","enum":["OUTSTANDING_PRINCIPAL_PERCENTAGE","ORIGINAL_PRINCIPAL_PERCENTAGE"]},"cappingPercentage":{"type":"number","description":"Specifies the percentage of principal that cannot be exceeded by the sum of interest, fees and penalty balances."},"lockPeriodDays":{"type":"integer","description":"Specifies the number of days for in which the account will be locked if it stays in arrears."}},"additionalProperties":true},"LoanAmountSettings":{"type":"object","description":"The amount settings, holds all amount properties.","properties":{"loanAmount":{"$ref":"#/$defs/AmountDecimalConstraints"},"trancheSettings":{"$ref":"#/$defs/TrancheSettings"}},"additionalProperties":true},"AmountDecimalConstraints":{"type":"object","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","description":"The default value, will be used in case no other value was filled in by the user."},"encodedKey":{"type":"string","description":"The encoded key of the decimal constraint, auto generated, unique"},"maxValue":{"type":"number","description":"The maximum value."},"minValue":{"type":"number","description":"The minimum value."}},"additionalProperties":true},"TrancheSettings":{"type":"object","description":"The tranche settings, indicates the settings regarding tranches in case the product is configured to support tranches.","properties":{"maxNumberOfTranches":{"type":"integer","description":"The number of tranches supported by the loan product"}},"additionalProperties":true},"NewAccountSettings":{"type":"object","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["accountInitialState","idGeneratorType","idPattern"],"additionalProperties":true},"OffsetSettings":{"type":"object","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","description":"Indicates whether the product supports offset"}},"additionalProperties":true},"PaymentSettings":{"type":"object","description":"Defines the payment settings for the loan product and for loans crated based on this product.","properties":{"amortizationMethod":{"description":"Payments Method used by loan accounts for repayments schedule generation.","enum":["STANDARD_PAYMENTS","BALLOON_PAYMENTS","OPTIMIZED_PAYMENTS","PAYMENT_PLAN"]},"latePaymentsRecalculationMethod":{"description":"Recalculate the schedule when late payments are posted on dynamic Equal Installments loans.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE","NO_RECALCULATION"]},"paymentMethod":{"description":"The payment method. Represents the interest payment method that determines whether the payments are made Horizontally (on the Repayments) or Vertically (on the Loan Account)","enum":["HORIZONTAL","VERTICAL"]},"prepaymentSettings":{"$ref":"#/$defs/ProductPrepaymentSettings"},"principalPaymentSettings":{"$ref":"#/$defs/PrincipalPaymentProductSettings"},"repaymentAllocationOrder":{"type":"array","description":"A list of basic repayment allocation elements such as the principal, interest & fees.","items":{"enum":["PRINCIPAL","INTEREST","FEE","PENALTY"]}}},"required":["latePaymentsRecalculationMethod","paymentMethod","repaymentAllocationOrder"],"additionalProperties":true},"ProductPrepaymentSettings":{"type":"object","description":"Defines the prepayment settings for the product","properties":{"applyInterestOnPrepaymentMethod":{"description":"Whether the interest on prepayment is applied manual or automatic.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"description":"The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated","enum":["PRINCIPAL_EXPECTED_FIXED","TOTAL_EXPECTED_FIXED"]},"ercFreeAllowance":{"type":"number","description":"ERC free allowance in percentage"},"futurePaymentsAcceptance":{"description":"Shows whether the future payments are allowed or not for this product (repayment transactions with entry date set in the future)","enum":["NO_FUTURE_PAYMENTS","ACCEPT_FUTURE_PAYMENTS","ACCEPT_OVERPAYMENTS"]},"prepaymentAcceptance":{"description":"Shows whether the pre-payments are allowed or not for this product.","enum":["ACCEPT_PREPAYMENTS","NO_PREPAYMENTS"]},"prepaymentRecalculationMethod":{"description":"Prepayment recalculation method copied from the loan product on which this account is based","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"principalPaidInstallmentStatus":{"description":"Installment status for the case when principal is paid off (copied from loan product)","enum":["PARTIALLY_PAID","PAID","ORIGINAL_TOTAL_EXPECTED_PAID"]}},"required":["futurePaymentsAcceptance"],"additionalProperties":true},"PrincipalPaymentProductSettings":{"type":"object","description":"Defines the principal payment settings constraints for the loans that will be created based on this product.","properties":{"amount":{"$ref":"#/$defs/AmountDecimalConstraints"},"defaultPrincipalRepaymentInterval":{"type":"integer","description":"How many repayments the principal has to be paid"},"encodedKey":{"type":"string","description":"The encoded key of the settings, auto generated, unique"},"includeFeesInFloorAmount":{"type":"boolean","description":"If true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account"},"includeInterestInFloorAmount":{"type":"boolean","description":"If true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"$ref":"#/$defs/DecimalConstraints"},"principalCeilingValue":{"type":"number","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"description":"The method of principal payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]},"totalDueAmountFloor":{"type":"number","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"description":"The method of total due payment for revolving credit","enum":["FLAT","OUTSTANDING_PRINCIPAL_PERCENTAGE","PRINCIPAL_PERCENTAGE_LAST_DISB","TOTAL_BALANCE_PERCENTAGE","TOTAL_BALANCE_FLAT","TOTAL_PRINCIPAL_PERCENTAGE"]}},"additionalProperties":true},"ProductPenaltySettings":{"type":"object","description":"Defines the penalty settings for the product that will be used by the loan accounts based on this product","properties":{"loanPenaltyCalculationMethod":{"description":"The penalty calculation method","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"loanPenaltyGracePeriod":{"type":"integer","description":"Number of days to wait before applying the loan penalty amounts"},"penaltyRate":{"$ref":"#/$defs/DecimalConstraints"}},"required":["loanPenaltyCalculationMethod"],"additionalProperties":true},"ProductRedrawSettings":{"type":"object","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true},"LoanProductScheduleSettings":{"type":"object","description":"Defines the settings and constraints for schedule for the loans that are created based on this product.","properties":{"amortizationPeriod":{"$ref":"#/$defs/ProductAmortizationPeriod"},"billingCycles":{"$ref":"#/$defs/BillingCyclesProductSettings"},"defaultRepaymentPeriodCount":{"type":"integer","description":"Interval Repayment Methodology Settings."},"firstRepaymentDueDateOffset":{"$ref":"#/$defs/IntegerIntervalConstraints"},"fixedDaysOfMonth":{"type":"array","description":" Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTH.","items":{"type":"integer"}},"interestAccrualSince":{"description":"Represents the moment the interest will start getting accrued.","enum":["DISBURSEMENT","DUE_DATE"]},"numInstallments":{"$ref":"#/$defs/IntegerIntervalConstraints"},"previewSchedule":{"$ref":"#/$defs/PreviewScheduleSettings"},"repaymentMethod":{"description":"The repayment method value","enum":["AMOUNT","INSTALLMENTS"]},"repaymentPeriodUnit":{"description":"The frequency of the loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentReschedulingMethod":{"description":"The repayment rescheduling method used in calculations.","enum":["NONE","NEXT_WORKING_DAY","PREVIOUS_WORKING_DAY","EXTEND_SCHEDULE"]},"repaymentScheduleEditOptions":{"type":"array","description":"Shows the properties from the repayment schedule can be edited.","items":{"enum":["ADJUST_PAYMENT_DATES","ADJUST_PRINCIPAL_PAYMENT_SCHEDULE","ADJUST_INTEREST_PAYMENT_SCHEDULE","ADJUST_FEE_PAYMENT_SCHEDULE","ADJUST_PENALTY_PAYMENT_SCHEDULE","ADJUST_NUMBER_OF_INSTALLMENTS","ADJUST_PAYMENT_HOLIDAYS"]}},"repaymentScheduleMethod":{"description":"The repayment schedule method. Represents the method that determines whether the schedule will be fixed all over the loan account's life cycle or will be dynamically recomputed when required.","enum":["NONE","FIXED","DYNAMIC"]},"roundingSettings":{"$ref":"#/$defs/RoundingSettings"},"scheduleDueDatesMethod":{"description":"The methodology used by this product to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"scheduleEditOptionDetails":{"$ref":"#/$defs/RepaymentScheduleEditOptionDetails"},"shortMonthHandlingMethod":{"description":"Determines how to handle the short months, if they select a fixed day of month > 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Schedule Due Dates Method is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTHs.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["repaymentReschedulingMethod","repaymentScheduleMethod","scheduleDueDatesMethod"],"additionalProperties":true},"ProductAmortizationPeriod":{"type":"object","description":"It holds information about the loan product amortization period. The PMT is calculated as the loan would have [amortisationPeriod] instalments","properties":{"defaultValue":{"type":"integer","description":"default value"},"maxValue":{"type":"integer","description":"max value"},"minValue":{"type":"integer","description":"min value"}},"additionalProperties":true},"BillingCyclesProductSettings":{"type":"object","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PreviewScheduleSettings":{"type":"object","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","description":"Preview Schedule status."}},"additionalProperties":true},"RoundingSettings":{"type":"object","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"description":"Specifies the rounding repayment schedule method.","enum":["NO_ROUNDING","ROUND_REMAINDER_INTO_LAST_REPAYMENT","ROUND_PRINCIPAL_AND_INTEREST_REMAINDER_INTO_LAST_REPAYMENT"]}},"required":["repaymentCurrencyRounding","repaymentElementsRoundingMethod","roundingRepaymentScheduleMethod"],"additionalProperties":true},"RepaymentScheduleEditOptionDetails":{"type":"object","description":"Holds Repayments Schedule Editing options","properties":{"paymentHolidaysSettings":{"$ref":"#/$defs/PaymentHolidaysSettings"}},"additionalProperties":true},"PaymentHolidaysSettings":{"type":"object","description":"Holds Payment Holidays Settings","properties":{"paymentHolidaysLoanTermOption":{"description":"payment holiday option","enum":["EXTEND_LOAN_TERM","KEEP_THE_SAME_LOAN_TERM"]}},"additionalProperties":true},"SecuritySettings":{"type":"object","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","description":"Shows whether collateral (assets or other goods) are accepted in order to reach required securities percentage from loan amount, as defined in this product."},"isGuarantorsEnabled":{"type":"boolean","description":"Shows whether guarantors (other clients) are accepted in order to reach the required securities percentage from loan amount, as defined in this product."},"requiredGuaranties":{"type":"number","description":"The securities percentage from loan amount that is needed in order for this account to be approved. Null if the securities are not required."}},"additionalProperties":true},"TaxSettings":{"type":"object","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true},"DocumentTemplate":{"type":"object","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","description":"The name the document"},"type":{"description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true}}};const schema14 = {"type":"object","description":"Defines the settings for account linking.","properties":{"enabled":{"type":"boolean","description":"Shows whether the loan accounts created using this product can be linked to a savings account."},"linkableDepositProductKey":{"type":"string","description":"Loan accounts created for this product can only be linked the the savings accounts that use the savings product with this key. If null, the loan accounts for this product can be linked to any savings account."},"linkedAccountOptions":{"type":"array","description":"A set of linked account options.","items":{"enum":["AUTO_LINK_ACCOUNTS","AUTO_CREATE_LINKED_ACCOUNTS"]},"uniqueItems":true},"settlementMethod":{"description":"Set the option of automated transfer that should be made from linked deposit accounts into loan accounts create from this product.","enum":["FULL_DUE_AMOUNTS","PARTIAL_DUE_AMOUNTS","NO_AUTOMATED_TRANSFERS"]}},"required":["enabled"],"additionalProperties":true};const schema20 = {"type":"object","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"creditArrangementRequirement":{"description":"Shows whether accounts created after this product can/should be part of a line of credit.","enum":["OPTIONAL","REQUIRED","NOT_REQUIRED"]}},"additionalProperties":true};const schema21 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema46 = {"type":"object","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["accountInitialState","idGeneratorType","idPattern"],"additionalProperties":true};const schema47 = {"type":"object","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","description":"Indicates whether the product supports offset"}},"additionalProperties":true};const schema55 = {"type":"object","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true};const schema65 = {"type":"object","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","description":"Shows whether collateral (assets or other goods) are accepted in order to reach required securities percentage from loan amount, as defined in this product."},"isGuarantorsEnabled":{"type":"boolean","description":"Shows whether guarantors (other clients) are accepted in order to reach the required securities percentage from loan amount, as defined in this product."},"requiredGuaranties":{"type":"number","description":"The securities percentage from loan amount that is needed in order for this account to be approved. Null if the securities are not required."}},"additionalProperties":true};const schema66 = {"type":"object","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true};const schema67 = {"type":"object","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","description":"The name the document"},"type":{"description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true};const schema12 = {"type":"object","description":"Accounting settings, defines the accounting settings for the product.","properties":{"accountingMethod":{"description":"The calculation method used for accounting.","enum":["NONE","CASH","ACCRUAL"]},"accountingRules":{"type":"array","description":"A list of accounting rules for the product.","items":{"$ref":"#/$defs/GLAccountingRule"}},"interestAccrualCalculation":{"description":"The accounting interest calculation option selected for the product.","enum":["NONE","AGGREGATED_AMOUNT","BREAKDOWN_PER_ACCOUNT"]},"interestAccruedAccountingMethod":{"description":"The interval defined for a product when the interest accrues should be maintained.","enum":["NONE","DAILY","END_OF_MONTH"]}},"required":["accountingMethod"],"additionalProperties":true};const schema13 = {"type":"object","description":"The GL accounting rule, it maps a financial resource with a GL account for a specific product (i.e loan or saving).","properties":{"encodedKey":{"type":"string","description":"The encoded key of the accounting rule, auto generated, unique."},"financialResource":{"description":"General Ledger Financial Resources used to setup the product accounting rules and determine the credit and debit accounts when logging journal entries","enum":["PORTFOLIO_CONTROL","FUND_SOURCE","WRITE_OFF_EXPENSE","INTEREST_INCOME","PAYMENT_HOLIDAY_INTEREST_INCOME","TAXES_PAYABLE","FEE_INCOME","PENALTY_INCOME","NEGATIVE_INTEREST_PAYABLE_RECEIVABLE","NEGATIVE_INTEREST_PAYABLE","INTEREST_RECEIVABLE","PAYMENT_HOLIDAY_INTEREST_RECEIVABLE","FEE_RECEIVABLE","PENALTY_RECEIVABLE","TAXES_RECEIVABLE","DEFERRED_INTERESTS_INCOME","DEFERRED_FEE_INCOME","DEFERRED_TAXES","DEPOSIT_REFERENCE","SAVINGS_CONTROL","INTEREST_EXPENSE","INTEREST_PAYABLE","NEGATIVE_INTEREST_INCOME","NEGATIVE_INTEREST_RECEIVABLE","OVERDRAFT_PORTFOLIO_CONTROL","OVERDRAFT_INTEREST_INCOME","OVERDRAFT_WRITE_OFF_EXPENSE","OVERDRAFT_INTEREST_RECEIVABLE","INTER_BRANCH_TRANSFER","INTEREST_FROM_ARREARS_INCOME","INTEREST_FROM_ARREARS_RECEIVABLE","INTEREST_FROM_ARREARS_WRITE_OFF_EXPENSE"]},"glAccountKey":{"type":"string","description":"The encoded key of the account that is mapped to the financialResource"},"transactionChannelKey":{"type":"string","description":"The key of the transaction rule that uses this rule"}},"required":["financialResource","glAccountKey"],"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.accountingMethod === undefined) && (missing0 = "accountingMethod")){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountingMethod !== undefined){let data0 = data.accountingMethod;const _errs2 = errors;if(!(((data0 === "NONE") || (data0 === "CASH")) || (data0 === "ACCRUAL"))){validate11.errors = [{instancePath:instancePath+"/accountingMethod",schemaPath:"#/properties/accountingMethod/enum",keyword:"enum",params:{allowedValues: schema12.properties.accountingMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.accountingRules !== undefined){let data1 = data.accountingRules;const _errs3 = errors;if(errors === _errs3){if(Array.isArray(data1)){var valid1 = true;const len0 = data1.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate15.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate15.errors = [{instancePath:instancePath+"/availableFor",schemaPath:"#/properties/availableFor/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.branchSettings !== undefined){let data2 = data.branchSettings;const _errs5 = errors;const _errs6 = errors;if(errors === _errs6){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.availableProductBranches !== undefined){let data3 = data2.availableProductBranches;const _errs9 = errors;if(errors === _errs9){if(Array.isArray(data3)){var valid5 = true;const len1 = data3.length;for(let i2=0; i2 28. Will be null if no such date is selected. Only available if the Interest Application Method is InterestApplicationMethodDTO#FIXED_DAYS_OF_MONTH.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"additionalProperties":true};const schema39 = {"type":"object","description":"Represents PMT Adjustment threshold settings for loan accounts and loan products.","properties":{"method":{"description":"The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","description":"The number of days that trigger a PMT Adjustment."}},"additionalProperties":true};const schema33 = {"type":"object","description":"The interest settings, defines constraints regarding interest that will be used on the loan account created based on this product.","properties":{"accrueInterestAfterMaturity":{"type":"boolean","description":"If the product supports this option, specify if the interest should be accrued after the account maturity date"},"allowNegativeInterestRate":{"type":"boolean","description":"Indicator whether the loan product allows negative values for interest rate or interest spread"},"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"indexSourceKey":{"type":"string","description":"Index rate source key."},"interestChargeFrequency":{"description":"The interval used for determining how often is interest charged","enum":["ANNUALIZED","EVERY_MONTH","EVERY_FOUR_WEEKS","EVERY_WEEK","EVERY_DAY","EVERY_X_DAYS"]},"interestChargeFrequencyCount":{"type":"integer","description":"the count of units to apply over the interval"},"interestRate":{"$ref":"#/$defs/DecimalInterval"},"interestRateCeilingValue":{"type":"number","description":"Interest spread + index interest rate can't be more than this amount (valid only for index interest rate products)."},"interestRateFloorValue":{"type":"number","description":"Interest spread + index interest rate can't be less than this amount (valid only for index interest rate products)."},"interestRateReviewCount":{"type":"integer","description":"Interest rate review frequency unit count"},"interestRateReviewUnit":{"description":"Interest rate review frequency measurement unit","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"description":"Interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"description":"The option for how is the interest rate determined when being accrued for an account","enum":["FIXED","TIERED","TIERED_PERIOD","TIERED_BAND"]},"interestRateTiers":{"type":"array","description":"The list of interest rate tiers available for the current settings instance","items":{"$ref":"#/$defs/InterestRateTier"}}},"additionalProperties":true};const schema35 = {"type":"object","description":"Used or TIERED interest rates, holds the values to define how the interest is computed","properties":{"encodedKey":{"type":"string","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"interestRate":{"type":"number","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true};function validate26(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accrueInterestAfterMaturity !== undefined){const _errs2 = errors;if(typeof data.accrueInterestAfterMaturity !== "boolean"){validate26.errors = [{instancePath:instancePath+"/accrueInterestAfterMaturity",schemaPath:"#/properties/accrueInterestAfterMaturity/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.allowNegativeInterestRate !== undefined){const _errs4 = errors;if(typeof data.allowNegativeInterestRate !== "boolean"){validate26.errors = [{instancePath:instancePath+"/allowNegativeInterestRate",schemaPath:"#/properties/allowNegativeInterestRate/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs6 = errors;if(typeof data.encodedKey !== "string"){validate26.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.indexSourceKey !== undefined){const _errs8 = errors;if(typeof data.indexSourceKey !== "string"){validate26.errors = [{instancePath:instancePath+"/indexSourceKey",schemaPath:"#/properties/indexSourceKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.interestChargeFrequency !== undefined){const _errs10 = errors;let valid1;valid1 = false;for(const v0 of schema33.properties.interestChargeFrequency.enum){if(func0(data.interestChargeFrequency, v0)){valid1 = true;break;}}if(!valid1){validate26.errors = [{instancePath:instancePath+"/interestChargeFrequency",schemaPath:"#/properties/interestChargeFrequency/enum",keyword:"enum",params:{allowedValues: schema33.properties.interestChargeFrequency.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.interestChargeFrequencyCount !== undefined){let data5 = data.interestChargeFrequencyCount;const _errs11 = errors;if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){validate26.errors = [{instancePath:instancePath+"/interestChargeFrequencyCount",schemaPath:"#/properties/interestChargeFrequencyCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs11 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRate !== undefined){let data6 = data.interestRate;const _errs13 = errors;const _errs14 = errors;if(errors === _errs14){if(data6 && typeof data6 == "object" && !Array.isArray(data6)){if(data6.defaultValue !== undefined){let data7 = data6.defaultValue;const _errs17 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate26.errors = [{instancePath:instancePath+"/interestRate/defaultValue",schemaPath:"#/$defs/DecimalInterval/properties/defaultValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs17 === errors;}else {var valid3 = true;}if(valid3){if(data6.maxValue !== undefined){let data8 = data6.maxValue;const _errs19 = errors;if(!((typeof data8 == "number") && (isFinite(data8)))){validate26.errors = [{instancePath:instancePath+"/interestRate/maxValue",schemaPath:"#/$defs/DecimalInterval/properties/maxValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs19 === errors;}else {var valid3 = true;}if(valid3){if(data6.minValue !== undefined){let data9 = data6.minValue;const _errs21 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate26.errors = [{instancePath:instancePath+"/interestRate/minValue",schemaPath:"#/$defs/DecimalInterval/properties/minValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid3 = _errs21 === errors;}else {var valid3 = true;}}}}else {validate26.errors = [{instancePath:instancePath+"/interestRate",schemaPath:"#/$defs/DecimalInterval/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateCeilingValue !== undefined){let data10 = data.interestRateCeilingValue;const _errs23 = errors;if(!((typeof data10 == "number") && (isFinite(data10)))){validate26.errors = [{instancePath:instancePath+"/interestRateCeilingValue",schemaPath:"#/properties/interestRateCeilingValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs23 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateFloorValue !== undefined){let data11 = data.interestRateFloorValue;const _errs25 = errors;if(!((typeof data11 == "number") && (isFinite(data11)))){validate26.errors = [{instancePath:instancePath+"/interestRateFloorValue",schemaPath:"#/properties/interestRateFloorValue/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs25 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateReviewCount !== undefined){let data12 = data.interestRateReviewCount;const _errs27 = errors;if(!(((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12))) && (isFinite(data12)))){validate26.errors = [{instancePath:instancePath+"/interestRateReviewCount",schemaPath:"#/properties/interestRateReviewCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs27 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateReviewUnit !== undefined){let data13 = data.interestRateReviewUnit;const _errs29 = errors;if(!(((data13 === "DAYS") || (data13 === "WEEKS")) || (data13 === "MONTHS"))){validate26.errors = [{instancePath:instancePath+"/interestRateReviewUnit",schemaPath:"#/properties/interestRateReviewUnit/enum",keyword:"enum",params:{allowedValues: schema33.properties.interestRateReviewUnit.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs29 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateSource !== undefined){let data14 = data.interestRateSource;const _errs30 = errors;if(!((data14 === "FIXED_INTEREST_RATE") || (data14 === "INDEX_INTEREST_RATE"))){validate26.errors = [{instancePath:instancePath+"/interestRateSource",schemaPath:"#/properties/interestRateSource/enum",keyword:"enum",params:{allowedValues: schema33.properties.interestRateSource.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs30 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateTerms !== undefined){let data15 = data.interestRateTerms;const _errs31 = errors;if(!((((data15 === "FIXED") || (data15 === "TIERED")) || (data15 === "TIERED_PERIOD")) || (data15 === "TIERED_BAND"))){validate26.errors = [{instancePath:instancePath+"/interestRateTerms",schemaPath:"#/properties/interestRateTerms/enum",keyword:"enum",params:{allowedValues: schema33.properties.interestRateTerms.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateTiers !== undefined){let data16 = data.interestRateTiers;const _errs32 = errors;if(errors === _errs32){if(Array.isArray(data16)){var valid4 = true;const len0 = data16.length;for(let i0=0; i0 28. Will be null if no such date is selected and also for the Interval methodology. Only available if the Schedule Due Dates Method is ScheduleDueDatesMethodDTO#FIXED_DAYS_OF_MONTHs.","enum":["LAST_DAY_IN_MONTH","FIRST_DAY_OF_NEXT_MONTH"]}},"required":["repaymentReschedulingMethod","repaymentScheduleMethod","scheduleDueDatesMethod"],"additionalProperties":true};const schema57 = {"type":"object","description":"It holds information about the loan product amortization period. The PMT is calculated as the loan would have [amortisationPeriod] instalments","properties":{"defaultValue":{"type":"integer","description":"default value"},"maxValue":{"type":"integer","description":"max value"},"minValue":{"type":"integer","description":"min value"}},"additionalProperties":true};const schema58 = {"type":"object","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema61 = {"type":"object","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","description":"Preview Schedule status."}},"additionalProperties":true};const schema62 = {"type":"object","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"description":"Specifies the rounding repayment schedule method.","enum":["NO_ROUNDING","ROUND_REMAINDER_INTO_LAST_REPAYMENT","ROUND_PRINCIPAL_AND_INTEREST_REMAINDER_INTO_LAST_REPAYMENT"]}},"required":["repaymentCurrencyRounding","repaymentElementsRoundingMethod","roundingRepaymentScheduleMethod"],"additionalProperties":true};const schema63 = {"type":"object","description":"Holds Repayments Schedule Editing options","properties":{"paymentHolidaysSettings":{"$ref":"#/$defs/PaymentHolidaysSettings"}},"additionalProperties":true};const schema64 = {"type":"object","description":"Holds Payment Holidays Settings","properties":{"paymentHolidaysLoanTermOption":{"description":"payment holiday option","enum":["EXTEND_LOAN_TERM","KEEP_THE_SAME_LOAN_TERM"]}},"additionalProperties":true};function validate42(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.paymentHolidaysSettings !== undefined){let data0 = data.paymentHolidaysSettings;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.paymentHolidaysLoanTermOption !== undefined){let data1 = data0.paymentHolidaysLoanTermOption;if(!((data1 === "EXTEND_LOAN_TERM") || (data1 === "KEEP_THE_SAME_LOAN_TERM"))){validate42.errors = [{instancePath:instancePath+"/paymentHolidaysSettings/paymentHolidaysLoanTermOption",schemaPath:"#/$defs/PaymentHolidaysSettings/properties/paymentHolidaysLoanTermOption/enum",keyword:"enum",params:{allowedValues: schema64.properties.paymentHolidaysLoanTermOption.enum},message:"must be equal to one of the allowed values"}];return false;}}}else {validate42.errors = [{instancePath:instancePath+"/paymentHolidaysSettings",schemaPath:"#/$defs/PaymentHolidaysSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate42.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate42.errors = vErrors;return errors === 0;}function validate41(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((((data.repaymentReschedulingMethod === undefined) && (missing0 = "repaymentReschedulingMethod")) || ((data.repaymentScheduleMethod === undefined) && (missing0 = "repaymentScheduleMethod"))) || ((data.scheduleDueDatesMethod === undefined) && (missing0 = "scheduleDueDatesMethod"))){validate41.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.amortizationPeriod !== undefined){let data0 = data.amortizationPeriod;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.defaultValue !== undefined){let data1 = data0.defaultValue;const _errs6 = errors;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate41.errors = [{instancePath:instancePath+"/amortizationPeriod/defaultValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/defaultValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.maxValue !== undefined){let data2 = data0.maxValue;const _errs8 = errors;if(!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))){validate41.errors = [{instancePath:instancePath+"/amortizationPeriod/maxValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/maxValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.minValue !== undefined){let data3 = data0.minValue;const _errs10 = errors;if(!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))){validate41.errors = [{instancePath:instancePath+"/amortizationPeriod/minValue",schemaPath:"#/$defs/ProductAmortizationPeriod/properties/minValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}else {validate41.errors = [{instancePath:instancePath+"/amortizationPeriod",schemaPath:"#/$defs/ProductAmortizationPeriod/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.billingCycles !== undefined){let data4 = data.billingCycles;const _errs12 = errors;const _errs13 = errors;if(errors === _errs13){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){if(data4.enabled !== undefined){const _errs16 = errors;if(typeof data4.enabled !== "boolean"){validate41.errors = [{instancePath:instancePath+"/billingCycles/enabled",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/enabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid4 = _errs16 === errors;}else {var valid4 = true;}if(valid4){if(data4.startDays !== undefined){let data6 = data4.startDays;const _errs18 = errors;if(errors === _errs18){if(Array.isArray(data6)){var valid5 = true;const len0 = data6.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data6[i1];if(!(((typeof item0 == "number") && (!(item0 % 1) && !isNaN(item0))) && (isFinite(item0)))){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate41.errors = [{instancePath:instancePath+"/billingCycles/startDays",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/startDays/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}else {validate41.errors = [{instancePath:instancePath+"/billingCycles/startDays",schemaPath:"#/$defs/BillingCyclesProductSettings/properties/startDays/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid4 = _errs18 === errors;}else {var valid4 = true;}}}else {validate41.errors = [{instancePath:instancePath+"/billingCycles",schemaPath:"#/$defs/BillingCyclesProductSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.defaultRepaymentPeriodCount !== undefined){let data8 = data.defaultRepaymentPeriodCount;const _errs22 = errors;if(!(((typeof data8 == "number") && (!(data8 % 1) && !isNaN(data8))) && (isFinite(data8)))){validate41.errors = [{instancePath:instancePath+"/defaultRepaymentPeriodCount",schemaPath:"#/properties/defaultRepaymentPeriodCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.firstRepaymentDueDateOffset !== undefined){let data9 = data.firstRepaymentDueDateOffset;const _errs24 = errors;const _errs25 = errors;if(errors === _errs25){if(data9 && typeof data9 == "object" && !Array.isArray(data9)){if(data9.defaultValue !== undefined){let data10 = data9.defaultValue;const _errs28 = errors;if(!(((typeof data10 == "number") && (!(data10 % 1) && !isNaN(data10))) && (isFinite(data10)))){validate41.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/defaultValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/defaultValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs28 === errors;}else {var valid8 = true;}if(valid8){if(data9.encodedKey !== undefined){const _errs30 = errors;if(typeof data9.encodedKey !== "string"){validate41.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/encodedKey",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid8 = _errs30 === errors;}else {var valid8 = true;}if(valid8){if(data9.maxValue !== undefined){let data12 = data9.maxValue;const _errs32 = errors;if(!(((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12))) && (isFinite(data12)))){validate41.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/maxValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/maxValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs32 === errors;}else {var valid8 = true;}if(valid8){if(data9.minValue !== undefined){let data13 = data9.minValue;const _errs34 = errors;if(!(((typeof data13 == "number") && (!(data13 % 1) && !isNaN(data13))) && (isFinite(data13)))){validate41.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset/minValue",schemaPath:"#/$defs/IntegerIntervalConstraints/properties/minValue/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid8 = _errs34 === errors;}else {var valid8 = true;}}}}}else {validate41.errors = [{instancePath:instancePath+"/firstRepaymentDueDateOffset",schemaPath:"#/$defs/IntegerIntervalConstraints/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data14 = data.fixedDaysOfMonth;const _errs36 = errors;if(errors === _errs36){if(Array.isArray(data14)){var valid9 = true;const len1 = data14.length;for(let i2=0; i2 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data4[i1], data4[j0])){validate10.errors = [{instancePath:instancePath+"/accountLinkSettings/linkedAccountOptions",schemaPath:"#/$defs/AccountLinkSettings/properties/linkedAccountOptions/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break outer0;}}}}}}else {validate10.errors = [{instancePath:instancePath+"/accountLinkSettings/linkedAccountOptions",schemaPath:"#/$defs/AccountLinkSettings/properties/linkedAccountOptions/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid2 = _errs11 === errors;}else {var valid2 = true;}if(valid2){if(data1.settlementMethod !== undefined){let data6 = data1.settlementMethod;const _errs14 = errors;if(!(((data6 === "FULL_DUE_AMOUNTS") || (data6 === "PARTIAL_DUE_AMOUNTS")) || (data6 === "NO_AUTOMATED_TRANSFERS"))){validate10.errors = [{instancePath:instancePath+"/accountLinkSettings/settlementMethod",schemaPath:"#/$defs/AccountLinkSettings/properties/settlementMethod/enum",keyword:"enum",params:{allowedValues: schema14.properties.settlementMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}}}}}}else {validate10.errors = [{instancePath:instancePath+"/accountLinkSettings",schemaPath:"#/$defs/AccountLinkSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs3 === errors;}else {var valid0 = true;}if(valid0){if(data.adjustInterestForFirstInstallment !== undefined){const _errs15 = errors;if(typeof data.adjustInterestForFirstInstallment !== "boolean"){validate10.errors = [{instancePath:instancePath+"/adjustInterestForFirstInstallment",schemaPath:"#/properties/adjustInterestForFirstInstallment/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs15 === errors;}else {var valid0 = true;}if(valid0){if(data.allowCustomRepaymentAllocation !== undefined){const _errs17 = errors;if(typeof data.allowCustomRepaymentAllocation !== "boolean"){validate10.errors = [{instancePath:instancePath+"/allowCustomRepaymentAllocation",schemaPath:"#/properties/allowCustomRepaymentAllocation/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.arrearsSettings !== undefined){const _errs19 = errors;if(!(validate13(data.arrearsSettings, {instancePath:instancePath+"/arrearsSettings",parentData:data,parentDataProperty:"arrearsSettings",rootData}))){vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);errors = vErrors.length;}var valid0 = _errs19 === errors;}else {var valid0 = true;}if(valid0){if(data.availabilitySettings !== undefined){const _errs20 = errors;if(!(validate15(data.availabilitySettings, {instancePath:instancePath+"/availabilitySettings",parentData:data,parentDataProperty:"availabilitySettings",rootData}))){vErrors = vErrors === null ? validate15.errors : vErrors.concat(validate15.errors);errors = vErrors.length;}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.category !== undefined){const _errs21 = errors;let valid5;valid5 = false;for(const v0 of schema11.properties.category.enum){if(func0(data.category, v0)){valid5 = true;break;}}if(!valid5){validate10.errors = [{instancePath:instancePath+"/category",schemaPath:"#/properties/category/enum",keyword:"enum",params:{allowedValues: schema11.properties.category.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs21 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs22 = errors;if(errors === _errs22){if(errors === _errs22){if(!(typeof data.creationDate === "string")){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.creditArrangementSettings !== undefined){let data13 = data.creditArrangementSettings;const _errs24 = errors;const _errs25 = errors;if(errors === _errs25){if(data13 && typeof data13 == "object" && !Array.isArray(data13)){if(data13.creditArrangementRequirement !== undefined){let data14 = data13.creditArrangementRequirement;if(!(((data14 === "OPTIONAL") || (data14 === "REQUIRED")) || (data14 === "NOT_REQUIRED"))){validate10.errors = [{instancePath:instancePath+"/creditArrangementSettings/creditArrangementRequirement",schemaPath:"#/$defs/CreditArrangementSettings/properties/creditArrangementRequirement/enum",keyword:"enum",params:{allowedValues: schema20.properties.creditArrangementRequirement.enum},message:"must be equal to one of the allowed values"}];return false;}}}else {validate10.errors = [{instancePath:instancePath+"/creditArrangementSettings",schemaPath:"#/$defs/CreditArrangementSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.currency !== undefined){let data15 = data.currency;const _errs29 = errors;const _errs30 = errors;if(errors === _errs30){if(data15 && typeof data15 == "object" && !Array.isArray(data15)){if(data15.code !== undefined){const _errs33 = errors;let valid10;valid10 = false;for(const v1 of schema21.properties.code.enum){if(func0(data15.code, v1)){valid10 = true;break;}}if(!valid10){validate10.errors = [{instancePath:instancePath+"/currency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema21.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid9 = _errs33 === errors;}else {var valid9 = true;}if(valid9){if(data15.currencyCode !== undefined){const _errs34 = errors;if(typeof data15.currencyCode !== "string"){validate10.errors = [{instancePath:instancePath+"/currency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid9 = _errs34 === errors;}else {var valid9 = true;}}}else {validate10.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs29 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs36 = errors;if(typeof data.encodedKey !== "string"){validate10.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs36 === errors;}else {var valid0 = true;}if(valid0){if(data.feesSettings !== undefined){const _errs38 = errors;if(!(validate17(data.feesSettings, {instancePath:instancePath+"/feesSettings",parentData:data,parentDataProperty:"feesSettings",rootData}))){vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);errors = vErrors.length;}var valid0 = _errs38 === errors;}else {var valid0 = true;}if(valid0){if(data.fundingSettings !== undefined){const _errs39 = errors;if(!(validate21(data.fundingSettings, {instancePath:instancePath+"/fundingSettings",parentData:data,parentDataProperty:"fundingSettings",rootData}))){vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors);errors = vErrors.length;}var valid0 = _errs39 === errors;}else {var valid0 = true;}if(valid0){if(data.gracePeriodSettings !== undefined){const _errs40 = errors;if(!(validate23(data.gracePeriodSettings, {instancePath:instancePath+"/gracePeriodSettings",parentData:data,parentDataProperty:"gracePeriodSettings",rootData}))){vErrors = vErrors === null ? validate23.errors : vErrors.concat(validate23.errors);errors = vErrors.length;}var valid0 = _errs40 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs41 = errors;if(typeof data.id !== "string"){validate10.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.interestSettings !== undefined){const _errs43 = errors;if(!(validate25(data.interestSettings, {instancePath:instancePath+"/interestSettings",parentData:data,parentDataProperty:"interestSettings",rootData}))){vErrors = vErrors === null ? validate25.errors : vErrors.concat(validate25.errors);errors = vErrors.length;}var valid0 = _errs43 === errors;}else {var valid0 = true;}if(valid0){if(data.internalControls !== undefined){const _errs44 = errors;if(!(validate31(data.internalControls, {instancePath:instancePath+"/internalControls",parentData:data,parentDataProperty:"internalControls",rootData}))){vErrors = vErrors === null ? validate31.errors : vErrors.concat(validate31.errors);errors = vErrors.length;}var valid0 = _errs44 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){const _errs45 = errors;if(errors === _errs45){if(errors === _errs45){if(!(typeof data.lastModifiedDate === "string")){validate10.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs45 === errors;}else {var valid0 = true;}if(valid0){if(data.loanAmountSettings !== undefined){const _errs47 = errors;if(!(validate33(data.loanAmountSettings, {instancePath:instancePath+"/loanAmountSettings",parentData:data,parentDataProperty:"loanAmountSettings",rootData}))){vErrors = vErrors === null ? validate33.errors : vErrors.concat(validate33.errors);errors = vErrors.length;}var valid0 = _errs47 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs48 = errors;if(typeof data.name !== "string"){validate10.errors = [{instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs48 === errors;}else {var valid0 = true;}if(valid0){if(data.newAccountSettings !== undefined){let data28 = data.newAccountSettings;const _errs50 = errors;const _errs51 = errors;if(errors === _errs51){if(data28 && typeof data28 == "object" && !Array.isArray(data28)){let missing2;if((((data28.accountInitialState === undefined) && (missing2 = "accountInitialState")) || ((data28.idGeneratorType === undefined) && (missing2 = "idGeneratorType"))) || ((data28.idPattern === undefined) && (missing2 = "idPattern"))){validate10.errors = [{instancePath:instancePath+"/newAccountSettings",schemaPath:"#/$defs/NewAccountSettings/required",keyword:"required",params:{missingProperty: missing2},message:"must have required property '"+missing2+"'"}];return false;}else {if(data28.accountInitialState !== undefined){const _errs54 = errors;let valid13;valid13 = false;for(const v2 of schema46.properties.accountInitialState.enum){if(func0(data28.accountInitialState, v2)){valid13 = true;break;}}if(!valid13){validate10.errors = [{instancePath:instancePath+"/newAccountSettings/accountInitialState",schemaPath:"#/$defs/NewAccountSettings/properties/accountInitialState/enum",keyword:"enum",params:{allowedValues: schema46.properties.accountInitialState.enum},message:"must be equal to one of the allowed values"}];return false;}var valid12 = _errs54 === errors;}else {var valid12 = true;}if(valid12){if(data28.idGeneratorType !== undefined){let data30 = data28.idGeneratorType;const _errs55 = errors;if(!((data30 === "INCREMENTAL_NUMBER") || (data30 === "RANDOM_PATTERN"))){validate10.errors = [{instancePath:instancePath+"/newAccountSettings/idGeneratorType",schemaPath:"#/$defs/NewAccountSettings/properties/idGeneratorType/enum",keyword:"enum",params:{allowedValues: schema46.properties.idGeneratorType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid12 = _errs55 === errors;}else {var valid12 = true;}if(valid12){if(data28.idPattern !== undefined){const _errs56 = errors;if(typeof data28.idPattern !== "string"){validate10.errors = [{instancePath:instancePath+"/newAccountSettings/idPattern",schemaPath:"#/$defs/NewAccountSettings/properties/idPattern/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid12 = _errs56 === errors;}else {var valid12 = true;}}}}}else {validate10.errors = [{instancePath:instancePath+"/newAccountSettings",schemaPath:"#/$defs/NewAccountSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs50 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs58 = errors;if(typeof data.notes !== "string"){validate10.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs58 === errors;}else {var valid0 = true;}if(valid0){if(data.offsetSettings !== undefined){let data33 = data.offsetSettings;const _errs60 = errors;const _errs61 = errors;if(errors === _errs61){if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(data33.allowOffset !== undefined){if(typeof data33.allowOffset !== "boolean"){validate10.errors = [{instancePath:instancePath+"/offsetSettings/allowOffset",schemaPath:"#/$defs/OffsetSettings/properties/allowOffset/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}else {validate10.errors = [{instancePath:instancePath+"/offsetSettings",schemaPath:"#/$defs/OffsetSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs60 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentSettings !== undefined){const _errs66 = errors;if(!(validate35(data.paymentSettings, {instancePath:instancePath+"/paymentSettings",parentData:data,parentDataProperty:"paymentSettings",rootData}))){vErrors = vErrors === null ? validate35.errors : vErrors.concat(validate35.errors);errors = vErrors.length;}var valid0 = _errs66 === errors;}else {var valid0 = true;}if(valid0){if(data.penaltySettings !== undefined){const _errs67 = errors;if(!(validate39(data.penaltySettings, {instancePath:instancePath+"/penaltySettings",parentData:data,parentDataProperty:"penaltySettings",rootData}))){vErrors = vErrors === null ? validate39.errors : vErrors.concat(validate39.errors);errors = vErrors.length;}var valid0 = _errs67 === errors;}else {var valid0 = true;}if(valid0){if(data.redrawSettings !== undefined){let data37 = data.redrawSettings;const _errs68 = errors;const _errs69 = errors;if(errors === _errs69){if(data37 && typeof data37 == "object" && !Array.isArray(data37)){let missing3;if((data37.allowRedraw === undefined) && (missing3 = "allowRedraw")){validate10.errors = [{instancePath:instancePath+"/redrawSettings",schemaPath:"#/$defs/ProductRedrawSettings/required",keyword:"required",params:{missingProperty: missing3},message:"must have required property '"+missing3+"'"}];return false;}else {if(data37.allowRedraw !== undefined){if(typeof data37.allowRedraw !== "boolean"){validate10.errors = [{instancePath:instancePath+"/redrawSettings/allowRedraw",schemaPath:"#/$defs/ProductRedrawSettings/properties/allowRedraw/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}}else {validate10.errors = [{instancePath:instancePath+"/redrawSettings",schemaPath:"#/$defs/ProductRedrawSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs68 === errors;}else {var valid0 = true;}if(valid0){if(data.scheduleSettings !== undefined){const _errs74 = errors;if(!(validate41(data.scheduleSettings, {instancePath:instancePath+"/scheduleSettings",parentData:data,parentDataProperty:"scheduleSettings",rootData}))){vErrors = vErrors === null ? validate41.errors : vErrors.concat(validate41.errors);errors = vErrors.length;}var valid0 = _errs74 === errors;}else {var valid0 = true;}if(valid0){if(data.securitySettings !== undefined){let data40 = data.securitySettings;const _errs75 = errors;const _errs76 = errors;if(errors === _errs76){if(data40 && typeof data40 == "object" && !Array.isArray(data40)){if(data40.isCollateralEnabled !== undefined){const _errs79 = errors;if(typeof data40.isCollateralEnabled !== "boolean"){validate10.errors = [{instancePath:instancePath+"/securitySettings/isCollateralEnabled",schemaPath:"#/$defs/SecuritySettings/properties/isCollateralEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid19 = _errs79 === errors;}else {var valid19 = true;}if(valid19){if(data40.isGuarantorsEnabled !== undefined){const _errs81 = errors;if(typeof data40.isGuarantorsEnabled !== "boolean"){validate10.errors = [{instancePath:instancePath+"/securitySettings/isGuarantorsEnabled",schemaPath:"#/$defs/SecuritySettings/properties/isGuarantorsEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid19 = _errs81 === errors;}else {var valid19 = true;}if(valid19){if(data40.requiredGuaranties !== undefined){let data43 = data40.requiredGuaranties;const _errs83 = errors;if(!((typeof data43 == "number") && (isFinite(data43)))){validate10.errors = [{instancePath:instancePath+"/securitySettings/requiredGuaranties",schemaPath:"#/$defs/SecuritySettings/properties/requiredGuaranties/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid19 = _errs83 === errors;}else {var valid19 = true;}}}}else {validate10.errors = [{instancePath:instancePath+"/securitySettings",schemaPath:"#/$defs/SecuritySettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs75 === errors;}else {var valid0 = true;}if(valid0){if(data.state !== undefined){let data44 = data.state;const _errs85 = errors;if(!((data44 === "ACTIVE") || (data44 === "INACTIVE"))){validate10.errors = [{instancePath:instancePath+"/state",schemaPath:"#/properties/state/enum",keyword:"enum",params:{allowedValues: schema11.properties.state.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs85 === errors;}else {var valid0 = true;}if(valid0){if(data.taxSettings !== undefined){let data45 = data.taxSettings;const _errs86 = errors;const _errs87 = errors;if(errors === _errs87){if(data45 && typeof data45 == "object" && !Array.isArray(data45)){if(data45.taxCalculationMethod !== undefined){let data46 = data45.taxCalculationMethod;const _errs90 = errors;if(!((data46 === "INCLUSIVE") || (data46 === "EXCLUSIVE"))){validate10.errors = [{instancePath:instancePath+"/taxSettings/taxCalculationMethod",schemaPath:"#/$defs/TaxSettings/properties/taxCalculationMethod/enum",keyword:"enum",params:{allowedValues: schema66.properties.taxCalculationMethod.enum},message:"must be equal to one of the allowed values"}];return false;}var valid21 = _errs90 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnFeesEnabled !== undefined){const _errs91 = errors;if(typeof data45.taxesOnFeesEnabled !== "boolean"){validate10.errors = [{instancePath:instancePath+"/taxSettings/taxesOnFeesEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnFeesEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs91 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnInterestEnabled !== undefined){const _errs93 = errors;if(typeof data45.taxesOnInterestEnabled !== "boolean"){validate10.errors = [{instancePath:instancePath+"/taxSettings/taxesOnInterestEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnInterestEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs93 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxesOnPenaltyEnabled !== undefined){const _errs95 = errors;if(typeof data45.taxesOnPenaltyEnabled !== "boolean"){validate10.errors = [{instancePath:instancePath+"/taxSettings/taxesOnPenaltyEnabled",schemaPath:"#/$defs/TaxSettings/properties/taxesOnPenaltyEnabled/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid21 = _errs95 === errors;}else {var valid21 = true;}if(valid21){if(data45.taxSourceKey !== undefined){const _errs97 = errors;if(typeof data45.taxSourceKey !== "string"){validate10.errors = [{instancePath:instancePath+"/taxSettings/taxSourceKey",schemaPath:"#/$defs/TaxSettings/properties/taxSourceKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid21 = _errs97 === errors;}else {var valid21 = true;}}}}}}else {validate10.errors = [{instancePath:instancePath+"/taxSettings",schemaPath:"#/$defs/TaxSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs86 === errors;}else {var valid0 = true;}if(valid0){if(data.templates !== undefined){let data51 = data.templates;const _errs99 = errors;if(errors === _errs99){if(Array.isArray(data51)){var valid22 = true;const len1 = data51.length;for(let i2=0; i2 Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuLoanRiskLevelsConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/loanrisklevels.yaml + * * Get loan risk levels configuration */ public get({ @@ -54,22 +58,24 @@ export class MambuLoanRiskLevelsConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/loanrisklevels.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/loanrisklevels.yaml + * * Update loan risk levels configuration */ public update({ @@ -83,15 +89,13 @@ export class MambuLoanRiskLevelsConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/loanrisklevels.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/loanrisklevels.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -99,50 +103,52 @@ export class MambuLoanRiskLevelsConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -150,8 +156,7 @@ export class MambuLoanRiskLevelsConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -159,21 +164,21 @@ export class MambuLoanRiskLevelsConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/loan-transactions/rest.client.ts b/src/loan-transactions/rest.client.ts index f39548a..1eed304 100644 --- a/src/loan-transactions/rest.client.ts +++ b/src/loan-transactions/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { DisbursementLoanTransactionInput, @@ -23,6 +23,7 @@ import { LockLoanTransactionsWrapper, PaymentMadeTransactionInput, RedrawRepaymentTransactionInputDTO, + RefundLoanTransactionInput, RepaymentLoanTransactionInput, SearchResponse, UnlockLoanAccountInput, @@ -33,7 +34,7 @@ import { * loans/transactions */ export class MambuLoanTransactions { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -48,22 +49,26 @@ export class MambuLoanTransactions { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /loans/transactions/{loanTransactionId}:adjust + * * Adjust loan transaction */ public adjust({ @@ -87,7 +92,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -99,9 +104,8 @@ export class MambuLoanTransactions { return this.awaitResponse( this.buildClient(auth).post(`loans/transactions/${path.loanTransactionId}:adjust`, { - json: body, + json: _body.right as LoanTransactionAdjustmentDetails, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -111,10 +115,13 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/fee-transactions + * * Apply a fee on a loan account */ public applyFee({ @@ -138,7 +145,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -150,9 +157,8 @@ export class MambuLoanTransactions { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/fee-transactions`, { - json: body, + json: _body.right as FeeLoanTransactionInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -162,10 +168,13 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/lock-transactions + * * Lock loan account income sources (interest, fees, penalties) */ public applyLock({ @@ -189,7 +198,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -201,9 +210,8 @@ export class MambuLoanTransactions { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/lock-transactions`, { - json: body, + json: _body.right as LockLoanAccountInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -213,10 +221,13 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/payment-made-transactions + * * Make payment in redraw balance for loan account */ public applyPaymentMade({ @@ -240,7 +251,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -252,9 +263,8 @@ export class MambuLoanTransactions { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/payment-made-transactions`, { - json: body, + json: _body.right as PaymentMadeTransactionInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -264,10 +274,13 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/unlock-transactions + * * Unlock loan account income sources (interest, fees, penalties) */ public applyUnlock({ @@ -291,7 +304,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -303,9 +316,8 @@ export class MambuLoanTransactions { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/unlock-transactions`, { - json: body, + json: _body.right as UnlockLoanAccountInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -315,10 +327,13 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/{loanAccountId}/transactions + * * Get loan transactions */ public getAll({ @@ -338,7 +353,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -347,7 +362,6 @@ export class MambuLoanTransactions { this.buildClient(auth).get(`loans/${path.loanAccountId}/transactions`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -356,10 +370,13 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/transactions/{loanTransactionId} + * * Get loan transaction */ public getById({ @@ -375,7 +392,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -384,7 +401,6 @@ export class MambuLoanTransactions { this.buildClient(auth).get(`loans/transactions/${path.loanTransactionId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: LoanTransaction, @@ -393,10 +409,13 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /loans/{loanAccountId}/transactions:versions + * * Get loan transactions for all loan account versions */ public getTransactionsForAllVersions({ @@ -416,7 +435,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -425,7 +444,6 @@ export class MambuLoanTransactions { this.buildClient(auth).get(`loans/${path.loanAccountId}/transactions:versions`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetTransactionsForAllVersionsResponse, @@ -434,10 +452,13 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/disbursement-transactions + * * Make a disbursement on a loan */ public makeDisbursement({ @@ -461,7 +482,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -473,9 +494,8 @@ export class MambuLoanTransactions { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/disbursement-transactions`, { - json: body, + json: _body.right as DisbursementLoanTransactionInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -485,10 +505,13 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/redraw-repayment-transactions + * * Make a redraw repayment transaction on a loan */ public makeRedrawRepayment({ @@ -512,7 +535,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -524,9 +547,8 @@ export class MambuLoanTransactions { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/redraw-repayment-transactions`, { - json: body, + json: _body.right as RedrawRepaymentTransactionInputDTO, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -536,10 +558,66 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/refund-transactions + * + * Make refund transaction on loan account + */ + public makeRefund({ + body, + path, + headers, + auth = [['apiKey'], ['basic']], + }: { + body: RefundLoanTransactionInput + path: { loanAccountId: string } + headers?: { 'Idempotency-Key'?: string } + auth?: string[][] | string[] + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', LoanTransaction> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + unknown, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(RefundLoanTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } + + return this.awaitResponse( + this.buildClient(auth).post(`loans/${path.loanAccountId}/refund-transactions`, { + json: _body.right as RefundLoanTransactionInput, + headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, + }), + { + 102: { parse: (x: unknown) => ({ right: x }) }, + 201: LoanTransaction, + 400: ErrorResponse, + 401: ErrorResponse, + 403: ErrorResponse, + 404: ErrorResponse, + }, + 'json', + ) as ReturnType + } + + /** + * POST /loans/{loanAccountId}/repayment-transactions + * * Make repayment transaction on loan account */ public makeRepayment({ @@ -563,7 +641,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -575,9 +653,8 @@ export class MambuLoanTransactions { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/repayment-transactions`, { - json: body, + json: _body.right as RepaymentLoanTransactionInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -587,10 +664,13 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/{loanAccountId}/withdrawal-transactions + * * Make withdrawal from redraw balance */ public makeWithdrawal({ @@ -614,7 +694,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -626,9 +706,8 @@ export class MambuLoanTransactions { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/withdrawal-transactions`, { - json: body, + json: _body.right as WithdrawalRedrawTransactionInput, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -638,10 +717,13 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * POST /loans/transactions:search + * * Search loan transactions */ public search({ @@ -650,7 +732,7 @@ export class MambuLoanTransactions { auth = [['apiKey'], ['basic']], }: { body: LoanTransactionSearchCriteria - query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } + query?: { offset?: string; limit?: string; paginationDetails?: string; cursor?: string; detailsLevel?: string } auth?: string[][] | string[] }): Promise< | SuccessResponse<'200', SearchResponse> @@ -662,7 +744,7 @@ export class MambuLoanTransactions { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -674,10 +756,9 @@ export class MambuLoanTransactions { return this.awaitResponse( this.buildClient(auth).post('loans/transactions:search', { - json: body, + json: _body.right as LoanTransactionSearchCriteria, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: SearchResponse, @@ -686,6 +767,7 @@ export class MambuLoanTransactions { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -710,44 +792,45 @@ export class MambuLoanTransactions { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -755,8 +838,7 @@ export class MambuLoanTransactions { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -764,21 +846,21 @@ export class MambuLoanTransactions { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/loan-transactions/rest.type.ts b/src/loan-transactions/rest.type.ts index e8fd9cf..9cd4464 100644 --- a/src/loan-transactions/rest.type.ts +++ b/src/loan-transactions/rest.type.ts @@ -18,6 +18,7 @@ import { validate as LockLoanAccountInputValidator } from './schemas/lock-loan-a import { validate as LockLoanTransactionsWrapperValidator } from './schemas/lock-loan-transactions-wrapper.schema.js' import { validate as PaymentMadeTransactionInputValidator } from './schemas/payment-made-transaction-input.schema.js' import { validate as RedrawRepaymentTransactionInputDTOValidator } from './schemas/redraw-repayment-transaction-input-dto.schema.js' +import { validate as RefundLoanTransactionInputValidator } from './schemas/refund-loan-transaction-input.schema.js' import { validate as RepaymentLoanTransactionInputValidator } from './schemas/repayment-loan-transaction-input.schema.js' import { validate as SearchResponseValidator } from './schemas/search-response.schema.js' import { validate as UnlockLoanAccountInputValidator } from './schemas/unlock-loan-account-input.schema.js' @@ -333,6 +334,7 @@ export interface CustomPaymentAmount { | 'LATE_REPAYMENT_FEE' | 'PAYMENT_DUE_FEE' | 'PENALTY' + | 'INTEREST_FROM_ARREARS' /** * The encodedKey of the predefined fee to be paid. */ @@ -511,6 +513,10 @@ export interface FeeLoanTransactionInput { * The external id of the repayment transaction, customizable, unique */ externalId?: string | undefined + /** + * This flag indicates whether the fee should be capitalised or not + */ + feeCapitalisation?: boolean | undefined /** * The date of the first repayment for the loan account (as Organization Time) */ @@ -769,12 +775,15 @@ export interface LoanTransaction { | 'WITHDRAWAL_REDRAW_ADJUSTMENT' | 'FEE_APPLIED' | 'FEE_CHARGED' + | 'FEE_CAPITALISED' + | 'SCHEDULE_FIX_APPLIED' | 'FEES_DUE_REDUCED' | 'FEE_ADJUSTMENT' | 'PENALTY_APPLIED' | 'PENALTY_ADJUSTMENT' | 'PENALTIES_DUE_REDUCED' | 'REPAYMENT_ADJUSTMENT' + | 'FEE_CAPITALISED_ADJUSTMENT' | 'PAYMENT_MADE_ADJUSTMENT' | 'INTEREST_RATE_CHANGED' | 'TAX_RATE_CHANGED' @@ -809,6 +818,8 @@ export interface LoanTransaction { | 'DUE_DATE_CHANGED_ADJUSTMENT' | 'ACCOUNT_TERMINATED' | 'ACCOUNT_TERMINATED_ADJUSTMENT' + | 'REFUND' + | 'REFUND_ADJUSTMENT' | undefined /** * The user that performed the transaction. @@ -1218,6 +1229,50 @@ export const RedrawRepaymentTransactionInputDTO = { }, } as const +/** + * Represents the request payload for creating a transaction of type REFUND + */ +export interface RefundLoanTransactionInput { + /** + * The amount of the refund + */ + amount: number + /** + * The booking date of the refund (as Organization Time) + */ + bookingDate?: string | undefined + /** + * The disbursement key for which the refund is performed + */ + linkedDisbursementKey: string + /** + * Extra notes about the refund transaction. Notes can have at most 255 characters in length. + */ + notes?: string | undefined + transactionDetails?: LoanTransactionDetailsInput | undefined + /** + * The entry date of the refund (as Organization Time) + */ + valueDate?: string | undefined +} + +export const RefundLoanTransactionInput = { + validate: RefundLoanTransactionInputValidator as ValidateFunction, + get schema() { + return RefundLoanTransactionInput.validate.schema + }, + get errors() { + return RefundLoanTransactionInput.validate.errors ?? undefined + }, + is: (o: unknown): o is RefundLoanTransactionInput => RefundLoanTransactionInput.validate(o) === true, + parse: (o: unknown): { right: RefundLoanTransactionInput } | { left: DefinedError[] } => { + if (RefundLoanTransactionInput.is(o)) { + return { right: o } + } + return { left: (RefundLoanTransactionInput.errors ?? []) as DefinedError[] } + }, +} as const + /** * Represents the request payload for creating a transaction of type REPAYMENT */ diff --git a/src/loan-transactions/schemas/fee-loan-transaction-input.schema.js b/src/loan-transactions/schemas/fee-loan-transaction-input.schema.js index b80dee8..fc6c66a 100644 --- a/src/loan-transactions/schemas/fee-loan-transaction-input.schema.js +++ b/src/loan-transactions/schemas/fee-loan-transaction-input.schema.js @@ -5,4 +5,4 @@ */ "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"FeeLoanTransactionInput","type":"object","description":"Represents the request payload for creating a transaction of type FEE_APPLIED","properties":{"amount":{"type":"number","description":"The fee amount to be applied on the account"},"bookingDate":{"type":"string","description":"The date when the fee transaction is logged into accounting (as Organization Time)","format":"date-time"},"externalId":{"type":"string","description":"The external id of the repayment transaction, customizable, unique"},"firstRepaymentDate":{"type":"string","description":"The date of the first repayment for the loan account (as Organization Time)","format":"date-time"},"installmentNumber":{"type":"integer","description":"The installment number on which the fee will be applied"},"notes":{"type":"string","description":"Extra notes about the current transaction"},"predefinedFeeKey":{"type":"string","description":"The encodedKey of the predefined fee that defines the current fee"},"valueDate":{"type":"string","description":"The date when to apply the fee (as Organization Time)","format":"date-time"}},"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate10.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.bookingDate !== undefined){const _errs4 = errors;if(errors === _errs4){if(errors === _errs4){if(!(typeof data.bookingDate === "string")){validate10.errors = [{instancePath:instancePath+"/bookingDate",schemaPath:"#/properties/bookingDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.externalId !== undefined){const _errs6 = errors;if(typeof data.externalId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalId",schemaPath:"#/properties/externalId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.firstRepaymentDate !== undefined){const _errs8 = errors;if(errors === _errs8){if(errors === _errs8){if(!(typeof data.firstRepaymentDate === "string")){validate10.errors = [{instancePath:instancePath+"/firstRepaymentDate",schemaPath:"#/properties/firstRepaymentDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.installmentNumber !== undefined){let data4 = data.installmentNumber;const _errs10 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/installmentNumber",schemaPath:"#/properties/installmentNumber/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs12 = errors;if(typeof data.notes !== "string"){validate10.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.predefinedFeeKey !== undefined){const _errs14 = errors;if(typeof data.predefinedFeeKey !== "string"){validate10.errors = [{instancePath:instancePath+"/predefinedFeeKey",schemaPath:"#/properties/predefinedFeeKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.valueDate !== undefined){const _errs16 = errors;if(errors === _errs16){if(errors === _errs16){if(!(typeof data.valueDate === "string")){validate10.errors = [{instancePath:instancePath+"/valueDate",schemaPath:"#/properties/valueDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs16 === errors;}else {var valid0 = true;}}}}}}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"FeeLoanTransactionInput","type":"object","description":"Represents the request payload for creating a transaction of type FEE_APPLIED","properties":{"amount":{"type":"number","description":"The fee amount to be applied on the account"},"bookingDate":{"type":"string","description":"The date when the fee transaction is logged into accounting (as Organization Time)","format":"date-time"},"externalId":{"type":"string","description":"The external id of the repayment transaction, customizable, unique"},"feeCapitalisation":{"type":"boolean","description":"This flag indicates whether the fee should be capitalised or not"},"firstRepaymentDate":{"type":"string","description":"The date of the first repayment for the loan account (as Organization Time)","format":"date-time"},"installmentNumber":{"type":"integer","description":"The installment number on which the fee will be applied"},"notes":{"type":"string","description":"Extra notes about the current transaction"},"predefinedFeeKey":{"type":"string","description":"The encodedKey of the predefined fee that defines the current fee"},"valueDate":{"type":"string","description":"The date when to apply the fee (as Organization Time)","format":"date-time"}},"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.amount !== undefined){let data0 = data.amount;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate10.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.bookingDate !== undefined){const _errs4 = errors;if(errors === _errs4){if(errors === _errs4){if(!(typeof data.bookingDate === "string")){validate10.errors = [{instancePath:instancePath+"/bookingDate",schemaPath:"#/properties/bookingDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.externalId !== undefined){const _errs6 = errors;if(typeof data.externalId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalId",schemaPath:"#/properties/externalId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.feeCapitalisation !== undefined){const _errs8 = errors;if(typeof data.feeCapitalisation !== "boolean"){validate10.errors = [{instancePath:instancePath+"/feeCapitalisation",schemaPath:"#/properties/feeCapitalisation/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.firstRepaymentDate !== undefined){const _errs10 = errors;if(errors === _errs10){if(errors === _errs10){if(!(typeof data.firstRepaymentDate === "string")){validate10.errors = [{instancePath:instancePath+"/firstRepaymentDate",schemaPath:"#/properties/firstRepaymentDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.installmentNumber !== undefined){let data5 = data.installmentNumber;const _errs12 = errors;if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){validate10.errors = [{instancePath:instancePath+"/installmentNumber",schemaPath:"#/properties/installmentNumber/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs14 = errors;if(typeof data.notes !== "string"){validate10.errors = [{instancePath:instancePath+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.predefinedFeeKey !== undefined){const _errs16 = errors;if(typeof data.predefinedFeeKey !== "string"){validate10.errors = [{instancePath:instancePath+"/predefinedFeeKey",schemaPath:"#/properties/predefinedFeeKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.valueDate !== undefined){const _errs18 = errors;if(errors === _errs18){if(errors === _errs18){if(!(typeof data.valueDate === "string")){validate10.errors = [{instancePath:instancePath+"/valueDate",schemaPath:"#/properties/valueDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs18 === errors;}else {var valid0 = true;}}}}}}}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file diff --git a/src/loan-transactions/schemas/get-all-response.schema.js b/src/loan-transactions/schemas/get-all-response.schema.js index c8e662a..af6ab13 100644 --- a/src/loan-transactions/schemas/get-all-response.schema.js +++ b/src/loan-transactions/schemas/get-all-response.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"GetAllResponse","type":"array","items":{"$ref":"#/$defs/LoanTransaction"},"$defs":{"LoanTransaction":{"type":"object","description":"Represents the action performed on a loan account after which the account's amount changes its value.","properties":{"accountBalances":{"$ref":"#/$defs/TransactionBalances"},"adjustmentTransactionKey":{"type":"string","description":"The key of the loan transaction where the adjustment for the transaction was made (if any adjustment was involved)."},"affectedAmounts":{"$ref":"#/$defs/LoanAffectedAmounts"},"amount":{"type":"number","description":"The amount that was added or removed on the loan account."},"bookingDate":{"type":"string","description":"The date when the corresponding journal entry is booked.","format":"date-time"},"branchKey":{"type":"string","description":"The branch where the transaction was performed."},"cardTransaction":{"$ref":"#/$defs/CardTransaction"},"centreKey":{"type":"string","description":"The center where the transaction was performed."},"creationDate":{"type":"string","description":"The date when this loan transaction was created.","format":"date-time"},"currency":{"$ref":"#/$defs/Currency"},"customPaymentAmounts":{"type":"array","description":"The list of custom amounts which the user has paid as part of this transaction.","items":{"$ref":"#/$defs/CustomPaymentAmount"}},"encodedKey":{"type":"string","description":"The encoded key of the loan transaction, which is auto generated, and must be unique."},"externalId":{"type":"string","description":"The external ID of the loan transaction, it is customizable, and must be unique."},"fees":{"type":"array","description":"The amounts that have been applied or paid as part of this transaction and involved predefined fees.","items":{"$ref":"#/$defs/Fee"}},"id":{"type":"string","description":"The ID of the loan transaction, can be generated and customized, and must be unique."},"installmentEncodedKey":{"type":"string","description":"The specific installment encoded key associated to the loan transaction."},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with the loan account. If the account was imported, track which 'migration event' it came from."},"notes":{"type":"string","description":"The notes or description for the loan transaction."},"originalAmount":{"type":"number","description":"The amount that was posted in a foreign currency. This amount was converted using the exchange rate available at entry date and set into the amount field."},"originalCurrencyCode":{"type":"string","description":"The currency in which this transaction was posted. The amounts are stored in the base currency, but the user may enter it in a foreign currency."},"originalTransactionKey":{"type":"string","description":"The encoded key of the transaction that was adjusted as part of this one. Available only for adjustment transactions."},"parentAccountKey":{"type":"string","description":"The key of the parent loan account."},"parentLoanTransactionKey":{"type":"string","description":"The key of the parent loan transaction."},"prepaymentRecalculationMethod":{"description":"The prepayment recalculation method of the loan transaction.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"taxes":{"$ref":"#/$defs/Taxes"},"terms":{"$ref":"#/$defs/LoanTerms"},"tillKey":{"type":"string","description":"The till key associated with the transaction."},"transactionDetails":{"$ref":"#/$defs/TransactionDetails"},"transferDetails":{"$ref":"#/$defs/TransferDetails"},"type":{"description":"The type of loan transaction.","enum":["IMPORT","DISBURSEMENT","DISBURSEMENT_ADJUSTMENT","WRITE_OFF","WRITE_OFF_ADJUSTMENT","REPAYMENT","PAYMENT_MADE","WITHDRAWAL_REDRAW","WITHDRAWAL_REDRAW_ADJUSTMENT","FEE_APPLIED","FEE_CHARGED","FEES_DUE_REDUCED","FEE_ADJUSTMENT","PENALTY_APPLIED","PENALTY_ADJUSTMENT","PENALTIES_DUE_REDUCED","REPAYMENT_ADJUSTMENT","PAYMENT_MADE_ADJUSTMENT","INTEREST_RATE_CHANGED","TAX_RATE_CHANGED","PENALTY_RATE_CHANGED","INTEREST_APPLIED","INTEREST_APPLIED_ADJUSTMENT","INTEREST_DUE_REDUCED","PENALTY_REDUCTION_ADJUSTMENT","FEE_REDUCTION_ADJUSTMENT","INTEREST_REDUCTION_ADJUSTMENT","DEFERRED_INTEREST_APPLIED","DEFERRED_INTEREST_APPLIED_ADJUSTMENT","DEFERRED_INTEREST_PAID","DEFERRED_INTEREST_PAID_ADJUSTMENT","INTEREST_LOCKED","FEE_LOCKED","PENALTY_LOCKED","INTEREST_UNLOCKED","FEE_UNLOCKED","PENALTY_UNLOCKED","REDRAW_TRANSFER","REDRAW_REPAYMENT","REDRAW_TRANSFER_ADJUSTMENT","REDRAW_REPAYMENT_ADJUSTMENT","TRANSFER","TRANSFER_ADJUSTMENT","BRANCH_CHANGED","TERMS_CHANGED","CARD_TRANSACTION_REVERSAL","CARD_TRANSACTION_REVERSAL_ADJUSTMENT","DUE_DATE_CHANGED","DUE_DATE_CHANGED_ADJUSTMENT","ACCOUNT_TERMINATED","ACCOUNT_TERMINATED_ADJUSTMENT"]},"userKey":{"type":"string","description":"The user that performed the transaction."},"valueDate":{"type":"string","description":"The date of the entry in the organization time format and timezone.","format":"date-time"}},"additionalProperties":true},"TransactionBalances":{"type":"object","description":"The balances changed within a transaction.","properties":{"advancePosition":{"type":"number","description":"Captures the advance (prepaid) amount."},"arrearsPosition":{"type":"number","description":"Captures the arrears position amount for the account in arrears."},"expectedPrincipalRedraw":{"type":"number","description":"The difference between principal balance and redraw balance after each transaction performed on the loan account."},"principalBalance":{"type":"number","description":"The account redraw balance captured after the transaction update."},"redrawBalance":{"type":"number","description":"The account redraw balance captured after the transaction update."},"totalBalance":{"type":"number","description":"The running balance still owed for the loan."}},"additionalProperties":true},"LoanAffectedAmounts":{"type":"object","description":"The amounts affected after completing the loan transaction","properties":{"deferredInterestAmount":{"type":"number","description":"How much interest pre-paid was added/removed in account, within this transaction (including taxes)."},"feesAmount":{"type":"number","description":" How much fees was added/removed in account, within this transaction."},"fundersInterestAmount":{"type":"number","description":"How much interest is given to the investors, within this transaction (only for p2p products)"},"interestAmount":{"type":"number","description":"How much interest was added/removed in account, within this transaction (including taxes). If there is any deferred interest amount set in this transaction, that amount should be included in this field."},"interestFromArrearsAmount":{"type":"number","description":"How much interest from arrears was added/removed in account, within this transaction (including taxes)."},"organizationCommissionAmount":{"type":"number","description":"How much interest is given to the organization, within this transaction (only for p2p products)"},"paymentHolidaysInterestAmount":{"type":"number","description":"How much Payment Holidays interest was added/removed in account, within this transaction (including taxes)."},"penaltyAmount":{"type":"number","description":"How much penalties was added/removed in account, within this transaction."},"principalAmount":{"type":"number","description":"How much principal was added/removed in account, within this transaction."}},"additionalProperties":true},"CardTransaction":{"type":"object","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true},"CardAcceptor":{"type":"object","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","description":"The city in which the card acceptor has the business."},"country":{"type":"string","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","description":"The name of the card acceptor."},"state":{"type":"string","description":"The state in which the card acceptor has the business."},"street":{"type":"string","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true},"Currency":{"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true},"CustomPaymentAmount":{"type":"object","description":"Custom payment amount for a specific element type","properties":{"amount":{"type":"number","description":"The amount of the payment paid in the transaction for the given type."},"customPaymentAmountType":{"description":"The type of the custom payment","enum":["PRINCIPAL","INTEREST","MANUAL_FEE","UPFRONT_DISBURSEMENT_FEE","LATE_REPAYMENT_FEE","PAYMENT_DUE_FEE","PENALTY"]},"predefinedFeeKey":{"type":"string","description":"The encodedKey of the predefined fee to be paid."},"taxOnAmount":{"type":"number","description":"The amount of the taxes paid in the transaction for the given type."}},"required":["amount","customPaymentAmountType"],"additionalProperties":true},"Fee":{"type":"object","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MANUAL_PLANNED","DISBURSEMENT","CAPITALIZED_DISBURSEMENT","UPFRONT_DISBURSEMENT","LATE_REPAYMENT","PAYMENT_DUE","PAYMENT_DUE_APPLIED_ON_DUE_DATES","ARBITRARY","IOF","EARLY_REPAYMENT_CHARGE"]}},"required":["predefinedFeeKey"],"additionalProperties":true},"Taxes":{"type":"object","description":"The taxes applied within a transaction.","properties":{"deferredTaxOnInterestAmount":{"type":"number","description":"How much taxes on the interest that was pre-paid were added/removed in account, within this transaction. If there is any deferred tax on interest amount set in this transaction, that amount should be included in this field."},"taxOnFeesAmount":{"type":"number","description":"How much taxes on the fees that were paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestAmount":{"type":"number","description":"How much taxes on the interest that was paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestFromArrearsAmount":{"type":"number","description":"The amount of taxes on the interest from arrears that were applied/paid in account, within this transaction."},"taxOnPaymentHolidaysInterest":{"type":"number","description":"The amount of taxes on the Payment Holidays interest that were added/removed in account, within this transaction."},"taxOnPenaltyAmount":{"type":"number","description":"How much taxes on the penalties that were paid in this transaction were added/removed in account, within this transaction."},"taxRate":{"type":"number","description":"The tax rate that was set or changed in this transaction."}},"additionalProperties":true},"LoanTerms":{"type":"object","description":"The loan transaction terms","properties":{"interestSettings":{"$ref":"#/$defs/TransactionInterestSettings"},"periodicPayment":{"type":"number","description":"The periodic payment value logged when changing it for a Balloon Payments account"},"principalPaymentAmount":{"type":"number","description":"The principal payment flat amount logged when changing it for a Revolving Credit account"},"principalPaymentPercentage":{"type":"number","description":"The principal payment percentage value logged when changing it for a Revolving Credit account"}},"additionalProperties":true},"TransactionInterestSettings":{"type":"object","description":"The interest settings, holds all the properties regarding interests for the loan account.","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate"},"interestRate":{"type":"number","description":"The interest rate. Represents the interest rate for the loan account. The interest on loans is accrued on a daily basis, which allows charging the clients only for the days they actually used the loan amount."}},"additionalProperties":true},"TransactionDetails":{"type":"object","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true},"TransferDetails":{"type":"object","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","description":"The key of the related loan transaction"}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents the action performed on a loan account after which the account's amount changes its value.","properties":{"accountBalances":{"$ref":"#/$defs/TransactionBalances"},"adjustmentTransactionKey":{"type":"string","description":"The key of the loan transaction where the adjustment for the transaction was made (if any adjustment was involved)."},"affectedAmounts":{"$ref":"#/$defs/LoanAffectedAmounts"},"amount":{"type":"number","description":"The amount that was added or removed on the loan account."},"bookingDate":{"type":"string","description":"The date when the corresponding journal entry is booked.","format":"date-time"},"branchKey":{"type":"string","description":"The branch where the transaction was performed."},"cardTransaction":{"$ref":"#/$defs/CardTransaction"},"centreKey":{"type":"string","description":"The center where the transaction was performed."},"creationDate":{"type":"string","description":"The date when this loan transaction was created.","format":"date-time"},"currency":{"$ref":"#/$defs/Currency"},"customPaymentAmounts":{"type":"array","description":"The list of custom amounts which the user has paid as part of this transaction.","items":{"$ref":"#/$defs/CustomPaymentAmount"}},"encodedKey":{"type":"string","description":"The encoded key of the loan transaction, which is auto generated, and must be unique."},"externalId":{"type":"string","description":"The external ID of the loan transaction, it is customizable, and must be unique."},"fees":{"type":"array","description":"The amounts that have been applied or paid as part of this transaction and involved predefined fees.","items":{"$ref":"#/$defs/Fee"}},"id":{"type":"string","description":"The ID of the loan transaction, can be generated and customized, and must be unique."},"installmentEncodedKey":{"type":"string","description":"The specific installment encoded key associated to the loan transaction."},"migrationEventKey":{"type":"string","description":"The migration event encoded key associated with the loan account. If the account was imported, track which 'migration event' it came from."},"notes":{"type":"string","description":"The notes or description for the loan transaction."},"originalAmount":{"type":"number","description":"The amount that was posted in a foreign currency. This amount was converted using the exchange rate available at entry date and set into the amount field."},"originalCurrencyCode":{"type":"string","description":"The currency in which this transaction was posted. The amounts are stored in the base currency, but the user may enter it in a foreign currency."},"originalTransactionKey":{"type":"string","description":"The encoded key of the transaction that was adjusted as part of this one. Available only for adjustment transactions."},"parentAccountKey":{"type":"string","description":"The key of the parent loan account."},"parentLoanTransactionKey":{"type":"string","description":"The key of the parent loan transaction."},"prepaymentRecalculationMethod":{"description":"The prepayment recalculation method of the loan transaction.","enum":["NO_RECALCULATION","RESCHEDULE_REMAINING_REPAYMENTS","RECALCULATE_SCHEDULE_KEEP_SAME_NUMBER_OF_TERMS","RECALCULATE_SCHEDULE_KEEP_SAME_PRINCIPAL_AMOUNT","RECALCULATE_SCHEDULE_KEEP_SAME_TOTAL_REPAYMENT_AMOUNT","REDUCE_AMOUNT_PER_INSTALLMENT","REDUCE_NUMBER_OF_INSTALLMENTS","REDUCE_NUMBER_OF_INSTALLMENTS_NEW"]},"taxes":{"$ref":"#/$defs/Taxes"},"terms":{"$ref":"#/$defs/LoanTerms"},"tillKey":{"type":"string","description":"The till key associated with the transaction."},"transactionDetails":{"$ref":"#/$defs/TransactionDetails"},"transferDetails":{"$ref":"#/$defs/TransferDetails"},"type":{"description":"The type of loan transaction.","enum":["IMPORT","DISBURSEMENT","DISBURSEMENT_ADJUSTMENT","WRITE_OFF","WRITE_OFF_ADJUSTMENT","REPAYMENT","PAYMENT_MADE","WITHDRAWAL_REDRAW","WITHDRAWAL_REDRAW_ADJUSTMENT","FEE_APPLIED","FEE_CHARGED","FEES_DUE_REDUCED","FEE_ADJUSTMENT","PENALTY_APPLIED","PENALTY_ADJUSTMENT","PENALTIES_DUE_REDUCED","REPAYMENT_ADJUSTMENT","PAYMENT_MADE_ADJUSTMENT","INTEREST_RATE_CHANGED","TAX_RATE_CHANGED","PENALTY_RATE_CHANGED","INTEREST_APPLIED","INTEREST_APPLIED_ADJUSTMENT","INTEREST_DUE_REDUCED","PENALTY_REDUCTION_ADJUSTMENT","FEE_REDUCTION_ADJUSTMENT","INTEREST_REDUCTION_ADJUSTMENT","DEFERRED_INTEREST_APPLIED","DEFERRED_INTEREST_APPLIED_ADJUSTMENT","DEFERRED_INTEREST_PAID","DEFERRED_INTEREST_PAID_ADJUSTMENT","INTEREST_LOCKED","FEE_LOCKED","PENALTY_LOCKED","INTEREST_UNLOCKED","FEE_UNLOCKED","PENALTY_UNLOCKED","REDRAW_TRANSFER","REDRAW_REPAYMENT","REDRAW_TRANSFER_ADJUSTMENT","REDRAW_REPAYMENT_ADJUSTMENT","TRANSFER","TRANSFER_ADJUSTMENT","BRANCH_CHANGED","TERMS_CHANGED","CARD_TRANSACTION_REVERSAL","CARD_TRANSACTION_REVERSAL_ADJUSTMENT","DUE_DATE_CHANGED","DUE_DATE_CHANGED_ADJUSTMENT","ACCOUNT_TERMINATED","ACCOUNT_TERMINATED_ADJUSTMENT"]},"userKey":{"type":"string","description":"The user that performed the transaction."},"valueDate":{"type":"string","description":"The date of the entry in the organization time format and timezone.","format":"date-time"}},"additionalProperties":true};const schema13 = {"type":"object","description":"The balances changed within a transaction.","properties":{"advancePosition":{"type":"number","description":"Captures the advance (prepaid) amount."},"arrearsPosition":{"type":"number","description":"Captures the arrears position amount for the account in arrears."},"expectedPrincipalRedraw":{"type":"number","description":"The difference between principal balance and redraw balance after each transaction performed on the loan account."},"principalBalance":{"type":"number","description":"The account redraw balance captured after the transaction update."},"redrawBalance":{"type":"number","description":"The account redraw balance captured after the transaction update."},"totalBalance":{"type":"number","description":"The running balance still owed for the loan."}},"additionalProperties":true};const schema14 = {"type":"object","description":"The amounts affected after completing the loan transaction","properties":{"deferredInterestAmount":{"type":"number","description":"How much interest pre-paid was added/removed in account, within this transaction (including taxes)."},"feesAmount":{"type":"number","description":" How much fees was added/removed in account, within this transaction."},"fundersInterestAmount":{"type":"number","description":"How much interest is given to the investors, within this transaction (only for p2p products)"},"interestAmount":{"type":"number","description":"How much interest was added/removed in account, within this transaction (including taxes). If there is any deferred interest amount set in this transaction, that amount should be included in this field."},"interestFromArrearsAmount":{"type":"number","description":"How much interest from arrears was added/removed in account, within this transaction (including taxes)."},"organizationCommissionAmount":{"type":"number","description":"How much interest is given to the organization, within this transaction (only for p2p products)"},"paymentHolidaysInterestAmount":{"type":"number","description":"How much Payment Holidays interest was added/removed in account, within this transaction (including taxes)."},"penaltyAmount":{"type":"number","description":"How much penalties was added/removed in account, within this transaction."},"principalAmount":{"type":"number","description":"How much principal was added/removed in account, within this transaction."}},"additionalProperties":true};const schema17 = {"type":"object","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"description":"Fiat(ISO-4217) currency code or NON_FIAT for non fiat currencies.","enum":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VEF","VES","VND","VUV","WST","XAG","XAU","XAF","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZIG","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema18 = {"type":"object","description":"Custom payment amount for a specific element type","properties":{"amount":{"type":"number","description":"The amount of the payment paid in the transaction for the given type."},"customPaymentAmountType":{"description":"The type of the custom payment","enum":["PRINCIPAL","INTEREST","MANUAL_FEE","UPFRONT_DISBURSEMENT_FEE","LATE_REPAYMENT_FEE","PAYMENT_DUE_FEE","PENALTY"]},"predefinedFeeKey":{"type":"string","description":"The encodedKey of the predefined fee to be paid."},"taxOnAmount":{"type":"number","description":"The amount of the taxes paid in the transaction for the given type."}},"required":["amount","customPaymentAmountType"],"additionalProperties":true};const schema19 = {"type":"object","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"description":"Shows the event that will trigger a fee","enum":["MANUAL","MANUAL_PLANNED","DISBURSEMENT","CAPITALIZED_DISBURSEMENT","UPFRONT_DISBURSEMENT","LATE_REPAYMENT","PAYMENT_DUE","PAYMENT_DUE_APPLIED_ON_DUE_DATES","ARBITRARY","IOF","EARLY_REPAYMENT_CHARGE"]}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema20 = {"type":"object","description":"The taxes applied within a transaction.","properties":{"deferredTaxOnInterestAmount":{"type":"number","description":"How much taxes on the interest that was pre-paid were added/removed in account, within this transaction. If there is any deferred tax on interest amount set in this transaction, that amount should be included in this field."},"taxOnFeesAmount":{"type":"number","description":"How much taxes on the fees that were paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestAmount":{"type":"number","description":"How much taxes on the interest that was paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestFromArrearsAmount":{"type":"number","description":"The amount of taxes on the interest from arrears that were applied/paid in account, within this transaction."},"taxOnPaymentHolidaysInterest":{"type":"number","description":"The amount of taxes on the Payment Holidays interest that were added/removed in account, within this transaction."},"taxOnPenaltyAmount":{"type":"number","description":"How much taxes on the penalties that were paid in this transaction were added/removed in account, within this transaction."},"taxRate":{"type":"number","description":"The tax rate that was set or changed in this transaction."}},"additionalProperties":true};const schema23 = {"type":"object","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};const schema24 = {"type":"object","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","description":"The key of the related loan transaction"}},"additionalProperties":true};const schema15 = {"type":"object","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"currencyCode":{"type":"string","description":"The ISO currency code in which the card reversal transaction is posted. The amounts are stored in the base currency, but the transaction can be created with a foreign currency."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true};const schema16 = {"type":"object","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","description":"The city in which the card acceptor has the business."},"country":{"type":"string","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","description":"The name of the card acceptor."},"state":{"type":"string","description":"The state in which the card acceptor has the business."},"street":{"type":"string","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((((data.advice === undefined) && (missing0 = "advice")) || ((data.amount === undefined) && (missing0 = "amount"))) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.advice !== undefined){const _errs2 = errors;if(typeof data.advice !== "boolean"){validate12.errors = [{instancePath:instancePath+"/advice",schemaPath:"#/properties/advice/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data1 = data.amount;const _errs4 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.cardAcceptor !== undefined){let data2 = data.cardAcceptor;const _errs6 = errors;const _errs7 = errors;if(errors === _errs7){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.city !== undefined){const _errs10 = errors;if(typeof data2.city !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptor/properties/city/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data2.country !== undefined){const _errs12 = errors;if(typeof data2.country !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptor/properties/country/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data2.mcc !== undefined){let data5 = data2.mcc;const _errs14 = errors;if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptor/properties/mcc/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data2.name !== undefined){const _errs16 = errors;if(typeof data2.name !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptor/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}if(valid2){if(data2.state !== undefined){const _errs18 = errors;if(typeof data2.state !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptor/properties/state/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs18 === errors;}else {var valid2 = true;}if(valid2){if(data2.street !== undefined){const _errs20 = errors;if(typeof data2.street !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptor/properties/street/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}if(valid2){if(data2.zip !== undefined){const _errs22 = errors;if(typeof data2.zip !== "string"){validate12.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptor/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs22 === errors;}else {var valid2 = true;}}}}}}}}else {validate12.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptor/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.cardToken !== undefined){const _errs24 = errors;if(typeof data.cardToken !== "string"){validate12.errors = [{instancePath:instancePath+"/cardToken",schemaPath:"#/properties/cardToken/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs26 = errors;if(typeof data.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/currencyCode",schemaPath:"#/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs28 = errors;if(typeof data.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/encodedKey",schemaPath:"#/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs28 === errors;}else {var valid0 = true;}if(valid0){if(data.externalAuthorizationReferenceId !== undefined){const _errs30 = errors;if(typeof data.externalAuthorizationReferenceId !== "string"){validate12.errors = [{instancePath:instancePath+"/externalAuthorizationReferenceId",schemaPath:"#/properties/externalAuthorizationReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs30 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs32 = errors;if(typeof data.externalReferenceId !== "string"){validate12.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs32 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs34 = errors;if(typeof data.userTransactionTime !== "string"){validate12.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs34 === errors;}else {var valid0 = true;}}}}}}}}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}const schema21 = {"type":"object","description":"The loan transaction terms","properties":{"interestSettings":{"$ref":"#/$defs/TransactionInterestSettings"},"periodicPayment":{"type":"number","description":"The periodic payment value logged when changing it for a Balloon Payments account"},"principalPaymentAmount":{"type":"number","description":"The principal payment flat amount logged when changing it for a Revolving Credit account"},"principalPaymentPercentage":{"type":"number","description":"The principal payment percentage value logged when changing it for a Revolving Credit account"}},"additionalProperties":true};const schema22 = {"type":"object","description":"The interest settings, holds all the properties regarding interests for the loan account.","properties":{"indexInterestRate":{"type":"number","description":"The value of the index interest rate"},"interestRate":{"type":"number","description":"The interest rate. Represents the interest rate for the loan account. The interest on loans is accrued on a daily basis, which allows charging the clients only for the days they actually used the loan amount."}},"additionalProperties":true};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.interestSettings !== undefined){let data0 = data.interestSettings;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.indexInterestRate !== undefined){let data1 = data0.indexInterestRate;const _errs6 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate14.errors = [{instancePath:instancePath+"/interestSettings/indexInterestRate",schemaPath:"#/$defs/TransactionInterestSettings/properties/indexInterestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.interestRate !== undefined){let data2 = data0.interestRate;const _errs8 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate14.errors = [{instancePath:instancePath+"/interestSettings/interestRate",schemaPath:"#/$defs/TransactionInterestSettings/properties/interestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}}}else {validate14.errors = [{instancePath:instancePath+"/interestSettings",schemaPath:"#/$defs/TransactionInterestSettings/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.periodicPayment !== undefined){let data3 = data.periodicPayment;const _errs10 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate14.errors = [{instancePath:instancePath+"/periodicPayment",schemaPath:"#/properties/periodicPayment/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.principalPaymentAmount !== undefined){let data4 = data.principalPaymentAmount;const _errs12 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate14.errors = [{instancePath:instancePath+"/principalPaymentAmount",schemaPath:"#/properties/principalPaymentAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.principalPaymentPercentage !== undefined){let data5 = data.principalPaymentPercentage;const _errs14 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate14.errors = [{instancePath:instancePath+"/principalPaymentPercentage",schemaPath:"#/properties/principalPaymentPercentage/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}}}}}else {validate14.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate14.errors = vErrors;return errors === 0;}const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){if(data.accountBalances !== undefined){let data0 = data.accountBalances;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.advancePosition !== undefined){let data1 = data0.advancePosition;const _errs6 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/advancePosition",schemaPath:"#/$defs/TransactionBalances/properties/advancePosition/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.arrearsPosition !== undefined){let data2 = data0.arrearsPosition;const _errs8 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/arrearsPosition",schemaPath:"#/$defs/TransactionBalances/properties/arrearsPosition/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.expectedPrincipalRedraw !== undefined){let data3 = data0.expectedPrincipalRedraw;const _errs10 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/expectedPrincipalRedraw",schemaPath:"#/$defs/TransactionBalances/properties/expectedPrincipalRedraw/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data0.principalBalance !== undefined){let data4 = data0.principalBalance;const _errs12 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/principalBalance",schemaPath:"#/$defs/TransactionBalances/properties/principalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data0.redrawBalance !== undefined){let data5 = data0.redrawBalance;const _errs14 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/redrawBalance",schemaPath:"#/$defs/TransactionBalances/properties/redrawBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data0.totalBalance !== undefined){let data6 = data0.totalBalance;const _errs16 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate11.errors = [{instancePath:instancePath+"/accountBalances/totalBalance",schemaPath:"#/$defs/TransactionBalances/properties/totalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}}}}}}}else {validate11.errors = [{instancePath:instancePath+"/accountBalances",schemaPath:"#/$defs/TransactionBalances/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.adjustmentTransactionKey !== undefined){const _errs18 = errors;if(typeof data.adjustmentTransactionKey !== "string"){validate11.errors = [{instancePath:instancePath+"/adjustmentTransactionKey",schemaPath:"#/properties/adjustmentTransactionKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.affectedAmounts !== undefined){let data8 = data.affectedAmounts;const _errs20 = errors;const _errs21 = errors;if(errors === _errs21){if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.deferredInterestAmount !== undefined){let data9 = data8.deferredInterestAmount;const _errs24 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/deferredInterestAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/deferredInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs24 === errors;}else {var valid4 = true;}if(valid4){if(data8.feesAmount !== undefined){let data10 = data8.feesAmount;const _errs26 = errors;if(!((typeof data10 == "number") && (isFinite(data10)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/feesAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/feesAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs26 === errors;}else {var valid4 = true;}if(valid4){if(data8.fundersInterestAmount !== undefined){let data11 = data8.fundersInterestAmount;const _errs28 = errors;if(!((typeof data11 == "number") && (isFinite(data11)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/fundersInterestAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/fundersInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs28 === errors;}else {var valid4 = true;}if(valid4){if(data8.interestAmount !== undefined){let data12 = data8.interestAmount;const _errs30 = errors;if(!((typeof data12 == "number") && (isFinite(data12)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/interestAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/interestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs30 === errors;}else {var valid4 = true;}if(valid4){if(data8.interestFromArrearsAmount !== undefined){let data13 = data8.interestFromArrearsAmount;const _errs32 = errors;if(!((typeof data13 == "number") && (isFinite(data13)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/interestFromArrearsAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/interestFromArrearsAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs32 === errors;}else {var valid4 = true;}if(valid4){if(data8.organizationCommissionAmount !== undefined){let data14 = data8.organizationCommissionAmount;const _errs34 = errors;if(!((typeof data14 == "number") && (isFinite(data14)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/organizationCommissionAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/organizationCommissionAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs34 === errors;}else {var valid4 = true;}if(valid4){if(data8.paymentHolidaysInterestAmount !== undefined){let data15 = data8.paymentHolidaysInterestAmount;const _errs36 = errors;if(!((typeof data15 == "number") && (isFinite(data15)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/paymentHolidaysInterestAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/paymentHolidaysInterestAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs36 === errors;}else {var valid4 = true;}if(valid4){if(data8.penaltyAmount !== undefined){let data16 = data8.penaltyAmount;const _errs38 = errors;if(!((typeof data16 == "number") && (isFinite(data16)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/penaltyAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/penaltyAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs38 === errors;}else {var valid4 = true;}if(valid4){if(data8.principalAmount !== undefined){let data17 = data8.principalAmount;const _errs40 = errors;if(!((typeof data17 == "number") && (isFinite(data17)))){validate11.errors = [{instancePath:instancePath+"/affectedAmounts/principalAmount",schemaPath:"#/$defs/LoanAffectedAmounts/properties/principalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs40 === errors;}else {var valid4 = true;}}}}}}}}}}else {validate11.errors = [{instancePath:instancePath+"/affectedAmounts",schemaPath:"#/$defs/LoanAffectedAmounts/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data18 = data.amount;const _errs42 = errors;if(!((typeof data18 == "number") && (isFinite(data18)))){validate11.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs42 === errors;}else {var valid0 = true;}if(valid0){if(data.bookingDate !== undefined){const _errs44 = errors;if(errors === _errs44){if(errors === _errs44){if(!(typeof data.bookingDate === "string")){validate11.errors = [{instancePath:instancePath+"/bookingDate",schemaPath:"#/properties/bookingDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs44 === errors;}else {var valid0 = true;}if(valid0){if(data.branchKey !== undefined){const _errs46 = errors;if(typeof data.branchKey !== "string"){validate11.errors = [{instancePath:instancePath+"/branchKey",schemaPath:"#/properties/branchKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs46 === errors;}else {var valid0 = true;}if(valid0){if(data.cardTransaction !== undefined){const _errs48 = errors;if(!(validate12(data.cardTransaction, {instancePath:instancePath+"/cardTransaction",parentData:data,parentDataProperty:"cardTransaction",rootData}))){vErrors = vErrors === null ? validate12.errors : vErrors.concat(validate12.errors);errors = vErrors.length;}var valid0 = _errs48 === errors;}else {var valid0 = true;}if(valid0){if(data.centreKey !== undefined){const _errs49 = errors;if(typeof data.centreKey !== "string"){validate11.errors = [{instancePath:instancePath+"/centreKey",schemaPath:"#/properties/centreKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs49 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs51 = errors;if(errors === _errs51){if(errors === _errs51){if(!(typeof data.creationDate === "string")){validate11.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs51 === errors;}else {var valid0 = true;}if(valid0){if(data.currency !== undefined){let data24 = data.currency;const _errs53 = errors;const _errs54 = errors;if(errors === _errs54){if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(data24.code !== undefined){const _errs57 = errors;let valid7;valid7 = false;for(const v0 of schema17.properties.code.enum){if(func0(data24.code, v0)){valid7 = true;break;}}if(!valid7){validate11.errors = [{instancePath:instancePath+"/currency/code",schemaPath:"#/$defs/Currency/properties/code/enum",keyword:"enum",params:{allowedValues: schema17.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid6 = _errs57 === errors;}else {var valid6 = true;}if(valid6){if(data24.currencyCode !== undefined){const _errs58 = errors;if(typeof data24.currencyCode !== "string"){validate11.errors = [{instancePath:instancePath+"/currency/currencyCode",schemaPath:"#/$defs/Currency/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs58 === errors;}else {var valid6 = true;}}}else {validate11.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/$defs/Currency/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs53 === errors;}else {var valid0 = true;}if(valid0){if(data.customPaymentAmounts !== undefined){let data27 = data.customPaymentAmounts;const _errs60 = errors;if(errors === _errs60){if(Array.isArray(data27)){var valid8 = true;const len0 = data27.length;for(let i0=0; i0 Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuObjectLabelsConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/labels.yaml + * * Get object labels configuration */ public get({ @@ -54,22 +58,24 @@ export class MambuObjectLabelsConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/labels.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/labels.yaml + * * Update object labels configuration */ public update({ @@ -83,15 +89,13 @@ export class MambuObjectLabelsConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/labels.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/labels.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -99,50 +103,52 @@ export class MambuObjectLabelsConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -150,8 +156,7 @@ export class MambuObjectLabelsConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -159,21 +164,21 @@ export class MambuObjectLabelsConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/organization-configuration/rest.client.ts b/src/organization-configuration/rest.client.ts index b7c703c..87d34cf 100644 --- a/src/organization-configuration/rest.client.ts +++ b/src/organization-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/organization */ export class MambuOrganizationConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuOrganizationConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/organization.yaml + * * Get organization details configuration */ public get({ @@ -58,7 +62,7 @@ export class MambuOrganizationConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -66,7 +70,6 @@ export class MambuOrganizationConfiguration { return this.awaitResponse( this.buildClient(auth).get('configuration/organization.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -75,10 +78,13 @@ export class MambuOrganizationConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * GET /configuration/organization/template.yaml + * * Get organization details configuration template */ public getTemplate({ @@ -92,7 +98,7 @@ export class MambuOrganizationConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -100,7 +106,6 @@ export class MambuOrganizationConfiguration { return this.awaitResponse( this.buildClient(auth).get('configuration/organization/template.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -109,10 +114,13 @@ export class MambuOrganizationConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/organization.yaml + * * Update organization details configuration */ public update({ @@ -126,7 +134,7 @@ export class MambuOrganizationConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -134,7 +142,6 @@ export class MambuOrganizationConfiguration { return this.awaitResponse( this.buildClient(auth).put('configuration/organization.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -143,50 +150,52 @@ export class MambuOrganizationConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -194,8 +203,7 @@ export class MambuOrganizationConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -203,21 +211,21 @@ export class MambuOrganizationConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/organization-details/rest.client.ts b/src/organization-details/rest.client.ts index ea1ccf5..947ff8a 100644 --- a/src/organization-details/rest.client.ts +++ b/src/organization-details/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, OrganizationSetup } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, OrganizationSetup } from './rest.type.js' * setup/organization */ export class MambuOrganizationDetails { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuOrganizationDetails { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /setup/organization + * * Get organization details */ public getOrganizationSetup({ @@ -60,7 +64,7 @@ export class MambuOrganizationDetails { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -68,7 +72,6 @@ export class MambuOrganizationDetails { return this.awaitResponse( this.buildClient(auth).get('setup/organization', { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: OrganizationSetup, @@ -77,10 +80,13 @@ export class MambuOrganizationDetails { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /setup/organization + * * Update organization details */ public updateOrganizationSetup({ @@ -96,7 +102,7 @@ export class MambuOrganizationDetails { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -108,9 +114,8 @@ export class MambuOrganizationDetails { return this.awaitResponse( this.buildClient(auth).put('setup/organization', { - json: body, + json: _body.right as OrganizationSetup, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: OrganizationSetup, @@ -119,6 +124,7 @@ export class MambuOrganizationDetails { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -143,44 +149,45 @@ export class MambuOrganizationDetails { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -188,8 +195,7 @@ export class MambuOrganizationDetails { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -197,21 +203,21 @@ export class MambuOrganizationDetails { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/organization-general-holidays/rest.client.ts b/src/organization-general-holidays/rest.client.ts index 0528d25..75449ac 100644 --- a/src/organization-general-holidays/rest.client.ts +++ b/src/organization-general-holidays/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { CreateRequest, CreateResponse, ErrorResponse, Holiday } from './rest.type.js' @@ -16,7 +16,7 @@ import { CreateRequest, CreateResponse, ErrorResponse, Holiday } from './rest.ty * organization/holidays/general */ export class MambuOrganizationGeneralHolidays { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuOrganizationGeneralHolidays { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /organization/holidays/general + * * Create holidays */ public create({ @@ -63,7 +67,7 @@ export class MambuOrganizationGeneralHolidays { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -75,9 +79,8 @@ export class MambuOrganizationGeneralHolidays { return this.awaitResponse( this.buildClient(auth).post('organization/holidays/general', { - json: body, + json: _body.right as CreateRequest, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -86,10 +89,13 @@ export class MambuOrganizationGeneralHolidays { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /organization/holidays/general/{holidayIdentifier} + * * Delete holiday */ public delete({ @@ -105,15 +111,13 @@ export class MambuOrganizationGeneralHolidays { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`organization/holidays/general/${path.holidayIdentifier}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`organization/holidays/general/${path.holidayIdentifier}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -122,10 +126,13 @@ export class MambuOrganizationGeneralHolidays { 404: ErrorResponse, 409: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /organization/holidays/general/{holidayIdentifier} + * * Get holiday */ public getByIdentifier({ @@ -141,7 +148,7 @@ export class MambuOrganizationGeneralHolidays { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404' | '409'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -149,7 +156,6 @@ export class MambuOrganizationGeneralHolidays { return this.awaitResponse( this.buildClient(auth).get(`organization/holidays/general/${path.holidayIdentifier}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Holiday, @@ -159,6 +165,7 @@ export class MambuOrganizationGeneralHolidays { 404: ErrorResponse, 409: ErrorResponse, }, + 'json', ) as ReturnType } @@ -183,44 +190,45 @@ export class MambuOrganizationGeneralHolidays { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -228,8 +236,7 @@ export class MambuOrganizationGeneralHolidays { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -237,21 +244,21 @@ export class MambuOrganizationGeneralHolidays { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/organization-holidays/rest.client.ts b/src/organization-holidays/rest.client.ts index ab9bd39..04bdad1 100644 --- a/src/organization-holidays/rest.client.ts +++ b/src/organization-holidays/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, Holidays } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, Holidays } from './rest.type.js' * organization/holidays */ export class MambuOrganizationHolidays { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuOrganizationHolidays { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /organization/holidays + * * Get holidays */ public get({ @@ -59,7 +63,7 @@ export class MambuOrganizationHolidays { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -67,7 +71,6 @@ export class MambuOrganizationHolidays { return this.awaitResponse( this.buildClient(auth).get('organization/holidays', { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Holidays, @@ -75,10 +78,13 @@ export class MambuOrganizationHolidays { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /organization/holidays + * * Update holidays */ public update({ @@ -94,7 +100,7 @@ export class MambuOrganizationHolidays { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -106,9 +112,8 @@ export class MambuOrganizationHolidays { return this.awaitResponse( this.buildClient(auth).put('organization/holidays', { - json: body, + json: _body.right as Holidays, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Holidays, @@ -117,6 +122,7 @@ export class MambuOrganizationHolidays { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -141,44 +147,45 @@ export class MambuOrganizationHolidays { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -186,8 +193,7 @@ export class MambuOrganizationHolidays { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -195,21 +201,21 @@ export class MambuOrganizationHolidays { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/organization-non-working-days/rest.client.ts b/src/organization-non-working-days/rest.client.ts index 9be0c2f..2fff990 100644 --- a/src/organization-non-working-days/rest.client.ts +++ b/src/organization-non-working-days/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, NonWorkingDays } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, NonWorkingDays } from './rest.type.js' * organization/holidays/nonworkingdays */ export class MambuOrganizationNonWorkingDays { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuOrganizationNonWorkingDays { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /organization/holidays/nonworkingdays + * * Get non-working days */ public getNonWorkingDays({ @@ -59,7 +63,7 @@ export class MambuOrganizationNonWorkingDays { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -67,7 +71,6 @@ export class MambuOrganizationNonWorkingDays { return this.awaitResponse( this.buildClient(auth).get('organization/holidays/nonworkingdays', { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: NonWorkingDays, @@ -75,10 +78,13 @@ export class MambuOrganizationNonWorkingDays { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /organization/holidays/nonworkingdays + * * Update non-working days */ public updateNonWorkingDays({ @@ -94,7 +100,7 @@ export class MambuOrganizationNonWorkingDays { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -106,9 +112,8 @@ export class MambuOrganizationNonWorkingDays { return this.awaitResponse( this.buildClient(auth).put('organization/holidays/nonworkingdays', { - json: body, + json: _body.right as NonWorkingDays, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: NonWorkingDays, @@ -117,6 +122,7 @@ export class MambuOrganizationNonWorkingDays { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -141,44 +147,45 @@ export class MambuOrganizationNonWorkingDays { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -186,8 +193,7 @@ export class MambuOrganizationNonWorkingDays { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -195,21 +201,21 @@ export class MambuOrganizationNonWorkingDays { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/streaming.ts b/src/streaming.ts index 265a46e..83b2b62 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -6,8 +6,25 @@ import split2 from 'split2' import https from 'node:https' import { PassThrough } from 'node:stream' +import type { KyInstance, Options } from 'ky' export class MambuStreaming extends BaseMambuStreaming { + public prefixUrl: string | undefined + + public constructor(params: { + prefixUrl?: string | 'http://MYTENANT.mambu.com/api/v1' + options?: Options + auth: { + apiKeyAuth?: string | (() => Promise) + } + defaultAuth?: string[][] | string[] + client?: KyInstance + }) { + super(params) + + this.prefixUrl = params.prefixUrl + } + public async *getSubscriptionEventBatches({ path, query, @@ -27,7 +44,7 @@ export class MambuStreaming extends BaseMambuStreaming { }) { const apiKey = typeof this.auth.apiKeyAuth === 'string' ? this.auth.apiKeyAuth : await this.auth.apiKeyAuth?.() const stream = new PassThrough() - const url = new URL(`${this.client.defaults.options.prefixUrl.toString()}subscriptions/${path.subscriptionId}/events`) + const url = new URL(`${this.prefixUrl}subscriptions/${path.subscriptionId}/events`) for (const [k, v] of Object.entries(query ?? {})) { url.searchParams.set(k, v) } diff --git a/src/tasks/rest.client.ts b/src/tasks/rest.client.ts index 9457876..0c91e52 100644 --- a/src/tasks/rest.client.ts +++ b/src/tasks/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, GetAllResponse, PatchRequest, Task } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, GetAllResponse, PatchRequest, Task } from './rest.type.j * tasks */ export class MambuTasks { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuTasks { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /tasks + * * Create task */ public create({ @@ -63,7 +67,7 @@ export class MambuTasks { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -75,9 +79,8 @@ export class MambuTasks { return this.awaitResponse( this.buildClient(auth).post('tasks', { - json: body, + json: _body.right as Task, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -86,10 +89,13 @@ export class MambuTasks { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /tasks/{taskId} + * * Delete task */ public delete({ @@ -104,15 +110,13 @@ export class MambuTasks { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`tasks/${path.taskId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`tasks/${path.taskId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -120,10 +124,13 @@ export class MambuTasks { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /tasks + * * Gets tasks */ public getAll({ @@ -149,7 +156,7 @@ export class MambuTasks { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -158,7 +165,6 @@ export class MambuTasks { this.buildClient(auth).get('tasks', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -166,10 +172,13 @@ export class MambuTasks { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /tasks/{taskId} + * * Get task */ public getById({ @@ -184,7 +193,7 @@ export class MambuTasks { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -192,7 +201,6 @@ export class MambuTasks { return this.awaitResponse( this.buildClient(auth).get(`tasks/${path.taskId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Task, @@ -201,10 +209,13 @@ export class MambuTasks { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /tasks/{taskId} + * * Partially update task */ public patch({ @@ -221,7 +232,7 @@ export class MambuTasks { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -233,8 +244,7 @@ export class MambuTasks { return this.awaitResponse( this.buildClient(auth).patch(`tasks/${path.taskId}`, { - json: body, - responseType: 'text', + json: _body.right as PatchRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -243,10 +253,13 @@ export class MambuTasks { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PUT /tasks/{taskId} + * * Update task */ public update({ @@ -263,7 +276,7 @@ export class MambuTasks { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -275,9 +288,8 @@ export class MambuTasks { return this.awaitResponse( this.buildClient(auth).put(`tasks/${path.taskId}`, { - json: body, + json: _body.right as Task, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Task, @@ -286,6 +298,7 @@ export class MambuTasks { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -310,44 +323,45 @@ export class MambuTasks { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -355,8 +369,7 @@ export class MambuTasks { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -364,21 +377,21 @@ export class MambuTasks { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/transaction-channels-configuration/rest.client.ts b/src/transaction-channels-configuration/rest.client.ts index daea293..38085c5 100644 --- a/src/transaction-channels-configuration/rest.client.ts +++ b/src/transaction-channels-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/transactionchannels.yaml */ export class MambuTransactionChannelsConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuTransactionChannelsConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/transactionchannels.yaml + * * Get transaction channels configuration */ public get({ @@ -54,22 +58,24 @@ export class MambuTransactionChannelsConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/transactionchannels.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/transactionchannels.yaml + * * Update transaction channels configuration */ public update({ @@ -83,15 +89,13 @@ export class MambuTransactionChannelsConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).put('configuration/transactionchannels.yaml', { - responseType: 'text', - }), + this.buildClient(auth).put('configuration/transactionchannels.yaml', {}), { 200: { parse: (x: unknown) => ({ right: x }) }, 400: { parse: (x: unknown) => ({ right: x }) }, @@ -99,50 +103,52 @@ export class MambuTransactionChannelsConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -150,8 +156,7 @@ export class MambuTransactionChannelsConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -159,21 +164,21 @@ export class MambuTransactionChannelsConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/transaction-channels/rest.client.ts b/src/transaction-channels/rest.client.ts index 4aad8d4..d1dd1c2 100644 --- a/src/transaction-channels/rest.client.ts +++ b/src/transaction-channels/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, GetAllResponse, TransactionChannel } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, GetAllResponse, TransactionChannel } from './rest.type.j * organization/transactionChannels */ export class MambuTransactionChannels { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuTransactionChannels { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /organization/transactionChannels + * * Create transaction channel */ public create({ @@ -63,7 +67,7 @@ export class MambuTransactionChannels { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -75,9 +79,8 @@ export class MambuTransactionChannels { return this.awaitResponse( this.buildClient(auth).post('organization/transactionChannels', { - json: body, + json: _body.right as TransactionChannel, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -86,10 +89,13 @@ export class MambuTransactionChannels { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /organization/transactionChannels/{transactionChannelId} + * * Delete transaction channel */ public delete({ @@ -104,15 +110,13 @@ export class MambuTransactionChannels { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`organization/transactionChannels/${path.transactionChannelId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`organization/transactionChannels/${path.transactionChannelId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -120,10 +124,13 @@ export class MambuTransactionChannels { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /organization/transactionChannels + * * Get transaction channels */ public getAll({ @@ -137,7 +144,7 @@ export class MambuTransactionChannels { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -146,7 +153,6 @@ export class MambuTransactionChannels { this.buildClient(auth).get('organization/transactionChannels', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -154,10 +160,13 @@ export class MambuTransactionChannels { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /organization/transactionChannels/{transactionChannelId} + * * Get transaction channel */ public getById({ @@ -172,7 +181,7 @@ export class MambuTransactionChannels { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -180,7 +189,6 @@ export class MambuTransactionChannels { return this.awaitResponse( this.buildClient(auth).get(`organization/transactionChannels/${path.transactionChannelId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: TransactionChannel, @@ -189,10 +197,13 @@ export class MambuTransactionChannels { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PUT /organization/transactionChannels/{transactionChannelId} + * * Update transaction channel */ public update({ @@ -209,7 +220,7 @@ export class MambuTransactionChannels { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -221,8 +232,7 @@ export class MambuTransactionChannels { return this.awaitResponse( this.buildClient(auth).put(`organization/transactionChannels/${path.transactionChannelId}`, { - json: body, - responseType: 'text', + json: _body.right as TransactionChannel, }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -231,6 +241,7 @@ export class MambuTransactionChannels { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } @@ -255,44 +266,45 @@ export class MambuTransactionChannels { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -300,8 +312,7 @@ export class MambuTransactionChannels { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -309,21 +320,21 @@ export class MambuTransactionChannels { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/user-roles-configuration/rest.client.ts b/src/user-roles-configuration/rest.client.ts index b59c682..63d77f6 100644 --- a/src/user-roles-configuration/rest.client.ts +++ b/src/user-roles-configuration/rest.client.ts @@ -7,14 +7,14 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' /** * configuration/userroles */ export class MambuUserRolesConfiguration { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -29,22 +29,26 @@ export class MambuUserRolesConfiguration { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * GET /configuration/userroles.yaml + * * Get user roles configuration */ public get({ @@ -54,22 +58,24 @@ export class MambuUserRolesConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/userroles.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * GET /configuration/userroles/template.yaml + * * Get user roles configuration template */ public getTemplate({ @@ -79,22 +85,24 @@ export class MambuUserRolesConfiguration { | FailureResponse<'401', unknown, 'response:statuscode'> | FailureResponse<'403', unknown, 'response:statuscode'> | FailureResponse, string, 'response:body', IncomingHttpHeaders> - | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, unknown, 'response:statuscode', IncomingHttpHeaders> > { return this.awaitResponse( this.buildClient(auth).get('configuration/userroles/template.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, 401: { parse: (x: unknown) => ({ right: x }) }, 403: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } /** + * PUT /configuration/userroles.yaml + * * Update user roles configuration */ public update({ @@ -109,7 +117,7 @@ export class MambuUserRolesConfiguration { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -117,7 +125,6 @@ export class MambuUserRolesConfiguration { return this.awaitResponse( this.buildClient(auth).put('configuration/userroles.yaml', { headers: headers ?? {}, - responseType: 'text', }), { 200: { parse: (x: unknown) => ({ right: x }) }, @@ -126,50 +133,52 @@ export class MambuUserRolesConfiguration { 403: { parse: (x: unknown) => ({ right: x }) }, 404: { parse: (x: unknown) => ({ right: x }) }, }, + 'text', ) as ReturnType } public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -177,8 +186,7 @@ export class MambuUserRolesConfiguration { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -186,21 +194,21 @@ export class MambuUserRolesConfiguration { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/user-roles/rest.client.ts b/src/user-roles/rest.client.ts index 6e31960..3b9cd07 100644 --- a/src/user-roles/rest.client.ts +++ b/src/user-roles/rest.client.ts @@ -7,8 +7,8 @@ import type { IncomingHttpHeaders } from 'node:http' import type { DefinedError } from 'ajv' -import { got } from 'got' -import type { CancelableRequest, Got, Options, OptionsInit, Response } from 'got' +import ky from 'ky' +import type { KyInstance, Options, ResponsePromise } from 'ky' import { ErrorResponse, GetAllResponse, PatchRequest, Role } from './rest.type.js' @@ -16,7 +16,7 @@ import { ErrorResponse, GetAllResponse, PatchRequest, Role } from './rest.type.j * userroles */ export class MambuUserRoles { - public client: Got + public client: KyInstance public auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuUserRoles { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /userroles + * * Create user role */ public create({ @@ -63,7 +67,7 @@ export class MambuUserRoles { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -75,9 +79,8 @@ export class MambuUserRoles { return this.awaitResponse( this.buildClient(auth).post('userroles', { - json: body, + json: _body.right as Role, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -86,10 +89,13 @@ export class MambuUserRoles { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /userroles/{roleId} + * * Delete user role */ public delete({ @@ -104,15 +110,13 @@ export class MambuUserRoles { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`userroles/${path.roleId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`userroles/${path.roleId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -120,10 +124,13 @@ export class MambuUserRoles { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /userroles + * * Get user roles */ public getAll({ @@ -140,7 +147,7 @@ export class MambuUserRoles { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -149,7 +156,6 @@ export class MambuUserRoles { this.buildClient(auth).get('userroles', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -157,10 +163,13 @@ export class MambuUserRoles { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /userroles/{roleId} + * * Get user role */ public getById({ @@ -176,7 +185,7 @@ export class MambuUserRoles { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -185,7 +194,6 @@ export class MambuUserRoles { this.buildClient(auth).get(`userroles/${path.roleId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: Role, @@ -194,10 +202,13 @@ export class MambuUserRoles { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /userroles/{roleId} + * * Partially update user role */ public patch({ @@ -214,7 +225,7 @@ export class MambuUserRoles { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -226,8 +237,7 @@ export class MambuUserRoles { return this.awaitResponse( this.buildClient(auth).patch(`userroles/${path.roleId}`, { - json: body, - responseType: 'text', + json: _body.right as PatchRequest, }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -236,10 +246,13 @@ export class MambuUserRoles { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PUT /userroles/{roleId} + * * Update user role */ public update({ @@ -258,7 +271,7 @@ export class MambuUserRoles { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -270,9 +283,8 @@ export class MambuUserRoles { return this.awaitResponse( this.buildClient(auth).put(`userroles/${path.roleId}`, { - json: body, + json: _body.right as Role, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -282,6 +294,7 @@ export class MambuUserRoles { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -306,44 +319,45 @@ export class MambuUserRoles { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -351,8 +365,7 @@ export class MambuUserRoles { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -360,21 +373,21 @@ export class MambuUserRoles { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/user-roles/rest.type.ts b/src/user-roles/rest.type.ts index dccd6fe..800b87d 100644 --- a/src/user-roles/rest.type.ts +++ b/src/user-roles/rest.type.ts @@ -257,6 +257,7 @@ type Permissions = | 'EDIT_PERIODIC_PAYMENT_FOR_ACTIVE_ACCOUNT' | 'MANAGE_LOAN_ASSOCIATION' | 'MAKE_WITHDRAWAL_REDRAW' + | 'ENTER_REFUND' | 'VIEW_SAVINGS_ACCOUNT_DETAILS' | 'CREATE_SAVINGS_ACCOUNT' | 'EDIT_SAVINGS_ACCOUNT' @@ -286,6 +287,7 @@ type Permissions = | 'WITHDRAW_BLOCKED_FUNDS' | 'MANAGE_DEPOSIT_ACCOUNT_RECIPIENT' | 'MANAGE_DEPOSIT_ASSOCIATION' + | 'BYPASS_ACCOUNT_OWNERSHIP_TRANSFER_VIEW_RESTRICTION' | 'CREATE_CARDS' | 'VIEW_CARDS' | 'DELETE_CARDS' @@ -379,44 +381,19 @@ type Permissions = | 'CREATE_MAMBU_FUNCTIONS_SECRETS' | 'EDIT_MAMBU_FUNCTIONS_SECRETS' | 'DELETE_MAMBU_FUNCTIONS_SECRETS' - | 'VIEW_CURRENT_USER_DETAILS' - | 'VIEW_PROFIT_SHARING_CLASSES' - | 'CREATE_PROFIT_SHARING_CLASSES' - | 'EDIT_PROFIT_SHARING_CLASSES' - | 'DELETE_PROFIT_SHARING_CLASSES' - | 'VIEW_PROFIT_SHARING_POOLS' + | 'VIEW_PROFIT_SHARING_PROPOSALS' + | 'CREATE_PROFIT_SHARING_CASH_FLOWS' + | 'VIEW_PROFIT_SHARING_CASH_FLOWS' + | 'EDIT_PROFIT_SHARING_CASH_FLOWS' + | 'DELETE_PROFIT_SHARING_CASH_FLOWS' | 'CREATE_PROFIT_SHARING_POOLS' + | 'VIEW_PROFIT_SHARING_POOLS' | 'EDIT_PROFIT_SHARING_POOLS' | 'DELETE_PROFIT_SHARING_POOLS' - | 'VIEW_PROFIT_SHARING_INCOME_CATEGORIES' - | 'CREATE_PROFIT_SHARING_INCOME_CATEGORIES' - | 'EDIT_PROFIT_SHARING_INCOME_CATEGORIES' - | 'DELETE_PROFIT_SHARING_INCOME_CATEGORIES' - | 'VIEW_PROFIT_SHARING_EXPENSES' - | 'CREATE_PROFIT_SHARING_EXPENSES' - | 'EDIT_PROFIT_SHARING_EXPENSES' - | 'DELETE_PROFIT_SHARING_EXPENSES' - | 'VIEW_PROFIT_SHARING_DEDUCTIONS' - | 'CREATE_PROFIT_SHARING_DEDUCTIONS' - | 'EDIT_PROFIT_SHARING_DEDUCTIONS' - | 'DELETE_PROFIT_SHARING_DEDUCTIONS' - | 'VIEW_PROFIT_SHARING_PROPOSALS' - | 'EDIT_PROFIT_SHARING_PROPOSALS' - | 'CREATE_PROFIT_SHARING_PROPOSALS' - | 'APPROVE_PROFIT_SHARING_PROPOSALS' - | 'ADJUST_PROFIT_SHARING_PROPOSALS' - | 'TRIGGER_COMPUTATION' - | 'VIEW_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'CREATE_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'EDIT_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'DELETE_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'VIEW_PROFIT_SHARING_DEPOSIT_PRODUCTS' - | 'EDIT_PROFIT_SHARING_DEPOSIT_PRODUCT_LINK' - | 'VIEW_PROFIT_SHARING_ACCOUNTS_SETTINGS' - | 'CREATE_PROFIT_SHARING_ACCOUNT_SETTINGS' - | 'EDIT_PROFIT_SHARING_ACCOUNT_SETTINGS' - | 'VIEW_PROFIT_SHARING_GL_ACCOUNTS' - | 'VIEW_PROFIT_SHARING_BRANCHES' + | 'CREATE_PROFIT_SHARING_PRODUCT_SETTINGS' + | 'VIEW_PROFIT_SHARING_PRODUCT_SETTINGS' + | 'EDIT_PROFIT_SHARING_PRODUCT_SETTINGS' + | 'DELETE_PROFIT_SHARING_PRODUCT_SETTINGS' | 'MAKE_BULK_CHANGE_INTEREST_AVAILABILITY' export interface RestError { diff --git a/src/user-roles/schemas/get-all-response.schema.js b/src/user-roles/schemas/get-all-response.schema.js index 7f4e6a0..f04e62e 100644 --- a/src/user-roles/schemas/get-all-response.schema.js +++ b/src/user-roles/schemas/get-all-response.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"GetAllResponse","type":"array","items":{"$ref":"#/$defs/Role"},"$defs":{"Role":{"type":"object","description":"Represents a user role.","properties":{"access":{"$ref":"#/$defs/BaseUserAccess"},"creationDate":{"type":"string","description":"The date when the role was created in UTC.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated automatically, globally unique."},"id":{"type":"string","description":"The ID of the role, which can be generated and customized, but must be unique."},"lastModifiedDate":{"type":"string","description":"The last time the role was modified in UTC.","format":"date-time"},"name":{"type":"string","description":"The unique name of the role."},"notes":{"type":"string","description":"The notes about the role."}},"required":["name"],"additionalProperties":true},"BaseUserAccess":{"type":"object","description":"Represents the user permissions and access rights.","properties":{"administratorAccess":{"type":"boolean","description":"`TRUE` if the user has the administrator user type, `FALSE` otherwise. Administrators (admins) have all permissions and can perform any action in Mambu."},"apiAccess":{"type":"boolean","description":"`TRUE` if the user can authenticate and interact with Mambu APIs, `FALSE` otherwise. The user may still require additional permissions for specific API requests."},"creditOfficerAccess":{"type":"boolean","description":"`TRUE` if the user has the credit officer user type, `FALSE` otherwise. Credit officers have the option of having clients and groups assigned to them."},"deliveryAccess":{"type":"boolean","description":"`TRUE` if the user is part of the Mambu delivery team, `FALSE` otherwise."},"mambuAccess":{"type":"boolean","description":"TRUE` if the user can log in to the Mambu UI using their login credentials, `FALSE` otherwise."},"permissions":{"type":"array","description":"Permissions for the user. The non-admin users are authorized to do actions based a set of permissions in order to access Mambu features. Permissions may be relevant for the API and/or the Mambu UI.","items":{"enum":["AUDIT_TRANSACTIONS","VIEW_COMMENTS","CREATE_COMMENTS","EDIT_COMMENTS","DELETE_COMMENTS","CREATE_INDEX_RATE","DOWNLOAD_BACKUPS","IMPORT_DATA","VIEW_BACKGROUND_TASKS","VIEW_EXCHANGE_RATES","CREATE_EXCHANGE_RATE","VIEW_CENTRE_DETAILS","CREATE_CENTRE","EDIT_CENTRE","DELETE_CENTRE","MANAGE_CONFIGURATION_AS_CODE","GET_MANAGE_CONFIGURATION_AS_CODE","PUT_MANAGE_CONFIGURATION_AS_CODE","VIEW_BRANCH_DETAILS","CREATE_BRANCH","EDIT_BRANCH","CREATE_COMMUNICATION_TEMPLATES","EDIT_COMMUNICATION_TEMPLATES","SEND_MANUAL_SMS","SEND_MANUAL_EMAIL","VIEW_COMMUNICATION_HISTORY","RESEND_FAILED_MESSAGES","VIEW_TRANSACTION_CHANNELS","CREATE_TRANSACTION_CHANNELS","EDIT_TRANSACTION_CHANNELS","DELETE_TRANSACTION_CHANNELS","MANAGE_HOLIDAYS","MANAGE_INDEX_RATES","MANAGE_EOD_PROCESSING","MANAGE_INTERNAL_CONTROLS","MANAGE_CURRENCIES","MANAGE_AUTHORIZATION_HOLDS_SETUP","MANAGE_RISK_LEVELS","VIEW_LOAN_PRODUCT_DETAILS","CREATE_LOAN_PRODUCT","EDIT_LOAN_PRODUCT","DELETE_LOAN_PRODUCTS","VIEW_SAVINGS_PRODUCT_DETAILS","CREATE_SAVINGS_PRODUCT","EDIT_SAVINGS_PRODUCT","DELETE_SAVINGS_PRODUCT","CREATE_PRODUCT_DOCUMENT_TEMPLATES","EDIT_PRODUCT_DOCUMENT_TEMPLATES","DELETE_PRODUCT_DOCUMENT_TEMPLATES","VIEW_CLIENT_DETAILS","CREATE_CLIENT","EDIT_CLIENT","DELETE_CLIENTS","APPROVE_CLIENT","REJECT_CLIENT","EXIT_CLIENT","ANONYMIZE_CLIENT","BLACKLIST_CLIENT","UNDO_CLIENT_STATE_CHANGED","EDIT_CLIENT_ID","EDIT_BLACKLISTED_CLIENT_CFV","EDIT_GROUP_ID","CHANGE_CLIENT_TYPE","VIEW_GROUP_DETAILS","CREATE_GROUP","EDIT_GROUP","DELETE_GROUP","CHANGE_GROUP_TYPE","VIEW_LINE_OF_CREDIT_DETAILS","CREATE_LINES_OF_CREDIT","EDIT_LINES_OF_CREDIT","ADD_ACCOUNTS_TO_LINE_OF_CREDIT","REMOVE_ACCOUNTS_FROM_LINE_OF_CREDIT","APPROVE_LINE_OF_CREDIT","UNDO_APPROVE_LINE_OF_CREDIT","WITHDRAW_LINE_OF_CREDIT","UNDO_WITHDRAW_LINE_OF_CREDIT","REJECT_LINE_OF_CREDIT","UNDO_REJECT_LINE_OF_CREDIT","CLOSE_LINES_OF_CREDIT","DELETE_LINES_OF_CREDIT","VIEW_LOAN_ACCOUNT_DETAILS","CREATE_LOAN_ACCOUNT","EDIT_LOAN_ACCOUNT","DELETE_LOAN_ACCOUNT","ENTER_REPAYMENT","EDIT_REPAYMENT_SCHEDULE","APPROVE_LOANS","REQUEST_LOAN_APPROVAL","DIBURSE_LOANS","WITHDRAW_LOAN_ACCOUNTS","UNDO_WITHDRAW_LOAN_ACCOUNTS","SET_LOAN_INCOMPLETE","REJECT_LOANS","UNDO_REJECT_LOANS","CLOSE_LOAN_ACCOUNTS","WRITE_OFF_LOAN_ACCOUNTS","TERMINATE_LOAN_ACCOUNTS","PAY_OFF_LOAN","UNDO_LOAN_ACCOUNT_CLOSURE","REVERSE_LOAN_ACCOUNT_WRITE_OFF","REFINANCE_LOAN_ACCOUNT","RESCHEDULE_LOAN_ACCOUNT","APPLY_ACCRUED_LOAN_INTEREST","APPLY_LOAN_FEES","APPLY_LOAN_ADJUSTMENTS","EDIT_PLANNED_FEES","BACKDATE_LOAN_TRANSACTIONS","LINK_ACCOUNTS","COLLECT_GUARANTIES","VIEW_SECURITIES_DETAILS","CREATE_SECURITIES","EDIT_SECURITIES","DELETE_SECURITIES","LOCK_LOAN_ACCOUNTS","POST_TRANSACTIONS_ON_LOCKED_LOAN_ACCOUNTS","EDIT_LOAN_TRANCHES","EDIT_PENALTY_RATE","SET_DISBURSEMENT_CONDITIONS","EDIT_LOAN_TRANSACTIONS","BULK_LOAN_CORRECTIONS","EDIT_INTEREST_RATE","EDIT_REPAYMENT_METHOD_VALUE","EDIT_PERIODIC_PAYMENT_FOR_ACTIVE_ACCOUNT","MANAGE_LOAN_ASSOCIATION","MAKE_WITHDRAWAL_REDRAW","VIEW_SAVINGS_ACCOUNT_DETAILS","CREATE_SAVINGS_ACCOUNT","EDIT_SAVINGS_ACCOUNT","DELETE_SAVINGS_ACCOUNT","MAKE_DEPOSIT","MAKE_BULK_DEPOSITS","MAKE_WITHDRAWAL","MAKE_EARLY_WITHDRAWALS","APPROVE_SAVINGS","ACTIVATE_MATURITY","UNDO_MATURITY","CLOSE_SAVINGS_ACCOUNTS","APPLY_SAVINGS_FEES","REOPEN_SAVINGS_ACCOUNT","APPLY_SAVINGS_ADJUSTMENTS","LOCK_SAVINGS_ACCOUNT","UNLOCK_SAVINGS_ACCOUNT","REVERSE_SAVINGS_ACCOUNT_WRITE_OFF","BACKDATE_SAVINGS_TRANSACTIONS","MAKE_TRANSFER","MAKE_INTER_CLIENTS_TRANSFERS","POST_TRANSACTIONS_ON_DORMANT_ACCOUNTS","APPLY_ACCRUED_SAVINGS_INTEREST","EDIT_SAVINGS_TRANSACTIONS","BULK_DEPOSIT_CORRECTIONS","BLOCK_AND_SEIZE_FUNDS","WITHDRAW_BLOCKED_FUNDS","MANAGE_DEPOSIT_ACCOUNT_RECIPIENT","MANAGE_DEPOSIT_ASSOCIATION","CREATE_CARDS","VIEW_CARDS","DELETE_CARDS","REVERSE_CARD_WITHDRAWAL_TRANSACTION","REVERSE_CARD_TRANSACTION","CARD_BALANCE_INQUIRY","CREATE_AUTHORIZATION_HOLD","UPDATE_AUTHORIZATION_HOLD","VIEW_AUTHORIZATION_HOLD","CREATE_CARD_TRANSACTION","CREATE_ACCOUNT_HOLD","UPDATE_ACCOUNT_HOLD","VIEW_ACCOUNT_HOLD","VIEW_DOCUMENTS","CREATE_DOCUMENTS","EDIT_DOCUMENTS","DELETE_DOCUMENTS","VIEW_TASK","CREATE_TASK","EDIT_TASK","DELETE_TASK","VIEW_INTELLIGENCE","VIEW_REPORTS","CREATE_REPORTS","EDIT_REPORTS","DELETE_REPORTS","VIEW_JASPER_REPORTS","CREATE_JASPER_REPORTS","EDIT_JASPER_REPORTS","DELETE_JASPER_REPORTS","VIEW_CHART_OF_ACCOUNTS","MANAGE_ACCOUNTS","VIEW_JOURNAL_ENTRIES","LOG_JOURNAL_ENTRIES","VIEW_ACCOUNTING_REPORTS","MAKE_ACCOUNTING_CLOSURE","APPLY_ACCOUNTING_ADJUSTMENTS","BOOKING_DATE_LOANS_GL","BOOKING_DATE_SAVINGS_GL","RECTIFY_ADJUSTMENT","MANAGE_INTERBRANCH_GLACCOUNT_RULES","VIEW_ACCOUNTING_RATES","CREATE_ACCOUNTING_RATES","OPEN_TILL","CLOSE_TILL","ADD_CASH","REMOVE_CASH","POST_TRANSACTIONS_WITHOUT_OPENED_TILL","VIEW_INVESTOR_FUNDS_DETAILS","CREATE_INVESTOR_FUNDS","EDIT_INVESTOR_FUNDS","DELETE_INVESTOR_FUNDS","SELL_LOAN_FRACTION","CREATE_USER","EDIT_USER","VIEW_USER_DETAILS","DELETE_USER","MANAGE_TWO_FACTOR_AUTHENTICATION","MANAGE_CLIENT_ASSOCIATION","MANAGE_GROUP_ASSOCIATION","EDIT_PRINCIPAL_PAYMENT_ACTIVE_REVOLVING_CREDIT","PERFORM_REPAYMENTS_WITH_CUSTOM_AMOUNTS_ALLOCATION","EXPORT_TO_EXCEL","VIEW_ADMINISTRATION_DETAILS","MANAGE_EVENTS_STREAMING","MANAGE_PAYMENTS","MANAGE_AUDIT_TRAIL","MANAGE_APPS","MANAGE_CARDS_CAPABILITY","MANAGE_NOTIFICATIONS","ADMIN","CREATE_ROLE","EDIT_ROLE","DELETE_ROLE","VIEW_ROLE","MANAGE_FEDERATED_AUTHENTICATION","MANAGE_ACCESS_PREFERENCES","VIEW_API_CONSUMERS_AND_KEYS","CREATE_API_CONSUMERS_AND_KEYS","EDIT_API_CONSUMERS_AND_KEYS","DELETE_API_CONSUMERS_AND_KEYS","VIEW_CUSTOM_FIELD","CREATE_CUSTOM_FIELD","EDIT_CUSTOM_FIELD","DELETE_CUSTOM_FIELD","VIEW_MAMBU_FUNCTIONS","CREATE_MAMBU_FUNCTIONS","EDIT_MAMBU_FUNCTIONS","DELETE_MAMBU_FUNCTIONS","VIEW_MAMBU_FUNCTIONS_SECRETS","CREATE_MAMBU_FUNCTIONS_SECRETS","EDIT_MAMBU_FUNCTIONS_SECRETS","DELETE_MAMBU_FUNCTIONS_SECRETS","VIEW_CURRENT_USER_DETAILS","VIEW_PROFIT_SHARING_CLASSES","CREATE_PROFIT_SHARING_CLASSES","EDIT_PROFIT_SHARING_CLASSES","DELETE_PROFIT_SHARING_CLASSES","VIEW_PROFIT_SHARING_POOLS","CREATE_PROFIT_SHARING_POOLS","EDIT_PROFIT_SHARING_POOLS","DELETE_PROFIT_SHARING_POOLS","VIEW_PROFIT_SHARING_INCOME_CATEGORIES","CREATE_PROFIT_SHARING_INCOME_CATEGORIES","EDIT_PROFIT_SHARING_INCOME_CATEGORIES","DELETE_PROFIT_SHARING_INCOME_CATEGORIES","VIEW_PROFIT_SHARING_EXPENSES","CREATE_PROFIT_SHARING_EXPENSES","EDIT_PROFIT_SHARING_EXPENSES","DELETE_PROFIT_SHARING_EXPENSES","VIEW_PROFIT_SHARING_DEDUCTIONS","CREATE_PROFIT_SHARING_DEDUCTIONS","EDIT_PROFIT_SHARING_DEDUCTIONS","DELETE_PROFIT_SHARING_DEDUCTIONS","VIEW_PROFIT_SHARING_PROPOSALS","EDIT_PROFIT_SHARING_PROPOSALS","CREATE_PROFIT_SHARING_PROPOSALS","APPROVE_PROFIT_SHARING_PROPOSALS","ADJUST_PROFIT_SHARING_PROPOSALS","TRIGGER_COMPUTATION","VIEW_PROFIT_SHARING_SYSTEM_OPTIONS","CREATE_PROFIT_SHARING_SYSTEM_OPTIONS","EDIT_PROFIT_SHARING_SYSTEM_OPTIONS","DELETE_PROFIT_SHARING_SYSTEM_OPTIONS","VIEW_PROFIT_SHARING_DEPOSIT_PRODUCTS","EDIT_PROFIT_SHARING_DEPOSIT_PRODUCT_LINK","VIEW_PROFIT_SHARING_ACCOUNTS_SETTINGS","CREATE_PROFIT_SHARING_ACCOUNT_SETTINGS","EDIT_PROFIT_SHARING_ACCOUNT_SETTINGS","VIEW_PROFIT_SHARING_GL_ACCOUNTS","VIEW_PROFIT_SHARING_BRANCHES","MAKE_BULK_CHANGE_INTEREST_AVAILABILITY"]}},"supportAccess":{"type":"boolean","description":"`TRUE` if the user can provide Mambu technical support, `FALSE` otherwise."},"tellerAccess":{"type":"boolean","description":"`TRUE` if the user has the teller user type, `FALSE` otherwise. Tellers have access to the teller module and specific tellering permissions, which allow them to take actions such as opening or closing tills, posting transactions on a till, and adding and removing cash from a till."}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a user role.","properties":{"access":{"$ref":"#/$defs/BaseUserAccess"},"creationDate":{"type":"string","description":"The date when the role was created in UTC.","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated automatically, globally unique."},"id":{"type":"string","description":"The ID of the role, which can be generated and customized, but must be unique."},"lastModifiedDate":{"type":"string","description":"The last time the role was modified in UTC.","format":"date-time"},"name":{"type":"string","description":"The unique name of the role."},"notes":{"type":"string","description":"The notes about the role."}},"required":["name"],"additionalProperties":true};const schema13 = {"type":"object","description":"Represents the user permissions and access rights.","properties":{"administratorAccess":{"type":"boolean","description":"`TRUE` if the user has the administrator user type, `FALSE` otherwise. Administrators (admins) have all permissions and can perform any action in Mambu."},"apiAccess":{"type":"boolean","description":"`TRUE` if the user can authenticate and interact with Mambu APIs, `FALSE` otherwise. The user may still require additional permissions for specific API requests."},"creditOfficerAccess":{"type":"boolean","description":"`TRUE` if the user has the credit officer user type, `FALSE` otherwise. Credit officers have the option of having clients and groups assigned to them."},"deliveryAccess":{"type":"boolean","description":"`TRUE` if the user is part of the Mambu delivery team, `FALSE` otherwise."},"mambuAccess":{"type":"boolean","description":"TRUE` if the user can log in to the Mambu UI using their login credentials, `FALSE` otherwise."},"permissions":{"type":"array","description":"Permissions for the user. The non-admin users are authorized to do actions based a set of permissions in order to access Mambu features. Permissions may be relevant for the API and/or the Mambu UI.","items":{"enum":["AUDIT_TRANSACTIONS","VIEW_COMMENTS","CREATE_COMMENTS","EDIT_COMMENTS","DELETE_COMMENTS","CREATE_INDEX_RATE","DOWNLOAD_BACKUPS","IMPORT_DATA","VIEW_BACKGROUND_TASKS","VIEW_EXCHANGE_RATES","CREATE_EXCHANGE_RATE","VIEW_CENTRE_DETAILS","CREATE_CENTRE","EDIT_CENTRE","DELETE_CENTRE","MANAGE_CONFIGURATION_AS_CODE","GET_MANAGE_CONFIGURATION_AS_CODE","PUT_MANAGE_CONFIGURATION_AS_CODE","VIEW_BRANCH_DETAILS","CREATE_BRANCH","EDIT_BRANCH","CREATE_COMMUNICATION_TEMPLATES","EDIT_COMMUNICATION_TEMPLATES","SEND_MANUAL_SMS","SEND_MANUAL_EMAIL","VIEW_COMMUNICATION_HISTORY","RESEND_FAILED_MESSAGES","VIEW_TRANSACTION_CHANNELS","CREATE_TRANSACTION_CHANNELS","EDIT_TRANSACTION_CHANNELS","DELETE_TRANSACTION_CHANNELS","MANAGE_HOLIDAYS","MANAGE_INDEX_RATES","MANAGE_EOD_PROCESSING","MANAGE_INTERNAL_CONTROLS","MANAGE_CURRENCIES","MANAGE_AUTHORIZATION_HOLDS_SETUP","MANAGE_RISK_LEVELS","VIEW_LOAN_PRODUCT_DETAILS","CREATE_LOAN_PRODUCT","EDIT_LOAN_PRODUCT","DELETE_LOAN_PRODUCTS","VIEW_SAVINGS_PRODUCT_DETAILS","CREATE_SAVINGS_PRODUCT","EDIT_SAVINGS_PRODUCT","DELETE_SAVINGS_PRODUCT","CREATE_PRODUCT_DOCUMENT_TEMPLATES","EDIT_PRODUCT_DOCUMENT_TEMPLATES","DELETE_PRODUCT_DOCUMENT_TEMPLATES","VIEW_CLIENT_DETAILS","CREATE_CLIENT","EDIT_CLIENT","DELETE_CLIENTS","APPROVE_CLIENT","REJECT_CLIENT","EXIT_CLIENT","ANONYMIZE_CLIENT","BLACKLIST_CLIENT","UNDO_CLIENT_STATE_CHANGED","EDIT_CLIENT_ID","EDIT_BLACKLISTED_CLIENT_CFV","EDIT_GROUP_ID","CHANGE_CLIENT_TYPE","VIEW_GROUP_DETAILS","CREATE_GROUP","EDIT_GROUP","DELETE_GROUP","CHANGE_GROUP_TYPE","VIEW_LINE_OF_CREDIT_DETAILS","CREATE_LINES_OF_CREDIT","EDIT_LINES_OF_CREDIT","ADD_ACCOUNTS_TO_LINE_OF_CREDIT","REMOVE_ACCOUNTS_FROM_LINE_OF_CREDIT","APPROVE_LINE_OF_CREDIT","UNDO_APPROVE_LINE_OF_CREDIT","WITHDRAW_LINE_OF_CREDIT","UNDO_WITHDRAW_LINE_OF_CREDIT","REJECT_LINE_OF_CREDIT","UNDO_REJECT_LINE_OF_CREDIT","CLOSE_LINES_OF_CREDIT","DELETE_LINES_OF_CREDIT","VIEW_LOAN_ACCOUNT_DETAILS","CREATE_LOAN_ACCOUNT","EDIT_LOAN_ACCOUNT","DELETE_LOAN_ACCOUNT","ENTER_REPAYMENT","EDIT_REPAYMENT_SCHEDULE","APPROVE_LOANS","REQUEST_LOAN_APPROVAL","DIBURSE_LOANS","WITHDRAW_LOAN_ACCOUNTS","UNDO_WITHDRAW_LOAN_ACCOUNTS","SET_LOAN_INCOMPLETE","REJECT_LOANS","UNDO_REJECT_LOANS","CLOSE_LOAN_ACCOUNTS","WRITE_OFF_LOAN_ACCOUNTS","TERMINATE_LOAN_ACCOUNTS","PAY_OFF_LOAN","UNDO_LOAN_ACCOUNT_CLOSURE","REVERSE_LOAN_ACCOUNT_WRITE_OFF","REFINANCE_LOAN_ACCOUNT","RESCHEDULE_LOAN_ACCOUNT","APPLY_ACCRUED_LOAN_INTEREST","APPLY_LOAN_FEES","APPLY_LOAN_ADJUSTMENTS","EDIT_PLANNED_FEES","BACKDATE_LOAN_TRANSACTIONS","LINK_ACCOUNTS","COLLECT_GUARANTIES","VIEW_SECURITIES_DETAILS","CREATE_SECURITIES","EDIT_SECURITIES","DELETE_SECURITIES","LOCK_LOAN_ACCOUNTS","POST_TRANSACTIONS_ON_LOCKED_LOAN_ACCOUNTS","EDIT_LOAN_TRANCHES","EDIT_PENALTY_RATE","SET_DISBURSEMENT_CONDITIONS","EDIT_LOAN_TRANSACTIONS","BULK_LOAN_CORRECTIONS","EDIT_INTEREST_RATE","EDIT_REPAYMENT_METHOD_VALUE","EDIT_PERIODIC_PAYMENT_FOR_ACTIVE_ACCOUNT","MANAGE_LOAN_ASSOCIATION","MAKE_WITHDRAWAL_REDRAW","VIEW_SAVINGS_ACCOUNT_DETAILS","CREATE_SAVINGS_ACCOUNT","EDIT_SAVINGS_ACCOUNT","DELETE_SAVINGS_ACCOUNT","MAKE_DEPOSIT","MAKE_BULK_DEPOSITS","MAKE_WITHDRAWAL","MAKE_EARLY_WITHDRAWALS","APPROVE_SAVINGS","ACTIVATE_MATURITY","UNDO_MATURITY","CLOSE_SAVINGS_ACCOUNTS","APPLY_SAVINGS_FEES","REOPEN_SAVINGS_ACCOUNT","APPLY_SAVINGS_ADJUSTMENTS","LOCK_SAVINGS_ACCOUNT","UNLOCK_SAVINGS_ACCOUNT","REVERSE_SAVINGS_ACCOUNT_WRITE_OFF","BACKDATE_SAVINGS_TRANSACTIONS","MAKE_TRANSFER","MAKE_INTER_CLIENTS_TRANSFERS","POST_TRANSACTIONS_ON_DORMANT_ACCOUNTS","APPLY_ACCRUED_SAVINGS_INTEREST","EDIT_SAVINGS_TRANSACTIONS","BULK_DEPOSIT_CORRECTIONS","BLOCK_AND_SEIZE_FUNDS","WITHDRAW_BLOCKED_FUNDS","MANAGE_DEPOSIT_ACCOUNT_RECIPIENT","MANAGE_DEPOSIT_ASSOCIATION","CREATE_CARDS","VIEW_CARDS","DELETE_CARDS","REVERSE_CARD_WITHDRAWAL_TRANSACTION","REVERSE_CARD_TRANSACTION","CARD_BALANCE_INQUIRY","CREATE_AUTHORIZATION_HOLD","UPDATE_AUTHORIZATION_HOLD","VIEW_AUTHORIZATION_HOLD","CREATE_CARD_TRANSACTION","CREATE_ACCOUNT_HOLD","UPDATE_ACCOUNT_HOLD","VIEW_ACCOUNT_HOLD","VIEW_DOCUMENTS","CREATE_DOCUMENTS","EDIT_DOCUMENTS","DELETE_DOCUMENTS","VIEW_TASK","CREATE_TASK","EDIT_TASK","DELETE_TASK","VIEW_INTELLIGENCE","VIEW_REPORTS","CREATE_REPORTS","EDIT_REPORTS","DELETE_REPORTS","VIEW_JASPER_REPORTS","CREATE_JASPER_REPORTS","EDIT_JASPER_REPORTS","DELETE_JASPER_REPORTS","VIEW_CHART_OF_ACCOUNTS","MANAGE_ACCOUNTS","VIEW_JOURNAL_ENTRIES","LOG_JOURNAL_ENTRIES","VIEW_ACCOUNTING_REPORTS","MAKE_ACCOUNTING_CLOSURE","APPLY_ACCOUNTING_ADJUSTMENTS","BOOKING_DATE_LOANS_GL","BOOKING_DATE_SAVINGS_GL","RECTIFY_ADJUSTMENT","MANAGE_INTERBRANCH_GLACCOUNT_RULES","VIEW_ACCOUNTING_RATES","CREATE_ACCOUNTING_RATES","OPEN_TILL","CLOSE_TILL","ADD_CASH","REMOVE_CASH","POST_TRANSACTIONS_WITHOUT_OPENED_TILL","VIEW_INVESTOR_FUNDS_DETAILS","CREATE_INVESTOR_FUNDS","EDIT_INVESTOR_FUNDS","DELETE_INVESTOR_FUNDS","SELL_LOAN_FRACTION","CREATE_USER","EDIT_USER","VIEW_USER_DETAILS","DELETE_USER","MANAGE_TWO_FACTOR_AUTHENTICATION","MANAGE_CLIENT_ASSOCIATION","MANAGE_GROUP_ASSOCIATION","EDIT_PRINCIPAL_PAYMENT_ACTIVE_REVOLVING_CREDIT","PERFORM_REPAYMENTS_WITH_CUSTOM_AMOUNTS_ALLOCATION","EXPORT_TO_EXCEL","VIEW_ADMINISTRATION_DETAILS","MANAGE_EVENTS_STREAMING","MANAGE_PAYMENTS","MANAGE_AUDIT_TRAIL","MANAGE_APPS","MANAGE_CARDS_CAPABILITY","MANAGE_NOTIFICATIONS","ADMIN","CREATE_ROLE","EDIT_ROLE","DELETE_ROLE","VIEW_ROLE","MANAGE_FEDERATED_AUTHENTICATION","MANAGE_ACCESS_PREFERENCES","VIEW_API_CONSUMERS_AND_KEYS","CREATE_API_CONSUMERS_AND_KEYS","EDIT_API_CONSUMERS_AND_KEYS","DELETE_API_CONSUMERS_AND_KEYS","VIEW_CUSTOM_FIELD","CREATE_CUSTOM_FIELD","EDIT_CUSTOM_FIELD","DELETE_CUSTOM_FIELD","VIEW_MAMBU_FUNCTIONS","CREATE_MAMBU_FUNCTIONS","EDIT_MAMBU_FUNCTIONS","DELETE_MAMBU_FUNCTIONS","VIEW_MAMBU_FUNCTIONS_SECRETS","CREATE_MAMBU_FUNCTIONS_SECRETS","EDIT_MAMBU_FUNCTIONS_SECRETS","DELETE_MAMBU_FUNCTIONS_SECRETS","VIEW_CURRENT_USER_DETAILS","VIEW_PROFIT_SHARING_CLASSES","CREATE_PROFIT_SHARING_CLASSES","EDIT_PROFIT_SHARING_CLASSES","DELETE_PROFIT_SHARING_CLASSES","VIEW_PROFIT_SHARING_POOLS","CREATE_PROFIT_SHARING_POOLS","EDIT_PROFIT_SHARING_POOLS","DELETE_PROFIT_SHARING_POOLS","VIEW_PROFIT_SHARING_INCOME_CATEGORIES","CREATE_PROFIT_SHARING_INCOME_CATEGORIES","EDIT_PROFIT_SHARING_INCOME_CATEGORIES","DELETE_PROFIT_SHARING_INCOME_CATEGORIES","VIEW_PROFIT_SHARING_EXPENSES","CREATE_PROFIT_SHARING_EXPENSES","EDIT_PROFIT_SHARING_EXPENSES","DELETE_PROFIT_SHARING_EXPENSES","VIEW_PROFIT_SHARING_DEDUCTIONS","CREATE_PROFIT_SHARING_DEDUCTIONS","EDIT_PROFIT_SHARING_DEDUCTIONS","DELETE_PROFIT_SHARING_DEDUCTIONS","VIEW_PROFIT_SHARING_PROPOSALS","EDIT_PROFIT_SHARING_PROPOSALS","CREATE_PROFIT_SHARING_PROPOSALS","APPROVE_PROFIT_SHARING_PROPOSALS","ADJUST_PROFIT_SHARING_PROPOSALS","TRIGGER_COMPUTATION","VIEW_PROFIT_SHARING_SYSTEM_OPTIONS","CREATE_PROFIT_SHARING_SYSTEM_OPTIONS","EDIT_PROFIT_SHARING_SYSTEM_OPTIONS","DELETE_PROFIT_SHARING_SYSTEM_OPTIONS","VIEW_PROFIT_SHARING_DEPOSIT_PRODUCTS","EDIT_PROFIT_SHARING_DEPOSIT_PRODUCT_LINK","VIEW_PROFIT_SHARING_ACCOUNTS_SETTINGS","CREATE_PROFIT_SHARING_ACCOUNT_SETTINGS","EDIT_PROFIT_SHARING_ACCOUNT_SETTINGS","VIEW_PROFIT_SHARING_GL_ACCOUNTS","VIEW_PROFIT_SHARING_BRANCHES","MAKE_BULK_CHANGE_INTEREST_AVAILABILITY"]}},"supportAccess":{"type":"boolean","description":"`TRUE` if the user can provide Mambu technical support, `FALSE` otherwise."},"tellerAccess":{"type":"boolean","description":"`TRUE` if the user has the teller user type, `FALSE` otherwise. Tellers have access to the teller module and specific tellering permissions, which allow them to take actions such as opening or closing tills, posting transactions on a till, and adding and removing cash from a till."}},"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.name === undefined) && (missing0 = "name")){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.access !== undefined){let data0 = data.access;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.administratorAccess !== undefined){const _errs6 = errors;if(typeof data0.administratorAccess !== "boolean"){validate11.errors = [{instancePath:instancePath+"/access/administratorAccess",schemaPath:"#/$defs/BaseUserAccess/properties/administratorAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.apiAccess !== undefined){const _errs8 = errors;if(typeof data0.apiAccess !== "boolean"){validate11.errors = [{instancePath:instancePath+"/access/apiAccess",schemaPath:"#/$defs/BaseUserAccess/properties/apiAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.creditOfficerAccess !== undefined){const _errs10 = errors;if(typeof data0.creditOfficerAccess !== "boolean"){validate11.errors = [{instancePath:instancePath+"/access/creditOfficerAccess",schemaPath:"#/$defs/BaseUserAccess/properties/creditOfficerAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data0.deliveryAccess !== undefined){const _errs12 = errors;if(typeof data0.deliveryAccess !== "boolean"){validate11.errors = [{instancePath:instancePath+"/access/deliveryAccess",schemaPath:"#/$defs/BaseUserAccess/properties/deliveryAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data0.mambuAccess !== undefined){const _errs14 = errors;if(typeof data0.mambuAccess !== "boolean"){validate11.errors = [{instancePath:instancePath+"/access/mambuAccess",schemaPath:"#/$defs/BaseUserAccess/properties/mambuAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data0.permissions !== undefined){let data6 = data0.permissions;const _errs16 = errors;if(errors === _errs16){if(Array.isArray(data6)){var valid3 = true;const len0 = data6.length;for(let i0=0; i0 Promise<[username: string, password: string]>) @@ -31,22 +31,26 @@ export class MambuUsers { options, auth = {}, defaultAuth, + client = ky, }: { prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit + options?: Options auth: { basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) apiKey?: string | (() => Promise) } defaultAuth?: string[][] | string[] + client?: KyInstance }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) + this.client = client.extend({ prefixUrl, throwHttpErrors: false, ...options }) this.auth = auth this.availableAuth = new Set(Object.keys(auth)) this.defaultAuth = defaultAuth } /** + * POST /users + * * Create user */ public create({ @@ -63,7 +67,7 @@ export class MambuUsers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -75,9 +79,8 @@ export class MambuUsers { return this.awaitResponse( this.buildClient(auth).post('users', { - json: body, + json: _body.right as UserRequest, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -86,10 +89,13 @@ export class MambuUsers { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * DELETE /users/{userId} + * * Delete user */ public delete({ @@ -104,15 +110,13 @@ export class MambuUsers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > > { return this.awaitResponse( - this.buildClient(auth).delete(`users/${path.userId}`, { - responseType: 'text', - }), + this.buildClient(auth).delete(`users/${path.userId}`, {}), { 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, @@ -120,10 +124,13 @@ export class MambuUsers { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * GET /users + * * Get users */ public getAll({ @@ -147,7 +154,7 @@ export class MambuUsers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -156,7 +163,6 @@ export class MambuUsers { this.buildClient(auth).get('users', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: GetAllResponse, @@ -164,10 +170,13 @@ export class MambuUsers { 401: ErrorResponse, 403: ErrorResponse, }, + 'json', ) as ReturnType } /** + * GET /users/{userId} + * * Get user */ public getById({ @@ -183,7 +192,7 @@ export class MambuUsers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -192,7 +201,6 @@ export class MambuUsers { this.buildClient(auth).get(`users/${path.userId}`, { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', }), { 200: User, @@ -201,10 +209,13 @@ export class MambuUsers { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } /** + * PATCH /users/{userId} + * * Partially update user */ public patch({ @@ -227,7 +238,7 @@ export class MambuUsers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -239,9 +250,8 @@ export class MambuUsers { return this.awaitResponse( this.buildClient(auth).patch(`users/${path.userId}`, { - json: body, + json: _body.right as PatchRequest, headers: headers ?? {}, - responseType: 'text', }), { 204: { parse: (x: unknown) => ({ right: x }) }, @@ -250,10 +260,13 @@ export class MambuUsers { 403: ErrorResponse, 404: ErrorResponse, }, + 'text', ) as ReturnType } /** + * PUT /users/{userId} + * * Update user */ public update({ @@ -272,7 +285,7 @@ export class MambuUsers { | FailureResponse, string, 'response:body', IncomingHttpHeaders> | FailureResponse< Exclude, '102' | '400' | '401' | '403' | '404'>, - string, + unknown, 'response:statuscode', IncomingHttpHeaders > @@ -284,9 +297,8 @@ export class MambuUsers { return this.awaitResponse( this.buildClient(auth).put(`users/${path.userId}`, { - json: body, + json: _body.right as User, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', }), { 102: { parse: (x: unknown) => ({ right: x }) }, @@ -296,6 +308,7 @@ export class MambuUsers { 403: ErrorResponse, 404: ErrorResponse, }, + 'json', ) as ReturnType } @@ -320,44 +333,45 @@ export class MambuUsers { public async awaitResponse< I, S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, - >(response: CancelableRequest>, schemas: S) { + >(response: ResponsePromise, schemas: S, responseType?: 'json' | 'text') { const result = await response + const _body = (await (responseType !== undefined ? result[responseType]() : result.text())) as I const status = - result.statusCode < 200 + result.status < 200 ? 'informational' - : result.statusCode < 300 + : result.status < 300 ? 'success' - : result.statusCode < 400 + : result.status < 400 ? 'redirection' - : result.statusCode < 500 + : result.status < 500 ? 'client-error' : 'server-error' - const validator = schemas[result.statusCode] ?? schemas.default - const body = validator?.parse?.(result.body) - if (result.statusCode < 200 || result.statusCode >= 300) { + const validator = schemas[result.status] ?? schemas.default + const body = validator?.parse?.(_body) + if (result.status < 200 || result.status >= 300) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: body !== undefined && 'right' in body ? body.right : result.body, + left: body !== undefined && 'right' in body ? body.right : _body, validationErrors: body !== undefined && 'left' in body ? body.left : undefined, where: 'response:statuscode', } } if (body === undefined || 'left' in body) { return { - statusCode: result.statusCode.toString(), + statusCode: result.status.toString(), status, headers: result.headers, - left: result.body, + left: _body, validationErrors: body?.left, where: 'response:body', } } - return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } + return { statusCode: result.status.toString(), status, headers: result.headers, right: _body } } - protected buildBasicClient(client: Got) { + protected buildBasicClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ @@ -365,8 +379,7 @@ export class MambuUsers { const basic = this.auth.basic if (basic !== undefined) { const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password + options.headers.set('Authorization', `Basic ${btoa(`${username}:${password}`)}`) } }, ], @@ -374,21 +387,21 @@ export class MambuUsers { }) } - protected buildApiKeyClient(client: Got) { + protected buildApiKeyClient(client: KyInstance) { return client.extend({ hooks: { beforeRequest: [ async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers.apiKey = key + options.headers.set('apiKey', `${key}`) }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: KyInstance): KyInstance { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) diff --git a/src/users/rest.type.ts b/src/users/rest.type.ts index 31cfb3b..71e29f7 100644 --- a/src/users/rest.type.ts +++ b/src/users/rest.type.ts @@ -9,8 +9,8 @@ import type { DefinedError, ValidateFunction } from 'ajv' import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' import { validate as PatchRequestValidator } from './schemas/patch-request.schema.js' -import { validate as UserRequestValidator } from './schemas/user_request.schema.js' import { validate as UserValidator } from './schemas/user.schema.js' +import { validate as UserRequestValidator } from './schemas/user_request.schema.js' export interface ErrorResponse { errors?: RestError[] | undefined @@ -220,6 +220,7 @@ type Permissions = | 'EDIT_PERIODIC_PAYMENT_FOR_ACTIVE_ACCOUNT' | 'MANAGE_LOAN_ASSOCIATION' | 'MAKE_WITHDRAWAL_REDRAW' + | 'ENTER_REFUND' | 'VIEW_SAVINGS_ACCOUNT_DETAILS' | 'CREATE_SAVINGS_ACCOUNT' | 'EDIT_SAVINGS_ACCOUNT' @@ -249,6 +250,7 @@ type Permissions = | 'WITHDRAW_BLOCKED_FUNDS' | 'MANAGE_DEPOSIT_ACCOUNT_RECIPIENT' | 'MANAGE_DEPOSIT_ASSOCIATION' + | 'BYPASS_ACCOUNT_OWNERSHIP_TRANSFER_VIEW_RESTRICTION' | 'CREATE_CARDS' | 'VIEW_CARDS' | 'DELETE_CARDS' @@ -342,44 +344,19 @@ type Permissions = | 'CREATE_MAMBU_FUNCTIONS_SECRETS' | 'EDIT_MAMBU_FUNCTIONS_SECRETS' | 'DELETE_MAMBU_FUNCTIONS_SECRETS' - | 'VIEW_CURRENT_USER_DETAILS' - | 'VIEW_PROFIT_SHARING_CLASSES' - | 'CREATE_PROFIT_SHARING_CLASSES' - | 'EDIT_PROFIT_SHARING_CLASSES' - | 'DELETE_PROFIT_SHARING_CLASSES' - | 'VIEW_PROFIT_SHARING_POOLS' + | 'VIEW_PROFIT_SHARING_PROPOSALS' + | 'CREATE_PROFIT_SHARING_CASH_FLOWS' + | 'VIEW_PROFIT_SHARING_CASH_FLOWS' + | 'EDIT_PROFIT_SHARING_CASH_FLOWS' + | 'DELETE_PROFIT_SHARING_CASH_FLOWS' | 'CREATE_PROFIT_SHARING_POOLS' + | 'VIEW_PROFIT_SHARING_POOLS' | 'EDIT_PROFIT_SHARING_POOLS' | 'DELETE_PROFIT_SHARING_POOLS' - | 'VIEW_PROFIT_SHARING_INCOME_CATEGORIES' - | 'CREATE_PROFIT_SHARING_INCOME_CATEGORIES' - | 'EDIT_PROFIT_SHARING_INCOME_CATEGORIES' - | 'DELETE_PROFIT_SHARING_INCOME_CATEGORIES' - | 'VIEW_PROFIT_SHARING_EXPENSES' - | 'CREATE_PROFIT_SHARING_EXPENSES' - | 'EDIT_PROFIT_SHARING_EXPENSES' - | 'DELETE_PROFIT_SHARING_EXPENSES' - | 'VIEW_PROFIT_SHARING_DEDUCTIONS' - | 'CREATE_PROFIT_SHARING_DEDUCTIONS' - | 'EDIT_PROFIT_SHARING_DEDUCTIONS' - | 'DELETE_PROFIT_SHARING_DEDUCTIONS' - | 'VIEW_PROFIT_SHARING_PROPOSALS' - | 'EDIT_PROFIT_SHARING_PROPOSALS' - | 'CREATE_PROFIT_SHARING_PROPOSALS' - | 'APPROVE_PROFIT_SHARING_PROPOSALS' - | 'ADJUST_PROFIT_SHARING_PROPOSALS' - | 'TRIGGER_COMPUTATION' - | 'VIEW_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'CREATE_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'EDIT_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'DELETE_PROFIT_SHARING_SYSTEM_OPTIONS' - | 'VIEW_PROFIT_SHARING_DEPOSIT_PRODUCTS' - | 'EDIT_PROFIT_SHARING_DEPOSIT_PRODUCT_LINK' - | 'VIEW_PROFIT_SHARING_ACCOUNTS_SETTINGS' - | 'CREATE_PROFIT_SHARING_ACCOUNT_SETTINGS' - | 'EDIT_PROFIT_SHARING_ACCOUNT_SETTINGS' - | 'VIEW_PROFIT_SHARING_GL_ACCOUNTS' - | 'VIEW_PROFIT_SHARING_BRANCHES' + | 'CREATE_PROFIT_SHARING_PRODUCT_SETTINGS' + | 'VIEW_PROFIT_SHARING_PRODUCT_SETTINGS' + | 'EDIT_PROFIT_SHARING_PRODUCT_SETTINGS' + | 'DELETE_PROFIT_SHARING_PRODUCT_SETTINGS' | 'MAKE_BULK_CHANGE_INTEREST_AVAILABILITY' export interface RestError { diff --git a/src/users/schemas/get-all-response.schema.js b/src/users/schemas/get-all-response.schema.js index 64021f0..36a90b7 100644 --- a/src/users/schemas/get-all-response.schema.js +++ b/src/users/schemas/get-all-response.schema.js @@ -6,4 +6,4 @@ import { default as ajvDistRuntimeEqualDefault } from 'ajv/dist/runtime/equal.js'; "use strict"; /** @type {unknown} */ -export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"GetAllResponse","type":"array","items":{"$ref":"#/$defs/User"},"$defs":{"User":{"type":"object","description":"Represents a user.","properties":{"access":{"$ref":"#/$defs/UserAccess"},"assignedBranchKey":{"type":"string","description":"The encoded key of the branch this user is assigned to."},"creationDate":{"type":"string","description":"The date the user was created in UTC.","format":"date-time"},"email":{"type":"string","description":"The user email address. Used by Mambu for sending automated notifications or for getting passwords."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"firstName":{"type":"string","description":"The first name of the user."},"homePhone":{"type":"string","description":"The user's home phone number, which can also contain characters."},"id":{"type":"string","description":"The ID of the user, which is generated automatically, but must be unique."},"language":{"description":"The Mambu display language for the user. The Mambu UI will be displayed in the selected language. Please note: for portuguese, you must use the incorrect spelling `PORTUGESE`.","enum":["ENGLISH","PORTUGESE","SPANISH","RUSSIAN","FRENCH","GEORGIAN","CHINESE","INDONESIAN","ROMANIAN","BURMESE","GERMAN","PORTUGUESE_BRAZIL","VIETNAMESE","ITALIAN","THAI","NORWEGIAN","PHRASE"]},"lastLoggedInDate":{"type":"string","description":"The last time the user logged in in UTC.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last time the user was modified in UTC.","format":"date-time"},"lastName":{"type":"string","description":"The last name of the user."},"mobilePhone":{"type":"string","description":"The user's mobile phone number, which can also contain characters."},"notes":{"type":"string","description":"The additional information for the user."},"role":{"$ref":"#/$defs/RoleIdentifier"},"title":{"type":"string","description":"The user title."},"transactionLimits":{"type":"object","description":"The user transaction limits.","additionalProperties":{"type":"integer"}},"twoFactorAuthentication":{"type":"boolean","description":"`TRUE` if the user has two-factor authentication setup, `FALSE` otherwise. If two-factor authentication is enabled, a user will be sent an SMS to their registered mobile number, which they will need to enter in the Mambu login screen, in addition to their password."},"username":{"type":"string","description":"The Mambu login user name."},"userState":{"description":"The current state of the user.","enum":["ACTIVE","INACTIVE","LOCKED"]}},"required":["access","firstName","username"],"additionalProperties":true},"UserAccess":{"type":"object","description":"Represents the user permissions and access rights.","properties":{"administratorAccess":{"type":"boolean","description":"`TRUE` if the user has the administrator user type, `FALSE` otherwise. Administrators (admins) have all permissions and can perform any action in Mambu."},"apiAccess":{"type":"boolean","description":"`TRUE` if the user can authenticate and interact with Mambu APIs, `FALSE` otherwise. The user may still require additional permissions for specific API requests."},"canManageAllBranches":{"type":"boolean","description":"`TRUE` if the user has access to all branches, `FALSE` if the user only has access to specific branches."},"canManageEntitiesAssignedToOtherOfficers":{"type":"boolean","description":"`TRUE` if a credit officer user can access entities (for example, clients or accounts) assigned to other credit officers, `FALSE` otherwise."},"creditOfficerAccess":{"type":"boolean","description":"`TRUE` if the user has the credit officer user type, `FALSE` otherwise. Credit officers have the option of having clients and groups assigned to them."},"deliveryAccess":{"type":"boolean","description":"`TRUE` if the user is part of the Mambu delivery team, `FALSE` otherwise."},"mambuAccess":{"type":"boolean","description":"TRUE` if the user can log in to the Mambu UI using their login credentials, `FALSE` otherwise."},"managedBranches":{"type":"array","description":"The list of branches that can be managed by the user. If the user has the `canManageAllBranches` property set to `TRUE`, this list does not apply.","items":{"$ref":"#/$defs/UserManagedBranch"}},"permissions":{"type":"array","description":"Permissions for the user. The non-admin users are authorized to do actions based a set of permissions in order to access Mambu features. Permissions may be relevant for the API and/or the Mambu UI.","items":{"enum":["AUDIT_TRANSACTIONS","VIEW_COMMENTS","CREATE_COMMENTS","EDIT_COMMENTS","DELETE_COMMENTS","CREATE_INDEX_RATE","DOWNLOAD_BACKUPS","IMPORT_DATA","VIEW_BACKGROUND_TASKS","VIEW_EXCHANGE_RATES","CREATE_EXCHANGE_RATE","VIEW_CENTRE_DETAILS","CREATE_CENTRE","EDIT_CENTRE","DELETE_CENTRE","MANAGE_CONFIGURATION_AS_CODE","GET_MANAGE_CONFIGURATION_AS_CODE","PUT_MANAGE_CONFIGURATION_AS_CODE","VIEW_BRANCH_DETAILS","CREATE_BRANCH","EDIT_BRANCH","CREATE_COMMUNICATION_TEMPLATES","EDIT_COMMUNICATION_TEMPLATES","SEND_MANUAL_SMS","SEND_MANUAL_EMAIL","VIEW_COMMUNICATION_HISTORY","RESEND_FAILED_MESSAGES","VIEW_TRANSACTION_CHANNELS","CREATE_TRANSACTION_CHANNELS","EDIT_TRANSACTION_CHANNELS","DELETE_TRANSACTION_CHANNELS","MANAGE_HOLIDAYS","MANAGE_INDEX_RATES","MANAGE_EOD_PROCESSING","MANAGE_INTERNAL_CONTROLS","MANAGE_CURRENCIES","MANAGE_AUTHORIZATION_HOLDS_SETUP","MANAGE_RISK_LEVELS","VIEW_LOAN_PRODUCT_DETAILS","CREATE_LOAN_PRODUCT","EDIT_LOAN_PRODUCT","DELETE_LOAN_PRODUCTS","VIEW_SAVINGS_PRODUCT_DETAILS","CREATE_SAVINGS_PRODUCT","EDIT_SAVINGS_PRODUCT","DELETE_SAVINGS_PRODUCT","CREATE_PRODUCT_DOCUMENT_TEMPLATES","EDIT_PRODUCT_DOCUMENT_TEMPLATES","DELETE_PRODUCT_DOCUMENT_TEMPLATES","VIEW_CLIENT_DETAILS","CREATE_CLIENT","EDIT_CLIENT","DELETE_CLIENTS","APPROVE_CLIENT","REJECT_CLIENT","EXIT_CLIENT","ANONYMIZE_CLIENT","BLACKLIST_CLIENT","UNDO_CLIENT_STATE_CHANGED","EDIT_CLIENT_ID","EDIT_BLACKLISTED_CLIENT_CFV","EDIT_GROUP_ID","CHANGE_CLIENT_TYPE","VIEW_GROUP_DETAILS","CREATE_GROUP","EDIT_GROUP","DELETE_GROUP","CHANGE_GROUP_TYPE","VIEW_LINE_OF_CREDIT_DETAILS","CREATE_LINES_OF_CREDIT","EDIT_LINES_OF_CREDIT","ADD_ACCOUNTS_TO_LINE_OF_CREDIT","REMOVE_ACCOUNTS_FROM_LINE_OF_CREDIT","APPROVE_LINE_OF_CREDIT","UNDO_APPROVE_LINE_OF_CREDIT","WITHDRAW_LINE_OF_CREDIT","UNDO_WITHDRAW_LINE_OF_CREDIT","REJECT_LINE_OF_CREDIT","UNDO_REJECT_LINE_OF_CREDIT","CLOSE_LINES_OF_CREDIT","DELETE_LINES_OF_CREDIT","VIEW_LOAN_ACCOUNT_DETAILS","CREATE_LOAN_ACCOUNT","EDIT_LOAN_ACCOUNT","DELETE_LOAN_ACCOUNT","ENTER_REPAYMENT","EDIT_REPAYMENT_SCHEDULE","APPROVE_LOANS","REQUEST_LOAN_APPROVAL","DIBURSE_LOANS","WITHDRAW_LOAN_ACCOUNTS","UNDO_WITHDRAW_LOAN_ACCOUNTS","SET_LOAN_INCOMPLETE","REJECT_LOANS","UNDO_REJECT_LOANS","CLOSE_LOAN_ACCOUNTS","WRITE_OFF_LOAN_ACCOUNTS","TERMINATE_LOAN_ACCOUNTS","PAY_OFF_LOAN","UNDO_LOAN_ACCOUNT_CLOSURE","REVERSE_LOAN_ACCOUNT_WRITE_OFF","REFINANCE_LOAN_ACCOUNT","RESCHEDULE_LOAN_ACCOUNT","APPLY_ACCRUED_LOAN_INTEREST","APPLY_LOAN_FEES","APPLY_LOAN_ADJUSTMENTS","EDIT_PLANNED_FEES","BACKDATE_LOAN_TRANSACTIONS","LINK_ACCOUNTS","COLLECT_GUARANTIES","VIEW_SECURITIES_DETAILS","CREATE_SECURITIES","EDIT_SECURITIES","DELETE_SECURITIES","LOCK_LOAN_ACCOUNTS","POST_TRANSACTIONS_ON_LOCKED_LOAN_ACCOUNTS","EDIT_LOAN_TRANCHES","EDIT_PENALTY_RATE","SET_DISBURSEMENT_CONDITIONS","EDIT_LOAN_TRANSACTIONS","BULK_LOAN_CORRECTIONS","EDIT_INTEREST_RATE","EDIT_REPAYMENT_METHOD_VALUE","EDIT_PERIODIC_PAYMENT_FOR_ACTIVE_ACCOUNT","MANAGE_LOAN_ASSOCIATION","MAKE_WITHDRAWAL_REDRAW","VIEW_SAVINGS_ACCOUNT_DETAILS","CREATE_SAVINGS_ACCOUNT","EDIT_SAVINGS_ACCOUNT","DELETE_SAVINGS_ACCOUNT","MAKE_DEPOSIT","MAKE_BULK_DEPOSITS","MAKE_WITHDRAWAL","MAKE_EARLY_WITHDRAWALS","APPROVE_SAVINGS","ACTIVATE_MATURITY","UNDO_MATURITY","CLOSE_SAVINGS_ACCOUNTS","APPLY_SAVINGS_FEES","REOPEN_SAVINGS_ACCOUNT","APPLY_SAVINGS_ADJUSTMENTS","LOCK_SAVINGS_ACCOUNT","UNLOCK_SAVINGS_ACCOUNT","REVERSE_SAVINGS_ACCOUNT_WRITE_OFF","BACKDATE_SAVINGS_TRANSACTIONS","MAKE_TRANSFER","MAKE_INTER_CLIENTS_TRANSFERS","POST_TRANSACTIONS_ON_DORMANT_ACCOUNTS","APPLY_ACCRUED_SAVINGS_INTEREST","EDIT_SAVINGS_TRANSACTIONS","BULK_DEPOSIT_CORRECTIONS","BLOCK_AND_SEIZE_FUNDS","WITHDRAW_BLOCKED_FUNDS","MANAGE_DEPOSIT_ACCOUNT_RECIPIENT","MANAGE_DEPOSIT_ASSOCIATION","CREATE_CARDS","VIEW_CARDS","DELETE_CARDS","REVERSE_CARD_WITHDRAWAL_TRANSACTION","REVERSE_CARD_TRANSACTION","CARD_BALANCE_INQUIRY","CREATE_AUTHORIZATION_HOLD","UPDATE_AUTHORIZATION_HOLD","VIEW_AUTHORIZATION_HOLD","CREATE_CARD_TRANSACTION","CREATE_ACCOUNT_HOLD","UPDATE_ACCOUNT_HOLD","VIEW_ACCOUNT_HOLD","VIEW_DOCUMENTS","CREATE_DOCUMENTS","EDIT_DOCUMENTS","DELETE_DOCUMENTS","VIEW_TASK","CREATE_TASK","EDIT_TASK","DELETE_TASK","VIEW_INTELLIGENCE","VIEW_REPORTS","CREATE_REPORTS","EDIT_REPORTS","DELETE_REPORTS","VIEW_JASPER_REPORTS","CREATE_JASPER_REPORTS","EDIT_JASPER_REPORTS","DELETE_JASPER_REPORTS","VIEW_CHART_OF_ACCOUNTS","MANAGE_ACCOUNTS","VIEW_JOURNAL_ENTRIES","LOG_JOURNAL_ENTRIES","VIEW_ACCOUNTING_REPORTS","MAKE_ACCOUNTING_CLOSURE","APPLY_ACCOUNTING_ADJUSTMENTS","BOOKING_DATE_LOANS_GL","BOOKING_DATE_SAVINGS_GL","RECTIFY_ADJUSTMENT","MANAGE_INTERBRANCH_GLACCOUNT_RULES","VIEW_ACCOUNTING_RATES","CREATE_ACCOUNTING_RATES","OPEN_TILL","CLOSE_TILL","ADD_CASH","REMOVE_CASH","POST_TRANSACTIONS_WITHOUT_OPENED_TILL","VIEW_INVESTOR_FUNDS_DETAILS","CREATE_INVESTOR_FUNDS","EDIT_INVESTOR_FUNDS","DELETE_INVESTOR_FUNDS","SELL_LOAN_FRACTION","CREATE_USER","EDIT_USER","VIEW_USER_DETAILS","DELETE_USER","MANAGE_TWO_FACTOR_AUTHENTICATION","MANAGE_CLIENT_ASSOCIATION","MANAGE_GROUP_ASSOCIATION","EDIT_PRINCIPAL_PAYMENT_ACTIVE_REVOLVING_CREDIT","PERFORM_REPAYMENTS_WITH_CUSTOM_AMOUNTS_ALLOCATION","EXPORT_TO_EXCEL","VIEW_ADMINISTRATION_DETAILS","MANAGE_EVENTS_STREAMING","MANAGE_PAYMENTS","MANAGE_AUDIT_TRAIL","MANAGE_APPS","MANAGE_CARDS_CAPABILITY","MANAGE_NOTIFICATIONS","ADMIN","CREATE_ROLE","EDIT_ROLE","DELETE_ROLE","VIEW_ROLE","MANAGE_FEDERATED_AUTHENTICATION","MANAGE_ACCESS_PREFERENCES","VIEW_API_CONSUMERS_AND_KEYS","CREATE_API_CONSUMERS_AND_KEYS","EDIT_API_CONSUMERS_AND_KEYS","DELETE_API_CONSUMERS_AND_KEYS","VIEW_CUSTOM_FIELD","CREATE_CUSTOM_FIELD","EDIT_CUSTOM_FIELD","DELETE_CUSTOM_FIELD","VIEW_MAMBU_FUNCTIONS","CREATE_MAMBU_FUNCTIONS","EDIT_MAMBU_FUNCTIONS","DELETE_MAMBU_FUNCTIONS","VIEW_MAMBU_FUNCTIONS_SECRETS","CREATE_MAMBU_FUNCTIONS_SECRETS","EDIT_MAMBU_FUNCTIONS_SECRETS","DELETE_MAMBU_FUNCTIONS_SECRETS","VIEW_CURRENT_USER_DETAILS","VIEW_PROFIT_SHARING_CLASSES","CREATE_PROFIT_SHARING_CLASSES","EDIT_PROFIT_SHARING_CLASSES","DELETE_PROFIT_SHARING_CLASSES","VIEW_PROFIT_SHARING_POOLS","CREATE_PROFIT_SHARING_POOLS","EDIT_PROFIT_SHARING_POOLS","DELETE_PROFIT_SHARING_POOLS","VIEW_PROFIT_SHARING_INCOME_CATEGORIES","CREATE_PROFIT_SHARING_INCOME_CATEGORIES","EDIT_PROFIT_SHARING_INCOME_CATEGORIES","DELETE_PROFIT_SHARING_INCOME_CATEGORIES","VIEW_PROFIT_SHARING_EXPENSES","CREATE_PROFIT_SHARING_EXPENSES","EDIT_PROFIT_SHARING_EXPENSES","DELETE_PROFIT_SHARING_EXPENSES","VIEW_PROFIT_SHARING_DEDUCTIONS","CREATE_PROFIT_SHARING_DEDUCTIONS","EDIT_PROFIT_SHARING_DEDUCTIONS","DELETE_PROFIT_SHARING_DEDUCTIONS","VIEW_PROFIT_SHARING_PROPOSALS","EDIT_PROFIT_SHARING_PROPOSALS","CREATE_PROFIT_SHARING_PROPOSALS","APPROVE_PROFIT_SHARING_PROPOSALS","ADJUST_PROFIT_SHARING_PROPOSALS","TRIGGER_COMPUTATION","VIEW_PROFIT_SHARING_SYSTEM_OPTIONS","CREATE_PROFIT_SHARING_SYSTEM_OPTIONS","EDIT_PROFIT_SHARING_SYSTEM_OPTIONS","DELETE_PROFIT_SHARING_SYSTEM_OPTIONS","VIEW_PROFIT_SHARING_DEPOSIT_PRODUCTS","EDIT_PROFIT_SHARING_DEPOSIT_PRODUCT_LINK","VIEW_PROFIT_SHARING_ACCOUNTS_SETTINGS","CREATE_PROFIT_SHARING_ACCOUNT_SETTINGS","EDIT_PROFIT_SHARING_ACCOUNT_SETTINGS","VIEW_PROFIT_SHARING_GL_ACCOUNTS","VIEW_PROFIT_SHARING_BRANCHES","MAKE_BULK_CHANGE_INTEREST_AVAILABILITY"]}},"supportAccess":{"type":"boolean","description":"`TRUE` if the user can provide Mambu technical support, `FALSE` otherwise."},"tellerAccess":{"type":"boolean","description":"`TRUE` if the user has the teller user type, `FALSE` otherwise. Tellers have access to the teller module and specific tellering permissions, which allow them to take actions such as opening or closing tills, posting transactions on a till, and adding and removing cash from a till."}},"required":["canManageAllBranches","canManageEntitiesAssignedToOtherOfficers"],"additionalProperties":true},"UserManagedBranch":{"type":"object","description":"Represents a branch that can be managed by the user or API consumer.","properties":{"branchKey":{"type":"string","description":"The encoded key of the branch, it is automatically generated."}},"additionalProperties":true},"RoleIdentifier":{"type":"object","description":"Represents the role identifier.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated automatically, globally unique."},"id":{"type":"string","description":"The ID of the role, which can be generated and customized, but must be unique."}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents a user.","properties":{"access":{"$ref":"#/$defs/UserAccess"},"assignedBranchKey":{"type":"string","description":"The encoded key of the branch this user is assigned to."},"creationDate":{"type":"string","description":"The date the user was created in UTC.","format":"date-time"},"email":{"type":"string","description":"The user email address. Used by Mambu for sending automated notifications or for getting passwords."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"firstName":{"type":"string","description":"The first name of the user."},"homePhone":{"type":"string","description":"The user's home phone number, which can also contain characters."},"id":{"type":"string","description":"The ID of the user, which is generated automatically, but must be unique."},"language":{"description":"The Mambu display language for the user. The Mambu UI will be displayed in the selected language. Please note: for portuguese, you must use the incorrect spelling `PORTUGESE`.","enum":["ENGLISH","PORTUGESE","SPANISH","RUSSIAN","FRENCH","GEORGIAN","CHINESE","INDONESIAN","ROMANIAN","BURMESE","GERMAN","PORTUGUESE_BRAZIL","VIETNAMESE","ITALIAN","THAI","NORWEGIAN","PHRASE"]},"lastLoggedInDate":{"type":"string","description":"The last time the user logged in in UTC.","format":"date-time"},"lastModifiedDate":{"type":"string","description":"The last time the user was modified in UTC.","format":"date-time"},"lastName":{"type":"string","description":"The last name of the user."},"mobilePhone":{"type":"string","description":"The user's mobile phone number, which can also contain characters."},"notes":{"type":"string","description":"The additional information for the user."},"role":{"$ref":"#/$defs/RoleIdentifier"},"title":{"type":"string","description":"The user title."},"transactionLimits":{"type":"object","description":"The user transaction limits.","additionalProperties":{"type":"integer"}},"twoFactorAuthentication":{"type":"boolean","description":"`TRUE` if the user has two-factor authentication setup, `FALSE` otherwise. If two-factor authentication is enabled, a user will be sent an SMS to their registered mobile number, which they will need to enter in the Mambu login screen, in addition to their password."},"username":{"type":"string","description":"The Mambu login user name."},"userState":{"description":"The current state of the user.","enum":["ACTIVE","INACTIVE","LOCKED"]}},"required":["access","firstName","username"],"additionalProperties":true};const schema15 = {"type":"object","description":"Represents the role identifier.","properties":{"encodedKey":{"type":"string","description":"The encoded key of the entity, generated automatically, globally unique."},"id":{"type":"string","description":"The ID of the role, which can be generated and customized, but must be unique."}},"additionalProperties":true};const schema13 = {"type":"object","description":"Represents the user permissions and access rights.","properties":{"administratorAccess":{"type":"boolean","description":"`TRUE` if the user has the administrator user type, `FALSE` otherwise. Administrators (admins) have all permissions and can perform any action in Mambu."},"apiAccess":{"type":"boolean","description":"`TRUE` if the user can authenticate and interact with Mambu APIs, `FALSE` otherwise. The user may still require additional permissions for specific API requests."},"canManageAllBranches":{"type":"boolean","description":"`TRUE` if the user has access to all branches, `FALSE` if the user only has access to specific branches."},"canManageEntitiesAssignedToOtherOfficers":{"type":"boolean","description":"`TRUE` if a credit officer user can access entities (for example, clients or accounts) assigned to other credit officers, `FALSE` otherwise."},"creditOfficerAccess":{"type":"boolean","description":"`TRUE` if the user has the credit officer user type, `FALSE` otherwise. Credit officers have the option of having clients and groups assigned to them."},"deliveryAccess":{"type":"boolean","description":"`TRUE` if the user is part of the Mambu delivery team, `FALSE` otherwise."},"mambuAccess":{"type":"boolean","description":"TRUE` if the user can log in to the Mambu UI using their login credentials, `FALSE` otherwise."},"managedBranches":{"type":"array","description":"The list of branches that can be managed by the user. If the user has the `canManageAllBranches` property set to `TRUE`, this list does not apply.","items":{"$ref":"#/$defs/UserManagedBranch"}},"permissions":{"type":"array","description":"Permissions for the user. The non-admin users are authorized to do actions based a set of permissions in order to access Mambu features. Permissions may be relevant for the API and/or the Mambu UI.","items":{"enum":["AUDIT_TRANSACTIONS","VIEW_COMMENTS","CREATE_COMMENTS","EDIT_COMMENTS","DELETE_COMMENTS","CREATE_INDEX_RATE","DOWNLOAD_BACKUPS","IMPORT_DATA","VIEW_BACKGROUND_TASKS","VIEW_EXCHANGE_RATES","CREATE_EXCHANGE_RATE","VIEW_CENTRE_DETAILS","CREATE_CENTRE","EDIT_CENTRE","DELETE_CENTRE","MANAGE_CONFIGURATION_AS_CODE","GET_MANAGE_CONFIGURATION_AS_CODE","PUT_MANAGE_CONFIGURATION_AS_CODE","VIEW_BRANCH_DETAILS","CREATE_BRANCH","EDIT_BRANCH","CREATE_COMMUNICATION_TEMPLATES","EDIT_COMMUNICATION_TEMPLATES","SEND_MANUAL_SMS","SEND_MANUAL_EMAIL","VIEW_COMMUNICATION_HISTORY","RESEND_FAILED_MESSAGES","VIEW_TRANSACTION_CHANNELS","CREATE_TRANSACTION_CHANNELS","EDIT_TRANSACTION_CHANNELS","DELETE_TRANSACTION_CHANNELS","MANAGE_HOLIDAYS","MANAGE_INDEX_RATES","MANAGE_EOD_PROCESSING","MANAGE_INTERNAL_CONTROLS","MANAGE_CURRENCIES","MANAGE_AUTHORIZATION_HOLDS_SETUP","MANAGE_RISK_LEVELS","VIEW_LOAN_PRODUCT_DETAILS","CREATE_LOAN_PRODUCT","EDIT_LOAN_PRODUCT","DELETE_LOAN_PRODUCTS","VIEW_SAVINGS_PRODUCT_DETAILS","CREATE_SAVINGS_PRODUCT","EDIT_SAVINGS_PRODUCT","DELETE_SAVINGS_PRODUCT","CREATE_PRODUCT_DOCUMENT_TEMPLATES","EDIT_PRODUCT_DOCUMENT_TEMPLATES","DELETE_PRODUCT_DOCUMENT_TEMPLATES","VIEW_CLIENT_DETAILS","CREATE_CLIENT","EDIT_CLIENT","DELETE_CLIENTS","APPROVE_CLIENT","REJECT_CLIENT","EXIT_CLIENT","ANONYMIZE_CLIENT","BLACKLIST_CLIENT","UNDO_CLIENT_STATE_CHANGED","EDIT_CLIENT_ID","EDIT_BLACKLISTED_CLIENT_CFV","EDIT_GROUP_ID","CHANGE_CLIENT_TYPE","VIEW_GROUP_DETAILS","CREATE_GROUP","EDIT_GROUP","DELETE_GROUP","CHANGE_GROUP_TYPE","VIEW_LINE_OF_CREDIT_DETAILS","CREATE_LINES_OF_CREDIT","EDIT_LINES_OF_CREDIT","ADD_ACCOUNTS_TO_LINE_OF_CREDIT","REMOVE_ACCOUNTS_FROM_LINE_OF_CREDIT","APPROVE_LINE_OF_CREDIT","UNDO_APPROVE_LINE_OF_CREDIT","WITHDRAW_LINE_OF_CREDIT","UNDO_WITHDRAW_LINE_OF_CREDIT","REJECT_LINE_OF_CREDIT","UNDO_REJECT_LINE_OF_CREDIT","CLOSE_LINES_OF_CREDIT","DELETE_LINES_OF_CREDIT","VIEW_LOAN_ACCOUNT_DETAILS","CREATE_LOAN_ACCOUNT","EDIT_LOAN_ACCOUNT","DELETE_LOAN_ACCOUNT","ENTER_REPAYMENT","EDIT_REPAYMENT_SCHEDULE","APPROVE_LOANS","REQUEST_LOAN_APPROVAL","DIBURSE_LOANS","WITHDRAW_LOAN_ACCOUNTS","UNDO_WITHDRAW_LOAN_ACCOUNTS","SET_LOAN_INCOMPLETE","REJECT_LOANS","UNDO_REJECT_LOANS","CLOSE_LOAN_ACCOUNTS","WRITE_OFF_LOAN_ACCOUNTS","TERMINATE_LOAN_ACCOUNTS","PAY_OFF_LOAN","UNDO_LOAN_ACCOUNT_CLOSURE","REVERSE_LOAN_ACCOUNT_WRITE_OFF","REFINANCE_LOAN_ACCOUNT","RESCHEDULE_LOAN_ACCOUNT","APPLY_ACCRUED_LOAN_INTEREST","APPLY_LOAN_FEES","APPLY_LOAN_ADJUSTMENTS","EDIT_PLANNED_FEES","BACKDATE_LOAN_TRANSACTIONS","LINK_ACCOUNTS","COLLECT_GUARANTIES","VIEW_SECURITIES_DETAILS","CREATE_SECURITIES","EDIT_SECURITIES","DELETE_SECURITIES","LOCK_LOAN_ACCOUNTS","POST_TRANSACTIONS_ON_LOCKED_LOAN_ACCOUNTS","EDIT_LOAN_TRANCHES","EDIT_PENALTY_RATE","SET_DISBURSEMENT_CONDITIONS","EDIT_LOAN_TRANSACTIONS","BULK_LOAN_CORRECTIONS","EDIT_INTEREST_RATE","EDIT_REPAYMENT_METHOD_VALUE","EDIT_PERIODIC_PAYMENT_FOR_ACTIVE_ACCOUNT","MANAGE_LOAN_ASSOCIATION","MAKE_WITHDRAWAL_REDRAW","VIEW_SAVINGS_ACCOUNT_DETAILS","CREATE_SAVINGS_ACCOUNT","EDIT_SAVINGS_ACCOUNT","DELETE_SAVINGS_ACCOUNT","MAKE_DEPOSIT","MAKE_BULK_DEPOSITS","MAKE_WITHDRAWAL","MAKE_EARLY_WITHDRAWALS","APPROVE_SAVINGS","ACTIVATE_MATURITY","UNDO_MATURITY","CLOSE_SAVINGS_ACCOUNTS","APPLY_SAVINGS_FEES","REOPEN_SAVINGS_ACCOUNT","APPLY_SAVINGS_ADJUSTMENTS","LOCK_SAVINGS_ACCOUNT","UNLOCK_SAVINGS_ACCOUNT","REVERSE_SAVINGS_ACCOUNT_WRITE_OFF","BACKDATE_SAVINGS_TRANSACTIONS","MAKE_TRANSFER","MAKE_INTER_CLIENTS_TRANSFERS","POST_TRANSACTIONS_ON_DORMANT_ACCOUNTS","APPLY_ACCRUED_SAVINGS_INTEREST","EDIT_SAVINGS_TRANSACTIONS","BULK_DEPOSIT_CORRECTIONS","BLOCK_AND_SEIZE_FUNDS","WITHDRAW_BLOCKED_FUNDS","MANAGE_DEPOSIT_ACCOUNT_RECIPIENT","MANAGE_DEPOSIT_ASSOCIATION","CREATE_CARDS","VIEW_CARDS","DELETE_CARDS","REVERSE_CARD_WITHDRAWAL_TRANSACTION","REVERSE_CARD_TRANSACTION","CARD_BALANCE_INQUIRY","CREATE_AUTHORIZATION_HOLD","UPDATE_AUTHORIZATION_HOLD","VIEW_AUTHORIZATION_HOLD","CREATE_CARD_TRANSACTION","CREATE_ACCOUNT_HOLD","UPDATE_ACCOUNT_HOLD","VIEW_ACCOUNT_HOLD","VIEW_DOCUMENTS","CREATE_DOCUMENTS","EDIT_DOCUMENTS","DELETE_DOCUMENTS","VIEW_TASK","CREATE_TASK","EDIT_TASK","DELETE_TASK","VIEW_INTELLIGENCE","VIEW_REPORTS","CREATE_REPORTS","EDIT_REPORTS","DELETE_REPORTS","VIEW_JASPER_REPORTS","CREATE_JASPER_REPORTS","EDIT_JASPER_REPORTS","DELETE_JASPER_REPORTS","VIEW_CHART_OF_ACCOUNTS","MANAGE_ACCOUNTS","VIEW_JOURNAL_ENTRIES","LOG_JOURNAL_ENTRIES","VIEW_ACCOUNTING_REPORTS","MAKE_ACCOUNTING_CLOSURE","APPLY_ACCOUNTING_ADJUSTMENTS","BOOKING_DATE_LOANS_GL","BOOKING_DATE_SAVINGS_GL","RECTIFY_ADJUSTMENT","MANAGE_INTERBRANCH_GLACCOUNT_RULES","VIEW_ACCOUNTING_RATES","CREATE_ACCOUNTING_RATES","OPEN_TILL","CLOSE_TILL","ADD_CASH","REMOVE_CASH","POST_TRANSACTIONS_WITHOUT_OPENED_TILL","VIEW_INVESTOR_FUNDS_DETAILS","CREATE_INVESTOR_FUNDS","EDIT_INVESTOR_FUNDS","DELETE_INVESTOR_FUNDS","SELL_LOAN_FRACTION","CREATE_USER","EDIT_USER","VIEW_USER_DETAILS","DELETE_USER","MANAGE_TWO_FACTOR_AUTHENTICATION","MANAGE_CLIENT_ASSOCIATION","MANAGE_GROUP_ASSOCIATION","EDIT_PRINCIPAL_PAYMENT_ACTIVE_REVOLVING_CREDIT","PERFORM_REPAYMENTS_WITH_CUSTOM_AMOUNTS_ALLOCATION","EXPORT_TO_EXCEL","VIEW_ADMINISTRATION_DETAILS","MANAGE_EVENTS_STREAMING","MANAGE_PAYMENTS","MANAGE_AUDIT_TRAIL","MANAGE_APPS","MANAGE_CARDS_CAPABILITY","MANAGE_NOTIFICATIONS","ADMIN","CREATE_ROLE","EDIT_ROLE","DELETE_ROLE","VIEW_ROLE","MANAGE_FEDERATED_AUTHENTICATION","MANAGE_ACCESS_PREFERENCES","VIEW_API_CONSUMERS_AND_KEYS","CREATE_API_CONSUMERS_AND_KEYS","EDIT_API_CONSUMERS_AND_KEYS","DELETE_API_CONSUMERS_AND_KEYS","VIEW_CUSTOM_FIELD","CREATE_CUSTOM_FIELD","EDIT_CUSTOM_FIELD","DELETE_CUSTOM_FIELD","VIEW_MAMBU_FUNCTIONS","CREATE_MAMBU_FUNCTIONS","EDIT_MAMBU_FUNCTIONS","DELETE_MAMBU_FUNCTIONS","VIEW_MAMBU_FUNCTIONS_SECRETS","CREATE_MAMBU_FUNCTIONS_SECRETS","EDIT_MAMBU_FUNCTIONS_SECRETS","DELETE_MAMBU_FUNCTIONS_SECRETS","VIEW_CURRENT_USER_DETAILS","VIEW_PROFIT_SHARING_CLASSES","CREATE_PROFIT_SHARING_CLASSES","EDIT_PROFIT_SHARING_CLASSES","DELETE_PROFIT_SHARING_CLASSES","VIEW_PROFIT_SHARING_POOLS","CREATE_PROFIT_SHARING_POOLS","EDIT_PROFIT_SHARING_POOLS","DELETE_PROFIT_SHARING_POOLS","VIEW_PROFIT_SHARING_INCOME_CATEGORIES","CREATE_PROFIT_SHARING_INCOME_CATEGORIES","EDIT_PROFIT_SHARING_INCOME_CATEGORIES","DELETE_PROFIT_SHARING_INCOME_CATEGORIES","VIEW_PROFIT_SHARING_EXPENSES","CREATE_PROFIT_SHARING_EXPENSES","EDIT_PROFIT_SHARING_EXPENSES","DELETE_PROFIT_SHARING_EXPENSES","VIEW_PROFIT_SHARING_DEDUCTIONS","CREATE_PROFIT_SHARING_DEDUCTIONS","EDIT_PROFIT_SHARING_DEDUCTIONS","DELETE_PROFIT_SHARING_DEDUCTIONS","VIEW_PROFIT_SHARING_PROPOSALS","EDIT_PROFIT_SHARING_PROPOSALS","CREATE_PROFIT_SHARING_PROPOSALS","APPROVE_PROFIT_SHARING_PROPOSALS","ADJUST_PROFIT_SHARING_PROPOSALS","TRIGGER_COMPUTATION","VIEW_PROFIT_SHARING_SYSTEM_OPTIONS","CREATE_PROFIT_SHARING_SYSTEM_OPTIONS","EDIT_PROFIT_SHARING_SYSTEM_OPTIONS","DELETE_PROFIT_SHARING_SYSTEM_OPTIONS","VIEW_PROFIT_SHARING_DEPOSIT_PRODUCTS","EDIT_PROFIT_SHARING_DEPOSIT_PRODUCT_LINK","VIEW_PROFIT_SHARING_ACCOUNTS_SETTINGS","CREATE_PROFIT_SHARING_ACCOUNT_SETTINGS","EDIT_PROFIT_SHARING_ACCOUNT_SETTINGS","VIEW_PROFIT_SHARING_GL_ACCOUNTS","VIEW_PROFIT_SHARING_BRANCHES","MAKE_BULK_CHANGE_INTEREST_AVAILABILITY"]}},"supportAccess":{"type":"boolean","description":"`TRUE` if the user can provide Mambu technical support, `FALSE` otherwise."},"tellerAccess":{"type":"boolean","description":"`TRUE` if the user has the teller user type, `FALSE` otherwise. Tellers have access to the teller module and specific tellering permissions, which allow them to take actions such as opening or closing tills, posting transactions on a till, and adding and removing cash from a till."}},"required":["canManageAllBranches","canManageEntitiesAssignedToOtherOfficers"],"additionalProperties":true};const schema14 = {"type":"object","description":"Represents a branch that can be managed by the user or API consumer.","properties":{"branchKey":{"type":"string","description":"The encoded key of the branch, it is automatically generated."}},"additionalProperties":true};const func0 = (ajvDistRuntimeEqualDefault.default ?? ajvDistRuntimeEqualDefault);function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.canManageAllBranches === undefined) && (missing0 = "canManageAllBranches")) || ((data.canManageEntitiesAssignedToOtherOfficers === undefined) && (missing0 = "canManageEntitiesAssignedToOtherOfficers"))){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.administratorAccess !== undefined){const _errs2 = errors;if(typeof data.administratorAccess !== "boolean"){validate12.errors = [{instancePath:instancePath+"/administratorAccess",schemaPath:"#/properties/administratorAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.apiAccess !== undefined){const _errs4 = errors;if(typeof data.apiAccess !== "boolean"){validate12.errors = [{instancePath:instancePath+"/apiAccess",schemaPath:"#/properties/apiAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.canManageAllBranches !== undefined){const _errs6 = errors;if(typeof data.canManageAllBranches !== "boolean"){validate12.errors = [{instancePath:instancePath+"/canManageAllBranches",schemaPath:"#/properties/canManageAllBranches/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.canManageEntitiesAssignedToOtherOfficers !== undefined){const _errs8 = errors;if(typeof data.canManageEntitiesAssignedToOtherOfficers !== "boolean"){validate12.errors = [{instancePath:instancePath+"/canManageEntitiesAssignedToOtherOfficers",schemaPath:"#/properties/canManageEntitiesAssignedToOtherOfficers/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.creditOfficerAccess !== undefined){const _errs10 = errors;if(typeof data.creditOfficerAccess !== "boolean"){validate12.errors = [{instancePath:instancePath+"/creditOfficerAccess",schemaPath:"#/properties/creditOfficerAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.deliveryAccess !== undefined){const _errs12 = errors;if(typeof data.deliveryAccess !== "boolean"){validate12.errors = [{instancePath:instancePath+"/deliveryAccess",schemaPath:"#/properties/deliveryAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.mambuAccess !== undefined){const _errs14 = errors;if(typeof data.mambuAccess !== "boolean"){validate12.errors = [{instancePath:instancePath+"/mambuAccess",schemaPath:"#/properties/mambuAccess/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.managedBranches !== undefined){let data7 = data.managedBranches;const _errs16 = errors;if(errors === _errs16){if(Array.isArray(data7)){var valid1 = true;const len0 = data7.length;for(let i0=0; i0