diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 0fee436..0000000 --- a/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -.* -node_modules - -!.github -!.vscode - -!.eslintrc.* diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index f00fe35..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@skyleague/node-standards/.eslintrc.base.cjs') diff --git a/.gitignore b/.gitignore index d8c9d4f..5845916 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ .* __pycache__ node_modules -yalc.lock !.github !.vscode @@ -10,6 +9,3 @@ yalc.lock !.gitignore !.gitkeep -!.eslintrc.* -!.prettierignore -!.eslintignore diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index f0bd5fa..0000000 --- a/.prettierignore +++ /dev/null @@ -1,11 +0,0 @@ -.* -node_modules -**/*.schema.js - -!.github -!.vscode -!.npmrc - -!.gitignore -!.gitkeep -!.eslintrc.* diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..c9b702f --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["biomejs.biome"], + "unwantedRecommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 2eb6c44..650287b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,20 +1,16 @@ { - "[json]": { - "editor.tabSize": 2 - }, "debug.javascript.terminalOptions": { "remoteRoot": null, "skipFiles": ["/**"], "sourceMaps": true }, "editor.codeActionsOnSave": { - "source.fixAll.eslint": "always" + "source.organizeImports.biome": "explicit", + "quickfix.biome": "explicit" }, + "editor.defaultFormatter": "biomejs.biome", "editor.formatOnSave": true, "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?", - "eslint.format.enable": true, - "eslint.lintTask.enable": true, - "eslint.validate": ["javascript", "typescript"], "files.eol": "\n", "files.exclude": { "**/.coverage": true, @@ -35,7 +31,6 @@ "**/node_modules/*/**": true, "src/**/*.d.ts": true }, - "typescript.format.semicolons": "remove", "typescript.implementationsCodeLens.enabled": true, "typescript.preferences.autoImportFileExcludePatterns": ["**/index.ts"], "typescript.referencesCodeLens.enabled": true, diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..6ba2cf6 --- /dev/null +++ b/biome.json @@ -0,0 +1,3 @@ +{ + "extends": ["@skyleague/node-standards/biome"] +} diff --git a/build.config.ts b/build.config.ts deleted file mode 100644 index 0cb7830..0000000 --- a/build.config.ts +++ /dev/null @@ -1,24 +0,0 @@ -import glob from 'fast-glob' - -import { execFileSync } from 'node:child_process' -import fs from 'node:fs' -import path from 'node:path' -import { fileURLToPath } from 'node:url' - -const __dirname = path.dirname(fileURLToPath(import.meta.url)) -const distDir = '.dist' -async function main() { - execFileSync(`rm`, ['-rf', distDir], { stdio: 'inherit', cwd: __dirname }) - execFileSync('npx', ['tsc', '-p', 'tsconfig.dist.json'], { stdio: 'inherit', cwd: __dirname }) - - const srcDir = path.join(__dirname, 'src') - await Promise.all( - [...new Set((await glob(path.join(srcDir, '**/*.schema.js'))).map((x) => path.dirname(x)))].map((d) => - fs.promises.cp(d, path.join(__dirname, distDir, path.relative(srcDir, d)), { recursive: true }) - ) - ) -} -main().catch((err) => { - console.error(err) - process.exit(1) -}) diff --git a/commitlint.config.cjs b/commitlint.config.cjs deleted file mode 100644 index 5c84425..0000000 --- a/commitlint.config.cjs +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@skyleague/node-standards/commitlint.config.cjs') diff --git a/commitlint.config.ts b/commitlint.config.ts new file mode 100644 index 0000000..7c4ff4d --- /dev/null +++ b/commitlint.config.ts @@ -0,0 +1 @@ +export default { extends: ['@commitlint/config-conventional'] } diff --git a/examples/.gitkeep b/examples/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lint-staged.config.cjs b/lint-staged.config.cjs index 78de6bc..385ecfc 100644 --- a/lint-staged.config.cjs +++ b/lint-staged.config.cjs @@ -1 +1,3 @@ -module.exports = require('@skyleague/node-standards/lint-staged.config.cjs') +module.exports = { + '*': ['biome check --no-errors-on-unmatched --files-ignore-unknown=true --apply-unsafe'], +} diff --git a/package-lock.json b/package-lock.json index 2c14763..a90a0da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,137 +9,56 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "ajv": "^8.12.0", - "split2": "^4.2.0", - "tslib": "^2.6.2" + "ajv": "^8.13.0", + "split2": "^4.2.0" }, "devDependencies": { - "@skyleague/axioms": "^3.6.0", - "@skyleague/node-standards": "^5.1.9", - "@skyleague/therefore": "^4.1.1", + "@skyleague/axioms": "^4.3.3", + "@skyleague/node-standards": "^7.0.2", + "@skyleague/therefore": "^5.5.0", "@types/split2": "^4.2.3", "camelcase": "^8.0.0", - "got": "^14.2.0", - "nock": "^13.5.1", - "typescript": "^5.3.3" + "got": "^14.3.0", + "nock": "^13.5.4", + "typescript": "^5.4.5" }, "engines": { "node": ">=20" }, "peerDependencies": { - "got": "^14.2.0" - } - }, - "node_modules/@aashutoshrathi/word-wrap": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", - "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "got": "^14.3.0" } }, "node_modules/@ampproject/remapping": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", - "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "dev": true, "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@babel/code-frame": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", - "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", + "version": "7.24.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", + "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==", "dev": true, "dependencies": { - "@babel/highlight": "^7.23.4", - "chalk": "^2.4.2" + "@babel/highlight": "^7.24.2", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/code-frame/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/code-frame/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/code-frame/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/helper-string-parser": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", - "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz", + "integrity": "sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ==", "dev": true, "engines": { "node": ">=6.9.0" @@ -155,14 +74,15 @@ } }, "node_modules/@babel/highlight": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", - "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", + "version": "7.24.2", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.2.tgz", + "integrity": "sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.22.20", "chalk": "^2.4.2", - "js-tokens": "^4.0.0" + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" @@ -194,21 +114,6 @@ "node": ">=4" } }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, "node_modules/@babel/highlight/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -240,9 +145,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", - "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", + "version": "7.24.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.4.tgz", + "integrity": "sha512-zTvEBcghmeBma9QIGunWevvBAp4/Qu9Bdq+2k0Ot4fVMD6v3dsC9WOcRSKk7tRRyBM/53yKMJko9xOatGQAwSg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -252,9 +157,9 @@ } }, "node_modules/@babel/types": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", - "integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.0.tgz", + "integrity": "sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.23.4", @@ -271,6 +176,189 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@biomejs/biome": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.7.0.tgz", + "integrity": "sha512-mejiRhnAq6UrXtYvjWJUKdstcT58n0/FfKemFf3d2Ou0HxOdS88HQmWtQ/UgyZvOEPD572YbFTb6IheyROpqkw==", + "dev": true, + "hasInstallScript": true, + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "1.7.0", + "@biomejs/cli-darwin-x64": "1.7.0", + "@biomejs/cli-linux-arm64": "1.7.0", + "@biomejs/cli-linux-arm64-musl": "1.7.0", + "@biomejs/cli-linux-x64": "1.7.0", + "@biomejs/cli-linux-x64-musl": "1.7.0", + "@biomejs/cli-win32-arm64": "1.7.0", + "@biomejs/cli-win32-x64": "1.7.0" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.7.0.tgz", + "integrity": "sha512-12TaeaKHU4SAZt0fQJ2bYk1jUb4foope7LmgDE5p3c0uMxd3mFkg1k7G721T+K6UHYULcSOQDsNNM8DhYi8Irg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.7.0.tgz", + "integrity": "sha512-6Qq1BSIB0cpp0cQNqO/+EiUV7FE3jMpF6w7+AgIBXp0oJxUWb2Ff0RDZdO9bfzkimXD58j0vGpNHMGnCcjDV2Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.7.0.tgz", + "integrity": "sha512-GwSci7xBJ2j1CrdDXDUVXnUtrvypEz/xmiYPpFeVdlX5p95eXx+7FekPPbJfhGGw5WKSsKZ+V8AAlbN+kUwJWw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.7.0.tgz", + "integrity": "sha512-pwIY80nU7SAxrVVZ6HD9ah1pruwh9ZqlSR0Nvbg4ZJqQa0POhiB+RJx7+/1Ml2mTZdrl8kb/YiwQpD16uwb5wg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.7.0.tgz", + "integrity": "sha512-1y+odKQsyHcw0JCGRuqhbx7Y6jxOVSh4lGIVDdJxW1b55yD22DY1kcMEfhUte6f95OIc2uqfkwtiI6xQAiZJdw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.7.0.tgz", + "integrity": "sha512-KzCA0mW4LSbCd7XZWaEJvTOTTBjfJoVEXkfq1fsXxww1HB+ww5PGMbhbIcbYCsj2CTJUifeD5hOkyuBVppU1xQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.7.0.tgz", + "integrity": "sha512-AvLDUYZBpOUFgS/mni4VruIoVV3uSGbKSkZQBPXsHgL0w4KttLll3NBrVanmWxOHsom6C6ocHLyfAY8HUc8TXg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.7.0.tgz", + "integrity": "sha512-Pylm00BAAuLVb40IH9PC17432BTsY8K4pSUvhvgR1eaalnMaD6ug9SYJTTzKDbT6r24MPAGCTiSZERyhGkGzFQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "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", @@ -282,20 +370,17 @@ } }, "node_modules/@commitlint/cli": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-18.6.0.tgz", - "integrity": "sha512-FiH23cr9QG8VdfbmvJJZmdfHGVMCouOOAzoXZ3Cd7czGC52RbycwNt8YCI7SA69pAl+t30vh8LMaO/N+kcel6w==", - "dev": true, - "dependencies": { - "@commitlint/format": "^18.6.0", - "@commitlint/lint": "^18.6.0", - "@commitlint/load": "^18.6.0", - "@commitlint/read": "^18.6.0", - "@commitlint/types": "^18.6.0", - "execa": "^5.0.0", - "lodash.isfunction": "^3.0.9", - "resolve-from": "5.0.0", - "resolve-global": "1.0.0", + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-19.2.2.tgz", + "integrity": "sha512-P8cbOHfg2PQRzfICLSrzUVOCVMqjEZ8Hlth6mtJ4yOEjT47Q5PbIGymgX3rLVylNw+3IAT2Djn9IJ2wHbXFzBg==", + "dev": true, + "dependencies": { + "@commitlint/format": "^19.0.3", + "@commitlint/lint": "^19.2.2", + "@commitlint/load": "^19.2.0", + "@commitlint/read": "^19.2.1", + "@commitlint/types": "^19.0.3", + "execa": "^8.0.1", "yargs": "^17.0.0" }, "bin": { @@ -306,11 +391,12 @@ } }, "node_modules/@commitlint/config-conventional": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-18.6.0.tgz", - "integrity": "sha512-CDCOf2eJz9D/TL44IBks0stM9TmdLCNE2B48owIU3YCadwzts/bobXPScagIgPQF6hhKYMEdj5zpUDlmbwuqwQ==", + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-19.2.2.tgz", + "integrity": "sha512-mLXjsxUVLYEGgzbxbxicGPggDuyWNkf25Ht23owXIH+zV2pv1eJuzLK3t1gDY5Gp6pxdE60jZnWUY5cvgL3ufw==", "dev": true, "dependencies": { + "@commitlint/types": "^19.0.3", "conventional-changelog-conventionalcommits": "^7.0.2" }, "engines": { @@ -318,12 +404,12 @@ } }, "node_modules/@commitlint/config-validator": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-18.6.0.tgz", - "integrity": "sha512-Ptfa865arNozlkjxrYG3qt6wT9AlhNUHeuDyKEZiTL/l0ftncFhK/KN0t/EAMV2tec+0Mwxo0FmhbESj/bI+1g==", + "version": "19.0.3", + "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-19.0.3.tgz", + "integrity": "sha512-2D3r4PKjoo59zBc2auodrSCaUnCSALCx54yveOFwwP/i2kfEAQrygwOleFWswLqK0UL/F9r07MFi5ev2ohyM4Q==", "dev": true, "dependencies": { - "@commitlint/types": "^18.6.0", + "@commitlint/types": "^19.0.3", "ajv": "^8.11.0" }, "engines": { @@ -331,12 +417,12 @@ } }, "node_modules/@commitlint/ensure": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-18.6.0.tgz", - "integrity": "sha512-xY07NmOBJ7JuhX3tic021PaeLepZARIQyqpAQoNQZoml1keBFfB6MbA7XlWZv0ebbarUFE4yhKxOPw+WFv7/qw==", + "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==", "dev": true, "dependencies": { - "@commitlint/types": "^18.6.0", + "@commitlint/types": "^19.0.3", "lodash.camelcase": "^4.3.0", "lodash.kebabcase": "^4.1.1", "lodash.snakecase": "^4.1.1", @@ -348,120 +434,92 @@ } }, "node_modules/@commitlint/execute-rule": { - "version": "18.4.4", - "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-18.4.4.tgz", - "integrity": "sha512-a37Nd3bDQydtg9PCLLWM9ZC+GO7X5i4zJvrggJv5jBhaHsXeQ9ZWdO6ODYR+f0LxBXXNYK3geYXJrCWUCP8JEg==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-19.0.0.tgz", + "integrity": "sha512-mtsdpY1qyWgAO/iOK0L6gSGeR7GFcdW7tIjcNFxcWkfLDF5qVbPHKuGATFqRMsxcO8OUKNj0+3WOHB7EHm4Jdw==", "dev": true, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/format": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-18.6.0.tgz", - "integrity": "sha512-8UNWfs2slPPSQiiVpLGJTnPHv7Jkd5KYxfbNXbmLL583bjom4RrylvyrCVnmZReA8nNad7pPXq6mDH4FNVj6xg==", + "version": "19.0.3", + "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-19.0.3.tgz", + "integrity": "sha512-QjjyGyoiVWzx1f5xOteKHNLFyhyweVifMgopozSgx1fGNrGV8+wp7k6n1t6StHdJ6maQJ+UUtO2TcEiBFRyR6Q==", "dev": true, "dependencies": { - "@commitlint/types": "^18.6.0", - "chalk": "^4.1.0" + "@commitlint/types": "^19.0.3", + "chalk": "^5.3.0" }, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/is-ignored": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-18.6.0.tgz", - "integrity": "sha512-Xjx/ZyyJ4FdLuz0FcOvqiqSFgiO2yYj3QN9XlvyrxqbXTxPVC7QFEXJYBVPulUSN/gR7WXH1Udw+HYYfD17xog==", + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-19.2.2.tgz", + "integrity": "sha512-eNX54oXMVxncORywF4ZPFtJoBm3Tvp111tg1xf4zWXGfhBPKpfKG6R+G3G4v5CPlRROXpAOpQ3HMhA9n1Tck1g==", "dev": true, "dependencies": { - "@commitlint/types": "^18.6.0", - "semver": "7.5.4" + "@commitlint/types": "^19.0.3", + "semver": "^7.6.0" }, "engines": { "node": ">=v18" } }, - "node_modules/@commitlint/is-ignored/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@commitlint/is-ignored/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@commitlint/lint": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-18.6.0.tgz", - "integrity": "sha512-ycbuDWfyykPmslgiHzhz8dL6F0BJYltXLVfc+M49z0c+FNITM0v+r0Vd2+Tdtq06VTc894p2+YSmZhulY8Jn3Q==", + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-19.2.2.tgz", + "integrity": "sha512-xrzMmz4JqwGyKQKTpFzlN0dx0TAiT7Ran1fqEBgEmEj+PU98crOFtysJgY+QdeSagx6EDRigQIXJVnfrI0ratA==", "dev": true, "dependencies": { - "@commitlint/is-ignored": "^18.6.0", - "@commitlint/parse": "^18.6.0", - "@commitlint/rules": "^18.6.0", - "@commitlint/types": "^18.6.0" + "@commitlint/is-ignored": "^19.2.2", + "@commitlint/parse": "^19.0.3", + "@commitlint/rules": "^19.0.3", + "@commitlint/types": "^19.0.3" }, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/load": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-18.6.0.tgz", - "integrity": "sha512-RRssj7TmzT0bowoEKlgwg8uQ7ORXWkw7lYLsZZBMi9aInsJuGNLNWcMxJxRZbwxG3jkCidGUg85WmqJvRjsaDA==", + "version": "19.2.0", + "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-19.2.0.tgz", + "integrity": "sha512-XvxxLJTKqZojCxaBQ7u92qQLFMMZc4+p9qrIq/9kJDy8DOrEa7P1yx7Tjdc2u2JxIalqT4KOGraVgCE7eCYJyQ==", "dev": true, "dependencies": { - "@commitlint/config-validator": "^18.6.0", - "@commitlint/execute-rule": "^18.4.4", - "@commitlint/resolve-extends": "^18.6.0", - "@commitlint/types": "^18.6.0", - "chalk": "^4.1.0", - "cosmiconfig": "^8.3.6", + "@commitlint/config-validator": "^19.0.3", + "@commitlint/execute-rule": "^19.0.0", + "@commitlint/resolve-extends": "^19.1.0", + "@commitlint/types": "^19.0.3", + "chalk": "^5.3.0", + "cosmiconfig": "^9.0.0", "cosmiconfig-typescript-loader": "^5.0.0", "lodash.isplainobject": "^4.0.6", "lodash.merge": "^4.6.2", - "lodash.uniq": "^4.5.0", - "resolve-from": "^5.0.0" + "lodash.uniq": "^4.5.0" }, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/message": { - "version": "18.4.4", - "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-18.4.4.tgz", - "integrity": "sha512-lHF95mMDYgAI1LBXveJUyg4eLaMXyOqJccCK3v55ZOEUsMPrDi8upqDjd/NmzWmESYihaOMBTAnxm+6oD1WoDQ==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-19.0.0.tgz", + "integrity": "sha512-c9czf6lU+9oF9gVVa2lmKaOARJvt4soRsVmbR7Njwp9FpbBgste5i7l/2l5o8MmbwGh4yE1snfnsy2qyA2r/Fw==", "dev": true, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/parse": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-18.6.0.tgz", - "integrity": "sha512-Y/G++GJpATFw54O0jikc/h2ibyGHgghtPnwsOk3O/aU092ydJ5XEHYcd7xGNQYuLweLzQis2uEwRNk9AVIPbQQ==", + "version": "19.0.3", + "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-19.0.3.tgz", + "integrity": "sha512-Il+tNyOb8VDxN3P6XoBBwWJtKKGzHlitEuXA5BP6ir/3loWlsSqDr5aecl6hZcC/spjq4pHqNh0qPlfeWu38QA==", "dev": true, "dependencies": { - "@commitlint/types": "^18.6.0", + "@commitlint/types": "^19.0.3", "conventional-changelog-angular": "^7.0.0", "conventional-commits-parser": "^5.0.0" }, @@ -470,90 +528,92 @@ } }, "node_modules/@commitlint/read": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-18.6.0.tgz", - "integrity": "sha512-w39ji8VfWhPKRquPhRHB3Yd8XIHwaNHgOh28YI1QEmZ59qVpuVUQo6h/NsVb+uoC6LbXZiofTZv2iFR084jKEA==", + "version": "19.2.1", + "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-19.2.1.tgz", + "integrity": "sha512-qETc4+PL0EUv7Q36lJbPG+NJiBOGg7SSC7B5BsPWOmei+Dyif80ErfWQ0qXoW9oCh7GTpTNRoaVhiI8RbhuaNw==", "dev": true, "dependencies": { - "@commitlint/top-level": "^18.4.4", - "@commitlint/types": "^18.6.0", - "git-raw-commits": "^2.0.11", - "minimist": "^1.2.6" + "@commitlint/top-level": "^19.0.0", + "@commitlint/types": "^19.0.3", + "execa": "^8.0.1", + "git-raw-commits": "^4.0.0", + "minimist": "^1.2.8" }, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/resolve-extends": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-18.6.0.tgz", - "integrity": "sha512-k2Xp+Fxeggki2i90vGrbiLDMefPius3zGSTFFlRAPKce/SWLbZtI+uqE9Mne23mHO5lmcSV8z5m6ziiJwGpOcg==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-19.1.0.tgz", + "integrity": "sha512-z2riI+8G3CET5CPgXJPlzftH+RiWYLMYv4C9tSLdLXdr6pBNimSKukYP9MS27ejmscqCTVA4almdLh0ODD2KYg==", "dev": true, "dependencies": { - "@commitlint/config-validator": "^18.6.0", - "@commitlint/types": "^18.6.0", - "import-fresh": "^3.0.0", + "@commitlint/config-validator": "^19.0.3", + "@commitlint/types": "^19.0.3", + "global-directory": "^4.0.1", + "import-meta-resolve": "^4.0.0", "lodash.mergewith": "^4.6.2", - "resolve-from": "^5.0.0", - "resolve-global": "^1.0.0" + "resolve-from": "^5.0.0" }, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/rules": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-18.6.0.tgz", - "integrity": "sha512-pTalvCEvuCWrBWZA/YqO/3B3nZnY3Ncc+TmQsRajBdC1tkQIm5Iovdo4Ec7f2Dw1tVvpYMUUNAgcWqsY0WckWg==", + "version": "19.0.3", + "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-19.0.3.tgz", + "integrity": "sha512-TspKb9VB6svklxNCKKwxhELn7qhtY1rFF8ls58DcFd0F97XoG07xugPjjbVnLqmMkRjZDbDIwBKt9bddOfLaPw==", "dev": true, "dependencies": { - "@commitlint/ensure": "^18.6.0", - "@commitlint/message": "^18.4.4", - "@commitlint/to-lines": "^18.4.4", - "@commitlint/types": "^18.6.0", - "execa": "^5.0.0" + "@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" }, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/to-lines": { - "version": "18.4.4", - "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-18.4.4.tgz", - "integrity": "sha512-mwe2Roa59NCz/krniAdCygFabg7+fQCkIhXqBHw00XQ8Y7lw4poZLLxeGI3p3bLpcEOXdqIDrEGLwHmG5lBdwQ==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-19.0.0.tgz", + "integrity": "sha512-vkxWo+VQU5wFhiP9Ub9Sre0FYe019JxFikrALVoD5UGa8/t3yOJEpEhxC5xKiENKKhUkTpEItMTRAjHw2SCpZw==", "dev": true, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/top-level": { - "version": "18.4.4", - "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-18.4.4.tgz", - "integrity": "sha512-PBwW1drgeavl9CadB7IPRUk6rkUP/O8jEkxjlC+ofuh3pw0bzJdAT+Kw7M1Yc9KtTb9xTaqUB8uvRtaybHa/tQ==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-19.0.0.tgz", + "integrity": "sha512-KKjShd6u1aMGNkCkaX4aG1jOGdn7f8ZI8TR1VEuNqUOjWTOdcDSsmglinglJ18JTjuBX5I1PtjrhQCRcixRVFQ==", "dev": true, "dependencies": { - "find-up": "^5.0.0" + "find-up": "^7.0.0" }, "engines": { "node": ">=v18" } }, "node_modules/@commitlint/types": { - "version": "18.6.0", - "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-18.6.0.tgz", - "integrity": "sha512-oavoKLML/eJa2rJeyYSbyGAYzTxQ6voG5oeX3OrxpfrkRWhJfm4ACnhoRf5tgiybx2MZ+EVFqC1Lw3W8/uwpZA==", + "version": "19.0.3", + "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-19.0.3.tgz", + "integrity": "sha512-tpyc+7i6bPG9mvaBbtKUeghfyZSDgWquIDfMgqYtTbmZ9Y9VzEm2je9EYcQ0aoz5o7NvGS+rcDec93yO08MHYA==", "dev": true, "dependencies": { - "chalk": "^4.1.0" + "@types/conventional-commits-parser": "^5.0.0", + "chalk": "^5.3.0" }, "engines": { "node": ">=v18" } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.0.tgz", - "integrity": "sha512-fGFDEctNh0CcSwsiRPxiaqX0P5rq+AqE0SRhYGZ4PX46Lg1FNR6oCxJghf8YgY0WQEgQuh3lErUFE4KxLeRmmw==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", + "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==", "cpu": [ "ppc64" ], @@ -567,9 +627,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.0.tgz", - "integrity": "sha512-3bMAfInvByLHfJwYPJRlpTeaQA75n8C/QKpEaiS4HrFWFiJlNI0vzq/zCjBrhAYcPyVPG7Eo9dMrcQXuqmNk5g==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz", + "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==", "cpu": [ "arm" ], @@ -583,9 +643,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.0.tgz", - "integrity": "sha512-aVpnM4lURNkp0D3qPoAzSG92VXStYmoVPOgXveAUoQBWRSuQzt51yvSju29J6AHPmwY1BjH49uR29oyfH1ra8Q==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz", + "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==", "cpu": [ "arm64" ], @@ -599,9 +659,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.0.tgz", - "integrity": "sha512-uK7wAnlRvjkCPzh8jJ+QejFyrP8ObKuR5cBIsQZ+qbMunwR8sbd8krmMbxTLSrDhiPZaJYKQAU5Y3iMDcZPhyQ==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz", + "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==", "cpu": [ "x64" ], @@ -615,9 +675,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.0.tgz", - "integrity": "sha512-AjEcivGAlPs3UAcJedMa9qYg9eSfU6FnGHJjT8s346HSKkrcWlYezGE8VaO2xKfvvlZkgAhyvl06OJOxiMgOYQ==", + "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==", "cpu": [ "arm64" ], @@ -631,9 +691,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.0.tgz", - "integrity": "sha512-bsgTPoyYDnPv8ER0HqnJggXK6RyFy4PH4rtsId0V7Efa90u2+EifxytE9pZnsDgExgkARy24WUQGv9irVbTvIw==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz", + "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==", "cpu": [ "x64" ], @@ -647,9 +707,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.0.tgz", - "integrity": "sha512-kQ7jYdlKS335mpGbMW5tEe3IrQFIok9r84EM3PXB8qBFJPSc6dpWfrtsC/y1pyrz82xfUIn5ZrnSHQQsd6jebQ==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz", + "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==", "cpu": [ "arm64" ], @@ -663,9 +723,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.0.tgz", - "integrity": "sha512-uG8B0WSepMRsBNVXAQcHf9+Ko/Tr+XqmK7Ptel9HVmnykupXdS4J7ovSQUIi0tQGIndhbqWLaIL/qO/cWhXKyQ==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz", + "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==", "cpu": [ "x64" ], @@ -679,9 +739,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.0.tgz", - "integrity": "sha512-2ezuhdiZw8vuHf1HKSf4TIk80naTbP9At7sOqZmdVwvvMyuoDiZB49YZKLsLOfKIr77+I40dWpHVeY5JHpIEIg==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz", + "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==", "cpu": [ "arm" ], @@ -695,9 +755,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.0.tgz", - "integrity": "sha512-uTtyYAP5veqi2z9b6Gr0NUoNv9F/rOzI8tOD5jKcCvRUn7T60Bb+42NDBCWNhMjkQzI0qqwXkQGo1SY41G52nw==", + "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==", "cpu": [ "arm64" ], @@ -711,9 +771,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.0.tgz", - "integrity": "sha512-c88wwtfs8tTffPaoJ+SQn3y+lKtgTzyjkD8NgsyCtCmtoIC8RDL7PrJU05an/e9VuAke6eJqGkoMhJK1RY6z4w==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz", + "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==", "cpu": [ "ia32" ], @@ -727,9 +787,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.0.tgz", - "integrity": "sha512-lR2rr/128/6svngnVta6JN4gxSXle/yZEZL3o4XZ6esOqhyR4wsKyfu6qXAL04S4S5CgGfG+GYZnjFd4YiG3Aw==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz", + "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==", "cpu": [ "loong64" ], @@ -743,9 +803,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.0.tgz", - "integrity": "sha512-9Sycc+1uUsDnJCelDf6ZNqgZQoK1mJvFtqf2MUz4ujTxGhvCWw+4chYfDLPepMEvVL9PDwn6HrXad5yOrNzIsQ==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz", + "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==", "cpu": [ "mips64el" ], @@ -759,9 +819,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.0.tgz", - "integrity": "sha512-CoWSaaAXOZd+CjbUTdXIJE/t7Oz+4g90A3VBCHLbfuc5yUQU/nFDLOzQsN0cdxgXd97lYW/psIIBdjzQIwTBGw==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz", + "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==", "cpu": [ "ppc64" ], @@ -775,9 +835,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.0.tgz", - "integrity": "sha512-mlb1hg/eYRJUpv8h/x+4ShgoNLL8wgZ64SUr26KwglTYnwAWjkhR2GpoKftDbPOCnodA9t4Y/b68H4J9XmmPzA==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz", + "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==", "cpu": [ "riscv64" ], @@ -791,9 +851,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.0.tgz", - "integrity": "sha512-fgf9ubb53xSnOBqyvWEY6ukBNRl1mVX1srPNu06B6mNsNK20JfH6xV6jECzrQ69/VMiTLvHMicQR/PgTOgqJUQ==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz", + "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==", "cpu": [ "s390x" ], @@ -807,9 +867,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.0.tgz", - "integrity": "sha512-H9Eu6MGse++204XZcYsse1yFHmRXEWgadk2N58O/xd50P9EvFMLJTQLg+lB4E1cF2xhLZU5luSWtGTb0l9UeSg==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz", + "integrity": "sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==", "cpu": [ "x64" ], @@ -823,9 +883,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.0.tgz", - "integrity": "sha512-lCT675rTN1v8Fo+RGrE5KjSnfY0x9Og4RN7t7lVrN3vMSjy34/+3na0q7RIfWDAj0e0rCh0OL+P88lu3Rt21MQ==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz", + "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==", "cpu": [ "x64" ], @@ -839,9 +899,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.0.tgz", - "integrity": "sha512-HKoUGXz/TOVXKQ+67NhxyHv+aDSZf44QpWLa3I1lLvAwGq8x1k0T+e2HHSRvxWhfJrFxaaqre1+YyzQ99KixoA==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", + "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==", "cpu": [ "x64" ], @@ -855,9 +915,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.0.tgz", - "integrity": "sha512-GDwAqgHQm1mVoPppGsoq4WJwT3vhnz/2N62CzhvApFD1eJyTroob30FPpOZabN+FgCjhG+AgcZyOPIkR8dfD7g==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz", + "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==", "cpu": [ "x64" ], @@ -871,9 +931,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.0.tgz", - "integrity": "sha512-0vYsP8aC4TvMlOQYozoksiaxjlvUcQrac+muDqj1Fxy6jh9l9CZJzj7zmh8JGfiV49cYLTorFLxg7593pGldwQ==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz", + "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==", "cpu": [ "arm64" ], @@ -887,9 +947,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.0.tgz", - "integrity": "sha512-p98u4rIgfh4gdpV00IqknBD5pC84LCub+4a3MO+zjqvU5MVXOc3hqR2UgT2jI2nh3h8s9EQxmOsVI3tyzv1iFg==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz", + "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==", "cpu": [ "ia32" ], @@ -903,9 +963,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.0.tgz", - "integrity": "sha512-NgJnesu1RtWihtTtXGFMU5YSE6JyyHPMxCwBZK7a6/8d31GuSo9l0Ss7w1Jw5QnKUawG6UEehs883kcXf5fYwg==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz", + "integrity": "sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==", "cpu": [ "x64" ], @@ -918,167 +978,12 @@ "node": ">=12" } }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", - "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", - "dev": true, - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", - "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/@eslint/eslintrc/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==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "node_modules/@eslint/eslintrc/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@eslint/js": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", - "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, "node_modules/@exodus/schemasafe": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@exodus/schemasafe/-/schemasafe-1.3.0.tgz", "integrity": "sha512-5Aap/GaRupgNx/feGBwLLTVv8OQFfv3pq2lPRzPg9R+IOBnDgghTGW7l7EuVXOvg5cc/xSAlRW8rBrjIC3Nvqw==", "dev": true }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", - "dev": true, - "dependencies": { - "@humanwhocodes/object-schema": "^2.0.2", - "debug": "^4.3.1", - "minimatch": "^3.0.5" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/config-array/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==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", - "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", - "dev": true - }, "node_modules/@hutson/parse-repository-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/@hutson/parse-repository-url/-/parse-repository-url-5.0.0.tgz", @@ -1110,32 +1015,32 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", "dev": true, "dependencies": { - "@jridgewell/set-array": "^1.0.1", + "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "engines": { "node": ">=6.0.0" @@ -1148,9 +1053,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.22", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", - "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "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, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -1193,161 +1098,147 @@ } }, "node_modules/@octokit/auth-token": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", - "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.1.tgz", + "integrity": "sha512-rh3G3wDO8J9wSjfI436JUKzHIxq8NaiL0tVeB2aXmG6p/9859aUOAjA9pmSPNGGZxfwmaJ9ozOJImuNVJdpvbA==", "dev": true, "engines": { "node": ">= 18" } }, "node_modules/@octokit/core": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.1.0.tgz", - "integrity": "sha512-BDa2VAMLSh3otEiaMJ/3Y36GU4qf6GI+VivQ/P41NC6GHcdxpKlqV0ikSZ5gdQsmS3ojXeRx5vasgNTinF0Q4g==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.2.tgz", + "integrity": "sha512-hEb7Ma4cGJGEUNOAVmyfdB/3WirWMg5hDuNFVejGEDFqupeOysLc2sG6HJxY2etBp5YQu5Wtxwi020jS9xlUwg==", "dev": true, "dependencies": { - "@octokit/auth-token": "^4.0.0", - "@octokit/graphql": "^7.0.0", - "@octokit/request": "^8.0.2", - "@octokit/request-error": "^5.0.0", - "@octokit/types": "^12.0.0", - "before-after-hook": "^2.2.0", - "universal-user-agent": "^6.0.0" + "@octokit/auth-token": "^5.0.0", + "@octokit/graphql": "^8.0.0", + "@octokit/request": "^9.0.0", + "@octokit/request-error": "^6.0.1", + "@octokit/types": "^13.0.0", + "before-after-hook": "^3.0.2", + "universal-user-agent": "^7.0.0" }, "engines": { "node": ">= 18" } }, "node_modules/@octokit/endpoint": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.4.tgz", - "integrity": "sha512-DWPLtr1Kz3tv8L0UvXTDP1fNwM0S+z6EJpRcvH66orY6Eld4XBMCSYsaWp4xIm61jTWxK68BrR7ibO+vSDnZqw==", + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.1.tgz", + "integrity": "sha512-JYjh5rMOwXMJyUpj028cu0Gbp7qe/ihxfJMLc8VZBMMqSwLgOxDI1911gV4Enl1QSavAQNJcwmwBF9M0VvLh6Q==", "dev": true, "dependencies": { - "@octokit/types": "^12.0.0", - "universal-user-agent": "^6.0.0" + "@octokit/types": "^13.0.0", + "universal-user-agent": "^7.0.2" }, "engines": { "node": ">= 18" } }, "node_modules/@octokit/graphql": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.0.2.tgz", - "integrity": "sha512-OJ2iGMtj5Tg3s6RaXH22cJcxXRi7Y3EBqbHTBRq+PQAqfaS8f/236fUrWhfSn8P4jovyzqucxme7/vWSSZBX2Q==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-8.1.1.tgz", + "integrity": "sha512-ukiRmuHTi6ebQx/HFRCXKbDlOh/7xEV6QUXaE7MJEKGNAncGI/STSbOkl12qVXZrfZdpXctx5O9X1AIaebiDBg==", "dev": true, "dependencies": { - "@octokit/request": "^8.0.1", - "@octokit/types": "^12.0.0", - "universal-user-agent": "^6.0.0" + "@octokit/request": "^9.0.0", + "@octokit/types": "^13.0.0", + "universal-user-agent": "^7.0.0" }, "engines": { "node": ">= 18" } }, "node_modules/@octokit/openapi-types": { - "version": "19.1.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.1.0.tgz", - "integrity": "sha512-6G+ywGClliGQwRsjvqVYpklIfa7oRPA0vyhPQG/1Feh+B+wU0vGH1JiJ5T25d3g1JZYBHzR2qefLi9x8Gt+cpw==", + "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 }, "node_modules/@octokit/plugin-paginate-rest": { - "version": "9.1.5", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.1.5.tgz", - "integrity": "sha512-WKTQXxK+bu49qzwv4qKbMMRXej1DU2gq017euWyKVudA6MldaSSQuxtz+vGbhxV4CjxpUxjZu6rM2wfc1FiWVg==", + "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==", "dev": true, "dependencies": { - "@octokit/types": "^12.4.0" + "@octokit/types": "^13.4.0" }, "engines": { "node": ">= 18" }, "peerDependencies": { - "@octokit/core": ">=5" + "@octokit/core": ">=6" } }, "node_modules/@octokit/plugin-retry": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.0.1.tgz", - "integrity": "sha512-SKs+Tz9oj0g4p28qkZwl/topGcb0k0qPNX/i7vBKmDsjoeqnVfFUquqrE/O9oJY7+oLzdCtkiWSXLpLjvl6uog==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-7.1.0.tgz", + "integrity": "sha512-6mc4xNtT6eoDBGrJJn0sFALUmIba2f7Wx+G8XV9GkBLcyX5PogBdx2mDMW5yPPqSD/y23tYagkjOLX9sT7O6jA==", "dev": true, "dependencies": { - "@octokit/request-error": "^5.0.0", - "@octokit/types": "^12.0.0", + "@octokit/request-error": "^6.0.0", + "@octokit/types": "^13.0.0", "bottleneck": "^2.15.3" }, "engines": { "node": ">= 18" }, "peerDependencies": { - "@octokit/core": ">=5" + "@octokit/core": ">=6" } }, "node_modules/@octokit/plugin-throttling": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-8.1.3.tgz", - "integrity": "sha512-pfyqaqpc0EXh5Cn4HX9lWYsZ4gGbjnSmUILeu4u2gnuM50K/wIk9s1Pxt3lVeVwekmITgN/nJdoh43Ka+vye8A==", + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-9.2.0.tgz", + "integrity": "sha512-zHZSZCC7wk3HbK3ZCuvc3iPrnFGoYIVJsJAY4l8ilsVu4fqPfe7BP7QLZ1A641yttLWqgy2oID3ETD3Z1036Gw==", "dev": true, "dependencies": { - "@octokit/types": "^12.2.0", + "@octokit/types": "^13.0.0", "bottleneck": "^2.15.3" }, "engines": { "node": ">= 18" }, "peerDependencies": { - "@octokit/core": "^5.0.0" + "@octokit/core": "^6.0.0" } }, "node_modules/@octokit/request": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.1.6.tgz", - "integrity": "sha512-YhPaGml3ncZC1NfXpP3WZ7iliL1ap6tLkAp6MvbK2fTTPytzVUyUesBBogcdMm86uRYO5rHaM1xIWxigWZ17MQ==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.1.1.tgz", + "integrity": "sha512-pyAguc0p+f+GbQho0uNetNQMmLG1e80WjkIaqqgUkihqUp0boRU6nKItXO4VWnr+nbZiLGEyy4TeKRwqaLvYgw==", "dev": true, "dependencies": { - "@octokit/endpoint": "^9.0.0", - "@octokit/request-error": "^5.0.0", - "@octokit/types": "^12.0.0", - "universal-user-agent": "^6.0.0" + "@octokit/endpoint": "^10.0.0", + "@octokit/request-error": "^6.0.1", + "@octokit/types": "^13.1.0", + "universal-user-agent": "^7.0.2" }, "engines": { "node": ">= 18" } }, "node_modules/@octokit/request-error": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.0.1.tgz", - "integrity": "sha512-X7pnyTMV7MgtGmiXBwmO6M5kIPrntOXdyKZLigNfQWSEQzVxR4a4vo49vJjTWX70mPndj8KhfT4Dx+2Ng3vnBQ==", + "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==", "dev": true, "dependencies": { - "@octokit/types": "^12.0.0", - "deprecation": "^2.0.0", - "once": "^1.4.0" + "@octokit/types": "^13.0.0" }, "engines": { "node": ">= 18" } }, "node_modules/@octokit/types": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.4.0.tgz", - "integrity": "sha512-FLWs/AvZllw/AGVs+nJ+ELCDZZJk+kY0zMen118xhL2zD0s1etIUHm1odgjP7epxYU1ln7SZxEUWYop5bhsdgQ==", + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.4.1.tgz", + "integrity": "sha512-Y73oOAzRBAUzR/iRAbGULzpNkX8vaxKCqEtg6K74Ff3w9f5apFnWtE/2nade7dMWWW3bS5Kkd6DJS4HF04xreg==", "dev": true, "dependencies": { - "@octokit/openapi-types": "^19.1.0" - } - }, - "node_modules/@pkgr/core": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", - "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/unts" + "@octokit/openapi-types": "^22.1.0" } }, "node_modules/@pnpm/config.env-replace": { @@ -1392,9 +1283,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.6.tgz", - "integrity": "sha512-MVNXSSYN6QXOulbHpLMKYi60ppyO13W9my1qogeiAqtjb2yR4LSmfU2+POvDkLzhjYLXz9Rf9+9a3zFHW1Lecg==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.14.3.tgz", + "integrity": "sha512-X9alQ3XM6I9IlSlmC8ddAvMSyG1WuHk5oUnXGw+yUBs3BFoTizmG1La/Gr8fVJvDWAq+zlYTZ9DBgrlKRVY06g==", "cpu": [ "arm" ], @@ -1405,9 +1296,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.9.6.tgz", - "integrity": "sha512-T14aNLpqJ5wzKNf5jEDpv5zgyIqcpn1MlwCrUXLrwoADr2RkWA0vOWP4XxbO9aiO3dvMCQICZdKeDrFl7UMClw==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.14.3.tgz", + "integrity": "sha512-eQK5JIi+POhFpzk+LnjKIy4Ks+pwJ+NXmPxOCSvOKSNRPONzKuUvWE+P9JxGZVxrtzm6BAYMaL50FFuPe0oWMQ==", "cpu": [ "arm64" ], @@ -1418,9 +1309,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.9.6.tgz", - "integrity": "sha512-CqNNAyhRkTbo8VVZ5R85X73H3R5NX9ONnKbXuHisGWC0qRbTTxnF1U4V9NafzJbgGM0sHZpdO83pLPzq8uOZFw==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.14.3.tgz", + "integrity": "sha512-Od4vE6f6CTT53yM1jgcLqNfItTsLt5zE46fdPaEmeFHvPs5SjZYlLpHrSiHEKR1+HdRfxuzXHjDOIxQyC3ptBA==", "cpu": [ "arm64" ], @@ -1431,9 +1322,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.9.6.tgz", - "integrity": "sha512-zRDtdJuRvA1dc9Mp6BWYqAsU5oeLixdfUvkTHuiYOHwqYuQ4YgSmi6+/lPvSsqc/I0Omw3DdICx4Tfacdzmhog==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.14.3.tgz", + "integrity": "sha512-0IMAO21axJeNIrvS9lSe/PGthc8ZUS+zC53O0VhF5gMxfmcKAP4ESkKOCwEi6u2asUrt4mQv2rjY8QseIEb1aw==", "cpu": [ "x64" ], @@ -1444,9 +1335,22 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.9.6.tgz", - "integrity": "sha512-oNk8YXDDnNyG4qlNb6is1ojTOGL/tRhbbKeE/YuccItzerEZT68Z9gHrY3ROh7axDc974+zYAPxK5SH0j/G+QQ==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.14.3.tgz", + "integrity": "sha512-ge2DC7tHRHa3caVEoSbPRJpq7azhG+xYsd6u2MEnJ6XzPSzQsTKyXvh6iWjXRf7Rt9ykIUWHtl0Uz3T6yXPpKw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.14.3.tgz", + "integrity": "sha512-ljcuiDI4V3ySuc7eSk4lQ9wU8J8r8KrOUvB2U+TtK0TiW6OFDmJ+DdIjjwZHIw9CNxzbmXY39wwpzYuFDwNXuw==", "cpu": [ "arm" ], @@ -1457,9 +1361,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.9.6.tgz", - "integrity": "sha512-Z3O60yxPtuCYobrtzjo0wlmvDdx2qZfeAWTyfOjEDqd08kthDKexLpV97KfAeUXPosENKd8uyJMRDfFMxcYkDQ==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.14.3.tgz", + "integrity": "sha512-Eci2us9VTHm1eSyn5/eEpaC7eP/mp5n46gTRB3Aar3BgSvDQGJZuicyq6TsH4HngNBgVqC5sDYxOzTExSU+NjA==", "cpu": [ "arm64" ], @@ -1470,9 +1374,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.9.6.tgz", - "integrity": "sha512-gpiG0qQJNdYEVad+1iAsGAbgAnZ8j07FapmnIAQgODKcOTjLEWM9sRb+MbQyVsYCnA0Im6M6QIq6ax7liws6eQ==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.14.3.tgz", + "integrity": "sha512-UrBoMLCq4E92/LCqlh+blpqMz5h1tJttPIniwUgOFJyjWI1qrtrDhhpHPuFxULlUmjFHfloWdixtDhSxJt5iKw==", "cpu": [ "arm64" ], @@ -1482,10 +1386,23 @@ "linux" ] }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.14.3.tgz", + "integrity": "sha512-5aRjvsS8q1nWN8AoRfrq5+9IflC3P1leMoy4r2WjXyFqf3qcqsxRCfxtZIV58tCxd+Yv7WELPcO9mY9aeQyAmw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.9.6.tgz", - "integrity": "sha512-+uCOcvVmFUYvVDr27aiyun9WgZk0tXe7ThuzoUTAukZJOwS5MrGbmSlNOhx1j80GdpqbOty05XqSl5w4dQvcOA==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.14.3.tgz", + "integrity": "sha512-sk/Qh1j2/RJSX7FhEpJn8n0ndxy/uf0kI/9Zc4b1ELhqULVdTfN6HL31CDaTChiBAOgLcsJ1sgVZjWv8XNEsAQ==", "cpu": [ "riscv64" ], @@ -1495,10 +1412,23 @@ "linux" ] }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.14.3.tgz", + "integrity": "sha512-jOO/PEaDitOmY9TgkxF/TQIjXySQe5KVYB57H/8LRP/ux0ZoO8cSHCX17asMSv3ruwslXW/TLBcxyaUzGRHcqg==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.9.6.tgz", - "integrity": "sha512-HUNqM32dGzfBKuaDUBqFB7tP6VMN74eLZ33Q9Y1TBqRDn+qDonkAUyKWwF9BR9unV7QUzffLnz9GrnKvMqC/fw==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.14.3.tgz", + "integrity": "sha512-8ybV4Xjy59xLMyWo3GCfEGqtKV5M5gCSrZlxkPGvEPCGDLNla7v48S662HSGwRd6/2cSneMQWiv+QzcttLrrOA==", "cpu": [ "x64" ], @@ -1509,9 +1439,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.9.6.tgz", - "integrity": "sha512-ch7M+9Tr5R4FK40FHQk8VnML0Szi2KRujUgHXd/HjuH9ifH72GUmw6lStZBo3c3GB82vHa0ZoUfjfcM7JiiMrQ==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.14.3.tgz", + "integrity": "sha512-s+xf1I46trOY10OqAtZ5Rm6lzHre/UiLA1J2uOhCFXWkbZrJRkYBPO6FhvGfHmdtQ3Bx793MNa7LvoWFAm93bg==", "cpu": [ "x64" ], @@ -1522,9 +1452,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.9.6.tgz", - "integrity": "sha512-VD6qnR99dhmTQ1mJhIzXsRcTBvTjbfbGGwKAHcu+52cVl15AC/kplkhxzW/uT0Xl62Y/meBKDZvoJSJN+vTeGA==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.14.3.tgz", + "integrity": "sha512-+4h2WrGOYsOumDQ5S2sYNyhVfrue+9tc9XcLWLh+Kw3UOxAvrfOrSMFon60KspcDdytkNDh7K2Vs6eMaYImAZg==", "cpu": [ "arm64" ], @@ -1535,9 +1465,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.9.6.tgz", - "integrity": "sha512-J9AFDq/xiRI58eR2NIDfyVmTYGyIZmRcvcAoJ48oDld/NTR8wyiPUu2X/v1navJ+N/FGg68LEbX3Ejd6l8B7MQ==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.14.3.tgz", + "integrity": "sha512-T1l7y/bCeL/kUwh9OD4PQT4aM7Bq43vX05htPJJ46RTI4r5KNt6qJRzAfNfM+OYMNEVBWQzR2Gyk+FXLZfogGw==", "cpu": [ "ia32" ], @@ -1548,9 +1478,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.6.tgz", - "integrity": "sha512-jqzNLhNDvIZOrt69Ce4UjGRpXJBzhUBzawMwnaDAwyHriki3XollsewxWzOzz+4yOFDkuJHtTsZFwMxhYJWmLQ==", + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.14.3.tgz", + "integrity": "sha512-/BypzV0H1y1HzgYpxqRaXGBRqfodgoBBCcsrujT6QRcakDQdfU+Lq9PENPh5jB4I44YWq+0C2eHsHya+nZY1sA==", "cpu": [ "x64" ], @@ -1560,6 +1490,12 @@ "win32" ] }, + "node_modules/@sec-ant/readable-stream": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz", + "integrity": "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==", + "dev": true + }, "node_modules/@semantic-release/changelog": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/@semantic-release/changelog/-/changelog-6.0.3.tgz", @@ -1579,9 +1515,9 @@ } }, "node_modules/@semantic-release/commit-analyzer": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/@semantic-release/commit-analyzer/-/commit-analyzer-11.1.0.tgz", - "integrity": "sha512-cXNTbv3nXR2hlzHjAMgbuiQVtvWHTlwwISt60B+4NZv01y/QRY7p2HcJm8Eh2StzcTJoNnflvKjHH/cjFS7d5g==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/commit-analyzer/-/commit-analyzer-12.0.0.tgz", + "integrity": "sha512-qG+md5gdes+xa8zP7lIo1fWE17zRdO8yMCaxh9lyL65TQleoSv8WHHOqRURfghTytUh+NpkSyBprQ5hrkxOKVQ==", "dev": true, "dependencies": { "conventional-changelog-angular": "^7.0.0", @@ -1593,7 +1529,7 @@ "micromatch": "^4.0.2" }, "engines": { - "node": "^18.17 || >=20.6.1" + "node": ">=20.8.1" }, "peerDependencies": { "semantic-release": ">=20.1.0" @@ -1609,15 +1545,15 @@ } }, "node_modules/@semantic-release/github": { - "version": "9.2.6", - "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-9.2.6.tgz", - "integrity": "sha512-shi+Lrf6exeNZF+sBhK+P011LSbhmIAoUEgEY6SsxF8irJ+J2stwI5jkyDQ+4gzYyDImzV6LCKdYB9FXnQRWKA==", + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-10.0.3.tgz", + "integrity": "sha512-nSJQboKrG4xBn7hHpRMrK8lt5DgqJg50ZMz9UbrsfTxuRk55XVoQEadbGZ2L9M0xZAC6hkuwkDhQJKqfPU35Fw==", "dev": true, "dependencies": { - "@octokit/core": "^5.0.0", - "@octokit/plugin-paginate-rest": "^9.0.0", - "@octokit/plugin-retry": "^6.0.0", - "@octokit/plugin-throttling": "^8.0.0", + "@octokit/core": "^6.0.0", + "@octokit/plugin-paginate-rest": "^11.0.0", + "@octokit/plugin-retry": "^7.0.0", + "@octokit/plugin-throttling": "^9.0.0", "@semantic-release/error": "^4.0.0", "aggregate-error": "^5.0.0", "debug": "^4.3.4", @@ -1625,14 +1561,14 @@ "globby": "^14.0.0", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.0", - "issue-parser": "^6.0.0", + "issue-parser": "^7.0.0", "lodash-es": "^4.17.21", "mime": "^4.0.0", "p-filter": "^4.0.0", "url-join": "^5.0.0" }, "engines": { - "node": ">=18" + "node": ">=20.8.1" }, "peerDependencies": { "semantic-release": ">=20.1.0" @@ -1678,38 +1614,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@semantic-release/github/node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/github/node_modules/globby": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.0.tgz", - "integrity": "sha512-/1WM/LNHRAOH9lZta77uGbq0dAEQM+XjNesWwhlERDVenqothRbnzTrL3/LrIoEPPjeUHC3vrS6TwoyxeHs7MQ==", - "dev": true, - "dependencies": { - "@sindresorhus/merge-streams": "^1.0.0", - "fast-glob": "^3.3.2", - "ignore": "^5.2.4", - "path-type": "^5.0.0", - "slash": "^5.1.0", - "unicorn-magic": "^0.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@semantic-release/github/node_modules/indent-string": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", @@ -1722,34 +1626,10 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@semantic-release/github/node_modules/path-type": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", - "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/github/node_modules/slash": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", - "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", - "dev": true, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@semantic-release/npm": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/@semantic-release/npm/-/npm-11.0.2.tgz", - "integrity": "sha512-owtf3RjyPvRE63iUKZ5/xO4uqjRpVQDUB9+nnXj0xwfIeM9pRl+cG+zGDzdftR4m3f2s4Wyf3SexW+kF5DFtWA==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/npm/-/npm-12.0.0.tgz", + "integrity": "sha512-72TVYQCH9NvVsO/y13eF8vE4bNnfls518+4KcFwJUKi7AtA/ZXoNgSg9gTTfw5eMZMkiH0izUrpGXgZE/cSQhA==", "dev": true, "dependencies": { "@semantic-release/error": "^4.0.0", @@ -1759,7 +1639,7 @@ "lodash-es": "^4.17.21", "nerf-dart": "^1.0.0", "normalize-url": "^8.0.0", - "npm": "^10.0.0", + "npm": "^10.5.0", "rc": "^1.2.8", "read-pkg": "^9.0.0", "registry-auth-token": "^5.0.0", @@ -1767,7 +1647,7 @@ "tempy": "^3.0.0" }, "engines": { - "node": "^18.17 || >=20" + "node": ">=20.8.1" }, "peerDependencies": { "semantic-release": ">=20.1.0" @@ -1813,10 +1693,10 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@semantic-release/npm/node_modules/escape-string-regexp": { + "node_modules/@semantic-release/npm/node_modules/indent-string": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", "dev": true, "engines": { "node": ">=12" @@ -1825,204 +1705,46 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@semantic-release/npm/node_modules/execa": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", - "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "node_modules/@semantic-release/npm/node_modules/parse-json": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.1.0.tgz", + "integrity": "sha512-rum1bPifK5SSar35Z6EKZuYPJx85pkNaFrxBK3mwdfSJ1/WKbYrjoW/zTPSjRRamfmVX1ACBIdFAO0VRErW/EA==", "dev": true, "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^8.0.1", - "human-signals": "^5.0.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^4.1.0", - "strip-final-newline": "^3.0.0" + "@babel/code-frame": "^7.22.13", + "index-to-position": "^0.1.2", + "type-fest": "^4.7.1" }, "engines": { - "node": ">=16.17" + "node": ">=18" }, "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@semantic-release/npm/node_modules/get-stream": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", - "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "node_modules/@semantic-release/npm/node_modules/read-pkg": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-9.0.1.tgz", + "integrity": "sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==", "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.3", + "normalize-package-data": "^6.0.0", + "parse-json": "^8.0.0", + "type-fest": "^4.6.0", + "unicorn-magic": "^0.1.0" + }, "engines": { - "node": ">=16" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@semantic-release/npm/node_modules/human-signals": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", - "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", - "dev": true, - "engines": { - "node": ">=16.17.0" - } - }, - "node_modules/@semantic-release/npm/node_modules/indent-string": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", - "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/npm-run-path": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", - "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", - "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/parse-json": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.1.0.tgz", - "integrity": "sha512-rum1bPifK5SSar35Z6EKZuYPJx85pkNaFrxBK3mwdfSJ1/WKbYrjoW/zTPSjRRamfmVX1ACBIdFAO0VRErW/EA==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.22.13", - "index-to-position": "^0.1.2", - "type-fest": "^4.7.1" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/read-pkg": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-9.0.1.tgz", - "integrity": "sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.3", - "normalize-package-data": "^6.0.0", - "parse-json": "^8.0.0", - "type-fest": "^4.6.0", - "unicorn-magic": "^0.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@semantic-release/npm/node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/type-fest": { - "version": "4.10.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.10.2.tgz", - "integrity": "sha512-anpAG63wSpdEbLwOqH8L84urkL6PiVIov3EMmgIhhThevh9aiMQov+6Btx0wldNcvm4wV+e2/Rt1QdDwKHFbHw==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/release-notes-generator": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/@semantic-release/release-notes-generator/-/release-notes-generator-12.1.0.tgz", - "integrity": "sha512-g6M9AjUKAZUZnxaJZnouNBeDNTCUrJ5Ltj+VJ60gJeDaRRahcHsry9HW8yKrnKkKNkx5lbWiEP1FPMqVNQz8Kg==", + "node_modules/@semantic-release/release-notes-generator": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/release-notes-generator/-/release-notes-generator-13.0.0.tgz", + "integrity": "sha512-LEeZWb340keMYuREMyxrODPXJJ0JOL8D/mCl74B4LdzbxhtXV2LrPN2QBEcGJrlQhoqLO0RhxQb6masHytKw+A==", "dev": true, "dependencies": { "conventional-changelog-angular": "^7.0.0", @@ -2037,7 +1759,7 @@ "read-pkg-up": "^11.0.0" }, "engines": { - "node": "^18.17 || >=20.6.1" + "node": ">=20.8.1" }, "peerDependencies": { "semantic-release": ">=20.1.0" @@ -2109,18 +1831,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@semantic-release/release-notes-generator/node_modules/type-fest": { - "version": "4.10.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.10.2.tgz", - "integrity": "sha512-anpAG63wSpdEbLwOqH8L84urkL6PiVIov3EMmgIhhThevh9aiMQov+6Btx0wldNcvm4wV+e2/Rt1QdDwKHFbHw==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "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", @@ -2128,9 +1838,9 @@ "dev": true }, "node_modules/@sindresorhus/is": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-6.1.0.tgz", - "integrity": "sha512-BuvU07zq3tQ/2SIgBsEuxKYDyDjC0n7Zir52bpHy2xnBbW81+po43aLFPLbeV3HRAheFbGud1qgcqSYfhtHMAg==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-6.3.1.tgz", + "integrity": "sha512-FX4MfcifwJyFOI2lPoX7PQxCqx8BG1HCho7WdiXwpEQx1Ycij0JxkfYtGK7yqNScrZGSlt6RE6sw8QYoH7eKnQ==", "dev": true, "engines": { "node": ">=16" @@ -2140,9 +1850,9 @@ } }, "node_modules/@sindresorhus/merge-streams": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-1.0.0.tgz", - "integrity": "sha512-rUV5WyJrJLoloD4NDN1V1+LDMDWOa4OTsT4yYJwQNpTU6FWxkxHpL7eu4w+DmiH8x/EAM1otkPE1+LaspIbplw==", + "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, "engines": { "node": ">=18" @@ -2152,56 +1862,45 @@ } }, "node_modules/@skyleague/axioms": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@skyleague/axioms/-/axioms-3.6.0.tgz", - "integrity": "sha512-FqEXkGcOTPFjITtNNU8DZ551K/8qsSbwW9gJnjgi4tN5dM9tdHavqxHtcGObQidaxfI8u+fE3GfX/IktN6xwjQ==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@skyleague/axioms/-/axioms-4.3.3.tgz", + "integrity": "sha512-Z54yyVPJ6V1Sme3YB15KMeDViGo7AMNnc8xAVHszMiOQL4xHW5P0JLEMamw5rpV1rJ3ttdu6UO8JTiHIB5PMKA==", "dev": true, "dependencies": { "fast-deep-equal": "^3.1.3", "node-object-hash": "^3.0.0", - "tslib": "^2.6.2" + "type-fest": "^4.15.0" }, "engines": { "node": ">=20" } }, "node_modules/@skyleague/node-standards": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/@skyleague/node-standards/-/node-standards-5.1.9.tgz", - "integrity": "sha512-7gIgSIAW3MQ+80Ggx3by/G8f3tv9Cxdl8yy5tJgLEPge+zWtdvdgLc5S/vIiOYxU+8KOUVcrj25cxwpLolFUZw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@skyleague/node-standards/-/node-standards-7.0.2.tgz", + "integrity": "sha512-ymqH7iMXvg7BY3IAvXCsXKQ7xwDJH6jomql7y8fZnMpuSOD0YBxTcAoJCPJjSpuW5HQOfBVdER2yHyFWfK0oww==", "dev": true, "dependencies": { - "@commitlint/cli": "^18.6.0", - "@commitlint/config-conventional": "^18.6.0", + "@biomejs/biome": "^1.7.0", + "@commitlint/cli": "^19.2.2", + "@commitlint/config-conventional": "^19.2.2", "@semantic-release/changelog": "^6.0.3", - "@types/node": "^20.11.16", - "@typescript-eslint/eslint-plugin": "^6.20.0", - "@typescript-eslint/parser": "^6.20.0", - "@vitest/coverage-v8": "^1.2.2", + "@types/node": "^20.12.7", + "@vitest/coverage-v8": "^1.5.0", "conventional-changelog": "^5.1.0", "enquirer": "^2.4.1", - "esbuild": "^0.20.0", - "eslint": "^8.56.0", - "eslint-config-prettier": "^9.1.0", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-prettier": "^5.1.3", - "eslint-plugin-unicorn": "^50.0.1", - "eslint-plugin-unused-imports": "^3.0.0", + "esbuild": "^0.20.2", "fast-glob": "^3.3.2", "find-root": "^1.1.0", - "husky": "^9.0.10", + "husky": "^9.0.11", "is-ci": "^3.0.1", "line-diff": "^2.1.1", - "lint-staged": "^15.2.1", - "prettier": "^3.2.5", - "prettier-plugin-packagejson": "^2.4.10", - "semantic-release": "^23.0.0", - "semver": "^7.5.4", - "tslib": "^2.6.2", - "tsx": "^4.7.0", + "lint-staged": "^15.2.2", + "semantic-release": "^23.0.8", + "semver": "^7.6.0", + "tsx": "^4.7.2", "variable-diff": "^2.0.2", - "vitest": "^1.2.2", + "vitest": "^1.5.0", "yargs": "^17.7.2" }, "bin": { @@ -2211,27 +1910,33 @@ "node": ">=20" }, "peerDependencies": { - "typescript": "^5.3.3" + "typescript": "^5.4.5" } }, "node_modules/@skyleague/therefore": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@skyleague/therefore/-/therefore-4.1.1.tgz", - "integrity": "sha512-7VzzaSSvBq0blnOOHZzz6+lGwsgcoiaNaVBOoZMQGhqwk798ys58selWGJoieQHxHtWTuXuO24c02s+RcAV6Cw==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@skyleague/therefore/-/therefore-5.5.0.tgz", + "integrity": "sha512-1mCA8iCXzFjTJxJNpAbJBBuJkHXZp1k+zPCZYOVKN4OpZAWYTOg/Voe58JszEPGx2DPeOIE+6VR7BJWCLtHlgg==", "dev": true, "dependencies": { - "@skyleague/axioms": "^3.1.0", + "@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": "^12.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", - "tslib": "^2.6.2", - "uuid": "^9.0.1", "yargs": "^17.7.2" }, "bin": { @@ -2241,13 +1946,95 @@ "node": ">=20" }, "peerDependencies": { - "ajv": "^8.12.0", - "got": "^14.0.0", - "prettier": "^3.1.1", - "tsx": "^4.7.0" + "got": "^14.3.0", + "tsx": "^4.11.0" + } + }, + "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==", + "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": { - "prettier": { + "@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 } } @@ -2264,6 +2051,15 @@ "node": ">=14.16" } }, + "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.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", @@ -2276,34 +2072,10 @@ "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==", "dev": true }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", - "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", - "dev": true - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true - }, - "node_modules/@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", - "dev": true - }, - "node_modules/@types/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", - "dev": true - }, "node_modules/@types/node": { - "version": "20.11.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.16.tgz", - "integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==", + "version": "20.12.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz", + "integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -2315,12 +2087,6 @@ "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", "dev": true }, - "node_modules/@types/semver": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", - "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", - "dev": true - }, "node_modules/@types/split2": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/@types/split2/-/split2-4.2.3.tgz", @@ -2330,250 +2096,77 @@ "@types/node": "*" } }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", - "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", + "node_modules/@typeschema/core": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@typeschema/core/-/core-0.13.2.tgz", + "integrity": "sha512-pAt0MK249/9szYaoPuvzhSfOd3smrLhhwCCpUNB4onX32mRx5F3lzDIveIYGQkLYRq58xOX5sjoW+n72f/MLLw==", "dev": true, - "dependencies": { - "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/type-utils": "6.21.0", - "@typescript-eslint/utils": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", - "debug": "^4.3.4", - "graphemer": "^1.4.0", - "ignore": "^5.2.4", - "natural-compare": "^1.4.0", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, "peerDependencies": { - "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", - "eslint": "^7.0.0 || ^8.0.0" + "@types/json-schema": "^7.0.15" }, "peerDependenciesMeta": { - "typescript": { + "@types/json-schema": { "optional": true } } }, - "node_modules/@typescript-eslint/parser": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", - "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", + "node_modules/@urql/introspection": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@urql/introspection/-/introspection-1.1.0.tgz", + "integrity": "sha512-iszKR3HPABV8ArgfjlWQwgQ3sjZh1eDmAICCMnj3IDLycm8AhK2FKdy8P9M6biOVsy+BfPblYShfB9lynneLgg==", + "dev": true, + "peerDependencies": { + "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" + } + }, + "node_modules/@vitest/coverage-v8": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-1.5.0.tgz", + "integrity": "sha512-1igVwlcqw1QUMdfcMlzzY4coikSIBN944pkueGi0pawrX5I5Z+9hxdTR+w3Sg6Q3eZhvdMAs8ZaF9JuTG1uYOQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/typescript-estree": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", - "debug": "^4.3.4" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" + "@ampproject/remapping": "^2.2.1", + "@bcoe/v8-coverage": "^0.2.3", + "debug": "^4.3.4", + "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" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "vitest": "1.5.0" } }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", - "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "node_modules/@vitest/expect": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.5.0.tgz", + "integrity": "sha512-0pzuCI6KYi2SIC3LQezmxujU9RK/vwC1U9R0rLuGlNGcOuDWxqWKu6nUdFsX9tH1WU0SXtAxToOsEjeUn1s3hA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", - "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", - "dev": true, - "dependencies": { - "@typescript-eslint/typescript-estree": "6.21.0", - "@typescript-eslint/utils": "6.21.0", - "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", - "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", - "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/utils": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", - "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", - "dev": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/typescript-estree": "6.21.0", - "semver": "^7.5.4" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", - "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@ungap/structured-clone": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", - "dev": true - }, - "node_modules/@vitest/coverage-v8": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-1.2.2.tgz", - "integrity": "sha512-IHyKnDz18SFclIEEAHb9Y4Uxx0sPKC2VO1kdDCs1BF6Ip4S8rQprs971zIsooLUn7Afs71GRxWMWpkCGZpRMhw==", - "dev": true, - "dependencies": { - "@ampproject/remapping": "^2.2.1", - "@bcoe/v8-coverage": "^0.2.3", - "debug": "^4.3.4", - "istanbul-lib-coverage": "^3.2.2", - "istanbul-lib-report": "^3.0.1", - "istanbul-lib-source-maps": "^4.0.1", - "istanbul-reports": "^3.1.6", - "magic-string": "^0.30.5", - "magicast": "^0.3.3", - "picocolors": "^1.0.0", - "std-env": "^3.5.0", - "test-exclude": "^6.0.0", - "v8-to-istanbul": "^9.2.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "vitest": "^1.0.0" - } - }, - "node_modules/@vitest/expect": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.2.2.tgz", - "integrity": "sha512-3jpcdPAD7LwHUUiT2pZTj2U82I2Tcgg2oVPvKxhn6mDI2On6tfvPQTjAI4628GUGDZrCm4Zna9iQHm5cEexOAg==", - "dev": true, - "dependencies": { - "@vitest/spy": "1.2.2", - "@vitest/utils": "1.2.2", - "chai": "^4.3.10" + "@vitest/spy": "1.5.0", + "@vitest/utils": "1.5.0", + "chai": "^4.3.10" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/@vitest/runner": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.2.2.tgz", - "integrity": "sha512-JctG7QZ4LSDXr5CsUweFgcpEvrcxOV1Gft7uHrvkQ+fsAVylmWQvnaAr/HDp3LAH1fztGMQZugIheTWjaGzYIg==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.5.0.tgz", + "integrity": "sha512-7HWwdxXP5yDoe7DTpbif9l6ZmDwCzcSIK38kTSIt6CFEpMjX4EpCgT6wUmS0xTXqMI6E/ONmfgRKmaujpabjZQ==", "dev": true, "dependencies": { - "@vitest/utils": "1.2.2", + "@vitest/utils": "1.5.0", "p-limit": "^5.0.0", "pathe": "^1.1.1" }, @@ -2596,22 +2189,10 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@vitest/runner/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==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@vitest/snapshot": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.2.2.tgz", - "integrity": "sha512-SmGY4saEw1+bwE1th6S/cZmPxz/Q4JWsl7LvbQIky2tKE35US4gd0Mjzqfr84/4OD0tikGWaWdMja/nWL5NIPA==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.5.0.tgz", + "integrity": "sha512-qpv3fSEuNrhAO3FpH6YYRdaECnnRjg9VxbhdtPwPRnzSfHVXnNzzrpX4cJxqiwgRMo7uRMWDFBlsBq4Cr+rO3A==", "dev": true, "dependencies": { "magic-string": "^0.30.5", @@ -2623,9 +2204,9 @@ } }, "node_modules/@vitest/spy": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.2.2.tgz", - "integrity": "sha512-k9Gcahssw8d7X3pSLq3e3XEu/0L78mUkCjivUqCQeXJm9clfXR/Td8+AP+VC1O6fKPIDLcHDTAmBOINVuv6+7g==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.5.0.tgz", + "integrity": "sha512-vu6vi6ew5N5MMHJjD5PoakMRKYdmIrNJmyfkhRpQt5d9Ewhw9nZ5Aqynbi3N61bvk9UvZ5UysMT6ayIrZ8GA9w==", "dev": true, "dependencies": { "tinyspy": "^2.2.0" @@ -2635,9 +2216,9 @@ } }, "node_modules/@vitest/utils": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.2.2.tgz", - "integrity": "sha512-WKITBHLsBHlpjnDQahr+XK6RE7MiAsgrIkr0pGhQ9ygoxBfUeG0lUG5iLlzqjmKSlBv3+j5EGsriBzh+C3Tq9g==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.5.0.tgz", + "integrity": "sha512-BDU0GNL8MWkRkSRdNFvCUCAVOeHaUlVJ9Tx0TYBZyXaaOTmGtUFObzchCivIBrIwKzvZA7A9sCejVhXM2aY98A==", "dev": true, "dependencies": { "diff-sequences": "^29.6.3", @@ -2661,15 +2242,6 @@ "node": ">=0.4.0" } }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, "node_modules/acorn-walk": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", @@ -2686,9 +2258,9 @@ "dev": true }, "node_modules/agent-base": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", - "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", "dev": true, "dependencies": { "debug": "^4.3.4" @@ -2711,20 +2283,37 @@ } }, "node_modules/ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.13.0.tgz", + "integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==", "dependencies": { - "fast-deep-equal": "^3.1.1", + "fast-deep-equal": "^3.1.3", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" + "uri-js": "^4.4.1" }, "funding": { "type": "github", "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "dev": true, + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, "node_modules/ansi-colors": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", @@ -2735,24 +2324,9 @@ } }, "node_modules/ansi-escapes": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-6.2.0.tgz", - "integrity": "sha512-kzRaCqXnpzWs+3z5ABPQiVke+iq0KXkHo8xiWV4RPTi5Yli0l97BEQuhXV1s7+aSU/fu1kUuxgS4MsQ0fRuygw==", - "dev": true, - "dependencies": { - "type-fest": "^3.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-escapes/node_modules/type-fest": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", - "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-6.2.1.tgz", + "integrity": "sha512-4nJ3yixlEthEJ9Rk4vPcdBRkZvQZlYyu8j4/Mqz5sgIkddmEnH2Yj2ZrnP9S3tQOvSNRUIgVNF/1yPpRAGNRig==", "dev": true, "engines": { "node": ">=14.16" @@ -2771,24 +2345,21 @@ } }, "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==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" + "node": ">=12" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/ansicolors": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz", - "integrity": "sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==", + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", "dev": true }, "node_modules/argparse": { @@ -2825,108 +2396,6 @@ "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", "dev": true }, - "node_modules/array-includes": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", - "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1", - "is-string": "^1.0.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/array.prototype.filter": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array.prototype.filter/-/array.prototype.filter-1.0.3.tgz", - "integrity": "sha512-VizNcj/RGJiUyQBgzwxzE5oHdeuXY5hSbbmKMlphj1cy1Vl7Pn2asCGbSrru6hSQjmCzqTBPVWAF/whmEOVHbw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-array-method-boxes-properly": "^1.0.0", - "is-string": "^1.0.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array.prototype.findlastindex": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", - "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0", - "get-intrinsic": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array.prototype.flat": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", - "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array.prototype.flatmap": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", - "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/arraybuffer.prototype.slice": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", @@ -2949,15 +2418,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -2968,10 +2428,13 @@ } }, "node_modules/available-typed-arrays": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.6.tgz", - "integrity": "sha512-j1QzY8iPNPG4o4xmO3ptzpRxTciqD3MgEHtifP/YnJpIo58Xu+ne4BejlbkuaLfXn/nz6HFiw29bLpj2PNMdGg==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -2986,9 +2449,9 @@ "dev": true }, "node_modules/before-after-hook": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", - "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", + "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 }, "node_modules/bottleneck": { @@ -2998,12 +2461,13 @@ "dev": true }, "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, "node_modules/braces": { @@ -3018,54 +2482,10 @@ "node": ">=8" } }, - "node_modules/browserslist": { - "version": "4.22.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.3.tgz", - "integrity": "sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "caniuse-lite": "^1.0.30001580", - "electron-to-chromium": "^1.4.648", - "node-releases": "^2.0.14", - "update-browserslist-db": "^1.0.13" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/builtin-modules": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", - "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", - "dev": true, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "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==", + "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" @@ -3081,32 +2501,65 @@ } }, "node_modules/cacheable-request": { - "version": "10.2.14", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.14.tgz", - "integrity": "sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ==", + "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.2", - "get-stream": "^6.0.1", + "@types/http-cache-semantics": "^4.0.4", + "get-stream": "^9.0.1", "http-cache-semantics": "^4.1.1", - "keyv": "^4.5.3", + "keyv": "^4.5.4", "mimic-response": "^4.0.0", - "normalize-url": "^8.0.0", + "normalize-url": "^8.0.1", "responselike": "^3.0.0" }, "engines": { - "node": ">=14.16" + "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==", + "dev": true, + "dependencies": { + "@sec-ant/readable-stream": "^0.4.1", + "is-stream": "^4.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/call-bind": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", - "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dev": true, "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.1", - "set-function-length": "^1.1.1" + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3139,74 +2592,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/camelcase-keys": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", - "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", - "dev": true, - "dependencies": { - "camelcase": "^5.3.1", - "map-obj": "^4.0.0", - "quick-lru": "^4.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/camelcase-keys/node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase-keys/node_modules/quick-lru": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", - "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001584", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001584.tgz", - "integrity": "sha512-LOz7CCQ9M1G7OjJOF9/mzmqmj3jE/7VOmrfw6Mgs0E8cjOsbRXQJHsPBfmBOXDskXKrHLyyW3n7kpDW/4BsfpQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ] - }, - "node_modules/cardinal": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/cardinal/-/cardinal-2.1.1.tgz", - "integrity": "sha512-JSr5eOgoEymtYHBjNWyjrMqet9Am2miJhlfKNdqLp6zoeAh0KN5dRAcxlecj5mAJrmQomgiOBj35xHLrFjqBpw==", - "dev": true, - "dependencies": { - "ansicolors": "~0.3.2", - "redeyed": "~2.1.0" - }, - "bin": { - "cdl": "bin/cdl.js" - } - }, "node_modules/chai": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", @@ -3226,16 +2611,12 @@ } }, "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, "engines": { - "node": ">=10" + "node": "^12.17.0 || ^14.13 || >=16.0.0" }, "funding": { "url": "https://github.com/chalk/chalk?sponsor=1" @@ -3263,9 +2644,9 @@ } }, "node_modules/ci-info": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.0.0.tgz", - "integrity": "sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", "dev": true, "funding": [ { @@ -3277,27 +2658,6 @@ "node": ">=8" } }, - "node_modules/clean-regexp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clean-regexp/-/clean-regexp-1.0.0.tgz", - "integrity": "sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==", - "dev": true, - "dependencies": { - "escape-string-regexp": "^1.0.5" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/clean-regexp/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -3322,87 +2682,94 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/cli-table3": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", - "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", + "node_modules/cli-highlight": { + "version": "2.1.11", + "resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-2.1.11.tgz", + "integrity": "sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==", "dev": true, "dependencies": { - "string-width": "^4.2.0" + "chalk": "^4.0.0", + "highlight.js": "^10.7.1", + "mz": "^2.4.0", + "parse5": "^5.1.1", + "parse5-htmlparser2-tree-adapter": "^6.0.0", + "yargs": "^16.0.0" }, - "engines": { - "node": "10.* || >= 12.*" + "bin": { + "highlight": "bin/highlight" }, - "optionalDependencies": { - "@colors/colors": "1.5.0" - } - }, - "node_modules/cli-table3/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 - }, - "node_modules/cli-table3/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, "engines": { - "node": ">=8" + "node": ">=8.0.0", + "npm": ">=5.0.0" } }, - "node_modules/cli-table3/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==", + "node_modules/cli-highlight/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, "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "color-convert": "^2.0.1" }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/cli-truncate": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz", - "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==", + "node_modules/cli-highlight/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "dependencies": { - "slice-ansi": "^5.0.0", - "string-width": "^7.0.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "engines": { - "node": ">=18" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "node_modules/cli-highlight/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", + "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" + } + }, + "node_modules/cli-highlight/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, + "dependencies": { + "color-name": "~1.1.4" }, "engines": { - "node": ">=12" + "node": ">=7.0.0" } }, - "node_modules/cliui/node_modules/emoji-regex": { + "node_modules/cli-highlight/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 + }, + "node_modules/cli-highlight/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 }, - "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "node_modules/cli-highlight/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==", @@ -3411,7 +2778,7 @@ "node": ">=8" } }, - "node_modules/cliui/node_modules/string-width": { + "node_modules/cli-highlight/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==", @@ -3425,7 +2792,7 @@ "node": ">=8" } }, - "node_modules/cliui/node_modules/wrap-ansi": { + "node_modules/cli-highlight/node_modules/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==", @@ -3442,52 +2809,229 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/code-block-writer": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-12.0.0.tgz", - "integrity": "sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w==", - "dev": true - }, - "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==", + "node_modules/cli-highlight/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" }, "engines": { - "node": ">=7.0.0" + "node": ">=10" } }, - "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 - }, - "node_modules/colorette": { - "version": "2.0.20", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", - "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true - }, - "node_modules/commander": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", - "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "node_modules/cli-highlight/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true, "engines": { - "node": ">=16" + "node": ">=10" } }, - "node_modules/compare-func": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", - "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", + "node_modules/cli-table3": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.4.tgz", + "integrity": "sha512-Lm3L0p+/npIQWNIiyF/nAn7T5dnOwR3xNTHXYEBFBFVPXzCVNZ5lqEC/1eo/EVfpDsQ1I+TX4ORPQgp+UI0CRw==", "dev": true, "dependencies": { - "array-ify": "^1.0.0", + "string-width": "^4.2.0" + }, + "engines": { + "node": "10.* || >= 12.*" + }, + "optionalDependencies": { + "@colors/colors": "1.5.0" + } + }, + "node_modules/cli-table3/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 + }, + "node_modules/cli-table3/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, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-table3/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, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-truncate": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz", + "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/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, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cliui/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, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/cliui/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 + }, + "node_modules/cliui/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 + }, + "node_modules/cliui/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, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/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, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/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, + "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/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 + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/compare-func": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", + "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", + "dev": true, + "dependencies": { + "array-ify": "^1.0.0", "dot-prop": "^5.1.0" } }, @@ -3497,6 +3041,12 @@ "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", @@ -3507,6 +3057,12 @@ "proto-list": "~1.2.1" } }, + "node_modules/config-chain/node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, "node_modules/conventional-changelog": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-5.1.0.tgz", @@ -3592,35 +3148,6 @@ "node": ">=16" } }, - "node_modules/conventional-changelog-core/node_modules/dargs": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/dargs/-/dargs-8.1.0.tgz", - "integrity": "sha512-wAV9QHOsNbwnWdNW2FYvE1P56wtgSbM+3SZcdGiWQILwVjACCXDCI3Ai8QlCjMDB8YK5zySiXZYBiwGmNY3lnw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/conventional-changelog-core/node_modules/git-raw-commits": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-4.0.0.tgz", - "integrity": "sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==", - "dev": true, - "dependencies": { - "dargs": "^8.0.0", - "meow": "^12.0.1", - "split2": "^4.0.0" - }, - "bin": { - "git-raw-commits": "cli.mjs" - }, - "engines": { - "node": ">=16" - } - }, "node_modules/conventional-changelog-ember": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-4.0.0.tgz", @@ -3725,23 +3252,16 @@ "node": ">=16" } }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true - }, - "node_modules/core-js-compat": { - "version": "3.35.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.35.1.tgz", - "integrity": "sha512-sftHa5qUJY3rs9Zht1WEnmkvXputCyDBczPnr7QDgL8n3qrF3CMXY4VPSYtOLLiOUJcah2WNXREd48iOl6mQIw==", + "node_modules/convert-hrtime": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/convert-hrtime/-/convert-hrtime-5.0.0.tgz", + "integrity": "sha512-lOETlkIeYSJWcbbcvjRKGxVMXJR+8+OQb/mTPbA4ObPMytYIsUbuOE0Jzy60hjARYszq1id0j8KgVhC+WGZVTg==", "dev": true, - "dependencies": { - "browserslist": "^4.22.2" + "engines": { + "node": ">=12" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/core-util-is": { @@ -3751,15 +3271,15 @@ "dev": true }, "node_modules/cosmiconfig": { - "version": "8.3.6", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", - "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", "dev": true, "dependencies": { + "env-paths": "^2.2.1", "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", - "parse-json": "^5.2.0", - "path-type": "^4.0.0" + "parse-json": "^5.2.0" }, "engines": { "node": ">=14" @@ -3835,75 +3355,95 @@ } }, "node_modules/dargs": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", - "integrity": "sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/dargs/-/dargs-8.1.0.tgz", + "integrity": "sha512-wAV9QHOsNbwnWdNW2FYvE1P56wtgSbM+3SZcdGiWQILwVjACCXDCI3Ai8QlCjMDB8YK5zySiXZYBiwGmNY3lnw==", "dev": true, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "node_modules/data-view-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", + "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", "dev": true, "dependencies": { - "ms": "2.1.2" + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" }, "engines": { - "node": ">=6.0" + "node": ">= 0.4" }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/decamelize": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", - "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "node_modules/data-view-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", + "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/decamelize-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", - "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", + "node_modules/data-view-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", + "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", "dev": true, "dependencies": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/decamelize-keys/node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, + "dependencies": { + "ms": "2.1.2" + }, "engines": { - "node": ">=0.10.0" + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/decamelize-keys/node_modules/map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", + "node_modules/decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/decompress-response": { @@ -3954,12 +3494,6 @@ "node": ">=4.0.0" } }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, "node_modules/defer-to-connect": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", @@ -3970,17 +3504,20 @@ } }, "node_modules/define-data-property": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", - "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.1", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/define-properties": { @@ -4000,33 +3537,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/deprecation": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", - "dev": true - }, - "node_modules/detect-indent": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-7.0.1.tgz", - "integrity": "sha512-Mc7QhQ8s+cLrnUfU/Ji94vG/r8M26m8f++vyres4ZoojaRDpZ1eSIh/EpzLNwlWuvzSZ3UbDFspjFvTDXe6e/g==", - "dev": true, - "engines": { - "node": ">=12.20" - } - }, - "node_modules/detect-newline": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-4.0.1.tgz", - "integrity": "sha512-qE3Veg1YXzGHQhlA6jzebZN2qVf6NX+A7m7qlhCGG30dJixrAQhYOsJjsnBjJkCSmuOPpCk30145fr8FV0bzog==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/diff-sequences": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", @@ -4048,18 +3558,6 @@ "node": ">=8" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -4081,12 +3579,6 @@ "readable-stream": "^2.0.2" } }, - "node_modules/electron-to-chromium": { - "version": "1.4.656", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.656.tgz", - "integrity": "sha512-9AQB5eFTHyR3Gvt2t/NwR0le2jBSUNwCnMbUCejFWHD+so4tH40/dRLgoE+jxlPeWS43XJewyvCv+I8LPMl49Q==", - "dev": true - }, "node_modules/emoji-regex": { "version": "10.3.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", @@ -4099,19 +3591,6 @@ "integrity": "sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==", "dev": true }, - "node_modules/enhanced-resolve": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", - "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, "node_modules/enquirer": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", @@ -4138,140 +3617,6 @@ "node": "^18.17 || >=20.6.1" } }, - "node_modules/env-ci/node_modules/execa": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", - "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^8.0.1", - "human-signals": "^5.0.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^4.1.0", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": ">=16.17" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/env-ci/node_modules/get-stream": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", - "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/env-ci/node_modules/human-signals": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", - "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", - "dev": true, - "engines": { - "node": ">=16.17.0" - } - }, - "node_modules/env-ci/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/env-ci/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/env-ci/node_modules/npm-run-path": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", - "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", - "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/env-ci/node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/env-ci/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/env-ci/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/env-ci/node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/env-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", @@ -4291,50 +3636,57 @@ } }, "node_modules/es-abstract": { - "version": "1.22.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.3.tgz", - "integrity": "sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==", + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", + "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", "dev": true, "dependencies": { - "array-buffer-byte-length": "^1.0.0", - "arraybuffer.prototype.slice": "^1.0.2", - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.5", - "es-set-tostringtag": "^2.0.1", + "array-buffer-byte-length": "^1.0.1", + "arraybuffer.prototype.slice": "^1.0.3", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "data-view-buffer": "^1.0.1", + "data-view-byte-length": "^1.0.1", + "data-view-byte-offset": "^1.0.0", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.0.3", "es-to-primitive": "^1.2.1", "function.prototype.name": "^1.1.6", - "get-intrinsic": "^1.2.2", - "get-symbol-description": "^1.0.0", + "get-intrinsic": "^1.2.4", + "get-symbol-description": "^1.0.2", "globalthis": "^1.0.3", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0", - "has-proto": "^1.0.1", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", "has-symbols": "^1.0.3", - "hasown": "^2.0.0", - "internal-slot": "^1.0.5", - "is-array-buffer": "^3.0.2", + "hasown": "^2.0.2", + "internal-slot": "^1.0.7", + "is-array-buffer": "^3.0.4", "is-callable": "^1.2.7", - "is-negative-zero": "^2.0.2", + "is-data-view": "^1.0.1", + "is-negative-zero": "^2.0.3", "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", + "is-shared-array-buffer": "^1.0.3", "is-string": "^1.0.7", - "is-typed-array": "^1.1.12", + "is-typed-array": "^1.1.13", "is-weakref": "^1.0.2", "object-inspect": "^1.13.1", "object-keys": "^1.1.1", - "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.5.1", - "safe-array-concat": "^1.0.1", - "safe-regex-test": "^1.0.0", - "string.prototype.trim": "^1.2.8", - "string.prototype.trimend": "^1.0.7", - "string.prototype.trimstart": "^1.0.7", - "typed-array-buffer": "^1.0.0", - "typed-array-byte-length": "^1.0.0", - "typed-array-byte-offset": "^1.0.0", - "typed-array-length": "^1.0.4", + "object.assign": "^4.1.5", + "regexp.prototype.flags": "^1.5.2", + "safe-array-concat": "^1.1.2", + "safe-regex-test": "^1.0.3", + "string.prototype.trim": "^1.2.9", + "string.prototype.trimend": "^1.0.8", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-length": "^1.0.1", + "typed-array-byte-offset": "^1.0.2", + "typed-array-length": "^1.0.6", "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.13" + "which-typed-array": "^1.1.15" }, "engines": { "node": ">= 0.4" @@ -4343,11 +3695,17 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es-array-method-boxes-properly": { + "node_modules/es-define-property": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", - "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", - "dev": true + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } }, "node_modules/es-errors": { "version": "1.3.0", @@ -4358,27 +3716,30 @@ "node": ">= 0.4" } }, - "node_modules/es-set-tostringtag": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz", - "integrity": "sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==", + "node_modules/es-object-atoms": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", + "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.2", - "has-tostringtag": "^1.0.0", - "hasown": "^2.0.0" + "es-errors": "^1.3.0" }, "engines": { "node": ">= 0.4" } }, - "node_modules/es-shim-unscopables": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", - "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", + "node_modules/es-set-tostringtag": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", + "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", "dev": true, "dependencies": { - "hasown": "^2.0.0" + "get-intrinsic": "^1.2.4", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.1" + }, + "engines": { + "node": ">= 0.4" } }, "node_modules/es-to-primitive": { @@ -4405,9 +3766,9 @@ "dev": true }, "node_modules/esbuild": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.0.tgz", - "integrity": "sha512-6iwE3Y2RVYCME1jLpBqq7LQWK3MW6vjV2bZy6gt/WrqkY+WE74Spyc0ThAOYpMtITvnjX09CrC6ym7A/m9mebA==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz", + "integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==", "dev": true, "hasInstallScript": true, "bin": { @@ -4417,29 +3778,29 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.20.0", - "@esbuild/android-arm": "0.20.0", - "@esbuild/android-arm64": "0.20.0", - "@esbuild/android-x64": "0.20.0", - "@esbuild/darwin-arm64": "0.20.0", - "@esbuild/darwin-x64": "0.20.0", - "@esbuild/freebsd-arm64": "0.20.0", - "@esbuild/freebsd-x64": "0.20.0", - "@esbuild/linux-arm": "0.20.0", - "@esbuild/linux-arm64": "0.20.0", - "@esbuild/linux-ia32": "0.20.0", - "@esbuild/linux-loong64": "0.20.0", - "@esbuild/linux-mips64el": "0.20.0", - "@esbuild/linux-ppc64": "0.20.0", - "@esbuild/linux-riscv64": "0.20.0", - "@esbuild/linux-s390x": "0.20.0", - "@esbuild/linux-x64": "0.20.0", - "@esbuild/netbsd-x64": "0.20.0", - "@esbuild/openbsd-x64": "0.20.0", - "@esbuild/sunos-x64": "0.20.0", - "@esbuild/win32-arm64": "0.20.0", - "@esbuild/win32-ia32": "0.20.0", - "@esbuild/win32-x64": "0.20.0" + "@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" } }, "node_modules/escalade": { @@ -4452,670 +3813,446 @@ } }, "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", "dev": true, "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", - "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", "dev": true, "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.56.0", - "@humanwhocodes/config-array": "^0.11.13", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-config-prettier": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", - "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", - "dev": true, - "bin": { - "eslint-config-prettier": "bin/cli.js" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, - "node_modules/eslint-import-resolver-node": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", - "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", - "dev": true, - "dependencies": { - "debug": "^3.2.7", - "is-core-module": "^2.13.0", - "resolve": "^1.22.4" + "@types/estree": "^1.0.0" } }, - "node_modules/eslint-import-resolver-node/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true }, - "node_modules/eslint-import-resolver-typescript": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz", - "integrity": "sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==", + "node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", "dev": true, "dependencies": { - "debug": "^4.3.4", - "enhanced-resolve": "^5.12.0", - "eslint-module-utils": "^2.7.4", - "fast-glob": "^3.3.1", - "get-tsconfig": "^4.5.0", - "is-core-module": "^2.11.0", - "is-glob": "^4.0.3" + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" }, "engines": { - "node": "^14.18.0 || >=16.0.0" + "node": ">=16.17" }, "funding": { - "url": "https://opencollective.com/unts/projects/eslint-import-resolver-ts" - }, - "peerDependencies": { - "eslint": "*", - "eslint-plugin-import": "*" + "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, - "node_modules/eslint-module-utils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", - "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dev": true, "dependencies": { - "debug": "^3.2.7" + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" }, "engines": { - "node": ">=4" - }, - "peerDependenciesMeta": { - "eslint": { - "optional": true - } + "node": ">=8.6.0" } }, - "node_modules/eslint-module-utils/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", "dev": true, "dependencies": { - "ms": "^2.1.1" + "reusify": "^1.0.4" } }, - "node_modules/eslint-plugin-import": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", - "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", + "node_modules/figures": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-6.1.0.tgz", + "integrity": "sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==", "dev": true, "dependencies": { - "array-includes": "^3.1.7", - "array.prototype.findlastindex": "^1.2.3", - "array.prototype.flat": "^1.3.2", - "array.prototype.flatmap": "^1.3.2", - "debug": "^3.2.7", - "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.9", - "eslint-module-utils": "^2.8.0", - "hasown": "^2.0.0", - "is-core-module": "^2.13.1", - "is-glob": "^4.0.3", - "minimatch": "^3.1.2", - "object.fromentries": "^2.0.7", - "object.groupby": "^1.0.1", - "object.values": "^1.1.7", - "semver": "^6.3.1", - "tsconfig-paths": "^3.15.0" + "is-unicode-supported": "^2.0.0" }, "engines": { - "node": ">=4" + "node": ">=18" }, - "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-plugin-import/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==", + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" } }, - "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "node_modules/find-root": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", + "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", + "dev": true + }, + "node_modules/find-up": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-7.0.0.tgz", + "integrity": "sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==", "dev": true, "dependencies": { - "ms": "^2.1.1" + "locate-path": "^7.2.0", + "path-exists": "^5.0.0", + "unicorn-magic": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-plugin-import/node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "node_modules/find-up-simple": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/find-up-simple/-/find-up-simple-1.0.0.tgz", + "integrity": "sha512-q7Us7kcjj2VMePAa02hDAF6d+MzsdsAWEwYyOpwUtlerRBkOEPBCRZrAV4XfcSN8fHAgaD0hP7miwoay6DCprw==", "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, "engines": { - "node": ">=0.10.0" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-plugin-import/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/find-versions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-6.0.0.tgz", + "integrity": "sha512-2kCCtc+JvcZ86IGAz3Z2Y0A1baIz9fL31pH/0S1IqZr9Iwnjq8izfPtrCyQKO6TLMPELLsQMre7VDqeIKCsHkA==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "semver-regex": "^4.0.5", + "super-regex": "^1.0.0" }, "engines": { - "node": "*" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-plugin-import/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", "dev": true, - "bin": { - "semver": "bin/semver.js" + "dependencies": { + "is-callable": "^1.1.3" } }, - "node_modules/eslint-plugin-prettier": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", - "integrity": "sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==", + "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==", "dev": true, - "dependencies": { - "prettier-linter-helpers": "^1.0.0", - "synckit": "^0.8.6" - }, "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint-plugin-prettier" - }, - "peerDependencies": { - "@types/eslint": ">=8.0.0", - "eslint": ">=8.0.0", - "eslint-config-prettier": "*", - "prettier": ">=3.0.0" - }, - "peerDependenciesMeta": { - "@types/eslint": { - "optional": true - }, - "eslint-config-prettier": { - "optional": true - } + "node": ">= 18" } }, - "node_modules/eslint-plugin-unicorn": { - "version": "50.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-50.0.1.tgz", - "integrity": "sha512-KxenCZxqSYW0GWHH18okDlOQcpezcitm5aOSz6EnobyJ6BIByiPDviQRjJIUAjG/tMN11958MxaQ+qCoU6lfDA==", + "node_modules/from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.22.20", - "@eslint-community/eslint-utils": "^4.4.0", - "@eslint/eslintrc": "^2.1.4", - "ci-info": "^4.0.0", - "clean-regexp": "^1.0.0", - "core-js-compat": "^3.34.0", - "esquery": "^1.5.0", - "indent-string": "^4.0.0", - "is-builtin-module": "^3.2.1", - "jsesc": "^3.0.2", - "pluralize": "^8.0.0", - "read-pkg-up": "^7.0.1", - "regexp-tree": "^0.1.27", - "regjsparser": "^0.10.0", - "semver": "^7.5.4", - "strip-indent": "^3.0.0" - }, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" - }, - "peerDependencies": { - "eslint": ">=8.56.0" + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" } }, - "node_modules/eslint-plugin-unicorn/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "node_modules/fs-extra": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", "dev": true, "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" }, "engines": { - "node": ">=8" + "node": ">=14.14" } }, - "node_modules/eslint-plugin-unicorn/node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "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/eslint-plugin-unicorn/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "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, - "dependencies": { - "p-locate": "^4.1.0" - }, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=8" + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint-plugin-unicorn/node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "node_modules/function-timeout": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/function-timeout/-/function-timeout-1.0.1.tgz", + "integrity": "sha512-6yPMImFFuaMPNaTMTBuolA8EanHJWF5Vju0NHpObRURT105J6x1Mf2a7J4P7Sqk2xDxv24N5L0RatEhTBhNmdA==", "dev": true, - "bin": { - "semver": "bin/semver" + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-plugin-unicorn/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", "dev": true, "dependencies": { - "p-try": "^2.0.0" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" }, "engines": { - "node": ">=6" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint-plugin-unicorn/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint-plugin-unicorn/node_modules/read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, "engines": { - "node": ">=8" + "node": "6.* || 8.* || >= 10.*" } }, - "node_modules/eslint-plugin-unicorn/node_modules/read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "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==", "dev": true, - "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-plugin-unicorn/node_modules/read-pkg/node_modules/type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-plugin-unicorn/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "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": ">=8" + "node": "*" } }, - "node_modules/eslint-plugin-unused-imports": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.0.0.tgz", - "integrity": "sha512-sduiswLJfZHeeBJ+MQaG+xYzSWdRXoSw61DpU13mzWumCkR0ufD0HmO4kdNokjrkluMHpj/7PJeN35pgbhW3kw==", + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "dev": true, "dependencies": { - "eslint-rule-composer": "^0.3.0" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^6.0.0", - "eslint": "^8.0.0" + "node": ">= 0.4" }, - "peerDependenciesMeta": { - "@typescript-eslint/eslint-plugin": { - "optional": true - } - } - }, - "node_modules/eslint-rule-composer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", - "integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==", - "dev": true, - "engines": { - "node": ">=4.0.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=16" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "node_modules/get-symbol-description": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", + "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4" + }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">= 0.4" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "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==", "dev": true, "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "resolve-pkg-maps": "^1.0.0" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, - "node_modules/eslint/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==", + "node_modules/git-log-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/git-log-parser/-/git-log-parser-1.2.0.tgz", + "integrity": "sha512-rnCVNfkTL8tdNryFuaY0fYiBWEBcgF748O6ZI61rslBvr2o7U65c2/6npCRqH40vuAhtgtDiqLTJjBVdrejCzA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "argv-formatter": "~1.0.0", + "spawn-error-forwarder": "~1.0.0", + "split2": "~1.0.0", + "stream-combiner2": "~1.1.1", + "through2": "~2.0.0", + "traverse": "~0.6.6" } }, - "node_modules/eslint/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "node_modules/eslint/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/git-log-parser/node_modules/split2": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-1.0.0.tgz", + "integrity": "sha512-NKywug4u4pX/AZBB1FCPzZ6/7O+Xhz1qMVbzTvvKvikjO99oPN87SkK08mEY9P63/5lWjK+wgOOgApnTg5r6qg==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" + "through2": "~2.0.0" } }, - "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "node_modules/git-raw-commits": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-4.0.0.tgz", + "integrity": "sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==", "dev": true, "dependencies": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "dargs": "^8.0.0", + "meow": "^12.0.1", + "split2": "^4.0.0" }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" + "git-raw-commits": "cli.mjs" }, "engines": { - "node": ">=4" + "node": ">=16" } }, - "node_modules/esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "node_modules/git-semver-tags": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-7.0.1.tgz", + "integrity": "sha512-NY0ZHjJzyyNXHTDZmj+GG7PyuAKtMsyWSwh07CR2hOZFa+/yoTsXci/nF2obzL8UDhakFNkD9gNdt/Ed+cxh2Q==", "dev": true, "dependencies": { - "estraverse": "^5.1.0" + "meow": "^12.0.1", + "semver": "^7.5.2" }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "dependencies": { - "estraverse": "^5.2.0" + "bin": { + "git-semver-tags": "cli.mjs" }, "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "dev": true, - "dependencies": { - "@types/estree": "^1.0.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "node": ">=16" } }, - "node_modules/eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", - "dev": true - }, - "node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" + "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" }, "engines": { - "node": ">=10" + "node": "*" }, "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "node_modules/fast-diff": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", - "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", - "dev": true - }, - "node_modules/fast-glob": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", - "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/fast-glob/node_modules/glob-parent": { + "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", @@ -5127,40 +4264,13 @@ "node": ">= 6" } }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "node_modules/fast-safe-stringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", - "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", - "dev": true - }, - "node_modules/fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/figures": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/figures/-/figures-6.0.1.tgz", - "integrity": "sha512-0oY/olScYD4IhQ8u//gCPA4F3mlTn2dacYmiDm/mbDQvpmLjV4uH+zhsQ5IyXRyvqkvtUkXkNdGvg5OFJTCsuQ==", + "node_modules/global-directory": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz", + "integrity": "sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==", "dev": true, "dependencies": { - "is-unicode-supported": "^2.0.0" + "ini": "4.1.1" }, "engines": { "node": ">=18" @@ -5169,181 +4279,161 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", "dev": true, "dependencies": { - "flat-cache": "^3.0.4" + "define-properties": "^1.1.3" }, "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" + "node": ">= 0.4" }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/find-root": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", - "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", - "dev": true - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "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==", "dev": true, "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" + "@sindresorhus/merge-streams": "^2.1.0", + "fast-glob": "^3.3.2", + "ignore": "^5.2.4", + "path-type": "^5.0.0", + "slash": "^5.1.0", + "unicorn-magic": "^0.1.0" }, "engines": { - "node": ">=10" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-up-simple": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/find-up-simple/-/find-up-simple-1.0.0.tgz", - "integrity": "sha512-q7Us7kcjj2VMePAa02hDAF6d+MzsdsAWEwYyOpwUtlerRBkOEPBCRZrAV4XfcSN8fHAgaD0hP7miwoay6DCprw==", + "node_modules/globby/node_modules/path-type": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", + "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", "dev": true, "engines": { - "node": ">=18" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-versions": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-5.1.0.tgz", - "integrity": "sha512-+iwzCJ7C5v5KgcBuueqVoNiHVoQpwiUK5XFLjf0affFTep+Wcw93tPvmb8tqujDNmzhBDPddnWV/qgWSXgq+Hg==", + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "dev": true, "dependencies": { - "semver-regex": "^4.0.5" - }, - "engines": { - "node": ">=12" + "get-intrinsic": "^1.1.3" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/flat-cache": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", - "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "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": { - "flatted": "^3.2.9", - "keyv": "^4.5.3", - "rimraf": "^3.0.2" + "@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": "^10.12.0 || >=12.0.0" + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" } }, - "node_modules/flatted": { - "version": "3.2.9", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", - "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "node_modules/for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, - "dependencies": { - "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/graphql": { + "version": "16.8.1", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz", + "integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==", "dev": true, "engines": { - "node": ">= 18" - } - }, - "node_modules/from2": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", - "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", - "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.0" + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } }, - "node_modules/fs-extra": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", - "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", "dev": true, "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" }, "engines": { - "node": ">=14.14" + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" } }, - "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/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + "node": ">=8" } }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", "dev": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/function.prototype.name": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", - "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "functions-have-names": "^1.2.3" - }, "engines": { "node": ">= 0.4" }, @@ -5351,518 +4441,518 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "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==", + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", "dev": true, + "dependencies": { + "has-symbols": "^1.0.3" + }, "engines": { - "node": ">=18" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/get-func-name": { + "node_modules/hasown": { "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.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.3.tgz", - "integrity": "sha512-JIcZczvcMVE7AUOP+X72bh8HqHBRxFdz5PDHYtNG/lE3yk9b3KZBJlwFcTyPYjg3L4RLLmZJzvjxhaZVapxFrQ==", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dev": true, "dependencies": { - "es-errors": "^1.0.0", - "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" + "function-bind": "^1.1.2" }, "engines": { "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/get-stdin": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-9.0.0.tgz", - "integrity": "sha512-dVKBjfWisLAicarI2Sf+JuBE/DghV4UzNAVe9yhEJuzeREd3JhOTE9cUaJTeSa77fsbQUK3pcOpJfM59+VKZaA==", + "node_modules/highlight.js": { + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", + "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", "dev": true, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "*" } }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "node_modules/hook-std": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hook-std/-/hook-std-3.0.0.tgz", + "integrity": "sha512-jHRQzjSDzMtFy34AGj1DN+vq54WVuhSvKgrHf0OMiFQTwDD4L/qqofVEWjLOBMTn5+lCD3fPg32W9yOfnEJTTw==", "dev": true, "engines": { - "node": ">=10" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "node_modules/hosted-git-info": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz", + "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" + "lru-cache": "^10.0.1" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/get-tsconfig": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.2.tgz", - "integrity": "sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==", + "node_modules/html-escaper": { + "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 + }, + "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, "dependencies": { - "resolve-pkg-maps": "^1.0.0" + "agent-base": "^7.1.0", + "debug": "^4.3.4" }, - "funding": { - "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + "engines": { + "node": ">= 14" } }, - "node_modules/git-hooks-list": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/git-hooks-list/-/git-hooks-list-3.1.0.tgz", - "integrity": "sha512-LF8VeHeR7v+wAbXqfgRlTSX/1BJR9Q1vEMR8JAz1cEg6GX07+zyj3sAdDvYjj/xnlIfVuGgj4qBei1K3hKH+PA==", + "node_modules/http2-client": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/http2-client/-/http2-client-1.3.5.tgz", + "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, - "funding": { - "url": "https://github.com/fisker/git-hooks-list?sponsor=1" + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.2.0" + }, + "engines": { + "node": ">=10.19.0" } }, - "node_modules/git-log-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/git-log-parser/-/git-log-parser-1.2.0.tgz", - "integrity": "sha512-rnCVNfkTL8tdNryFuaY0fYiBWEBcgF748O6ZI61rslBvr2o7U65c2/6npCRqH40vuAhtgtDiqLTJjBVdrejCzA==", + "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==", "dev": true, "dependencies": { - "argv-formatter": "~1.0.0", - "spawn-error-forwarder": "~1.0.0", - "split2": "~1.0.0", - "stream-combiner2": "~1.1.1", - "through2": "~2.0.0", - "traverse": "~0.6.6" + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" } }, - "node_modules/git-log-parser/node_modules/split2": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-1.0.0.tgz", - "integrity": "sha512-NKywug4u4pX/AZBB1FCPzZ6/7O+Xhz1qMVbzTvvKvikjO99oPN87SkK08mEY9P63/5lWjK+wgOOgApnTg5r6qg==", + "node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", "dev": true, - "dependencies": { - "through2": "~2.0.0" + "engines": { + "node": ">=16.17.0" } }, - "node_modules/git-log-parser/node_modules/through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "node_modules/husky": { + "version": "9.0.11", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", + "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", "dev": true, - "dependencies": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" + "bin": { + "husky": "bin.mjs" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" } }, - "node_modules/git-raw-commits": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.11.tgz", - "integrity": "sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A==", + "node_modules/ignore": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "dev": true, - "dependencies": { - "dargs": "^7.0.0", - "lodash": "^4.17.15", - "meow": "^8.0.0", - "split2": "^3.0.0", - "through2": "^4.0.0" - }, - "bin": { - "git-raw-commits": "cli.js" - }, "engines": { - "node": ">=10" + "node": ">= 4" } }, - "node_modules/git-raw-commits/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" }, "engines": { - "node": ">=8" + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/git-raw-commits/node_modules/hosted-git-info": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", - "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, "engines": { - "node": ">=10" + "node": ">=4" } }, - "node_modules/git-raw-commits/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "node_modules/import-from-esm": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/import-from-esm/-/import-from-esm-1.3.4.tgz", + "integrity": "sha512-7EyUlPFC0HOlBDpUFGfYstsU7XHxZJKAAMzCT8wZ0hMW7b+hG51LIKTDcsgtz8Pu6YC0HqRVbX+rVUtsGMUKvg==", "dev": true, "dependencies": { - "p-locate": "^4.1.0" + "debug": "^4.3.4", + "import-meta-resolve": "^4.0.0" }, "engines": { - "node": ">=8" + "node": ">=16.20" } }, - "node_modules/git-raw-commits/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "node_modules/import-meta-resolve": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.0.0.tgz", + "integrity": "sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, "engines": { - "node": ">=10" + "node": ">=8" } }, - "node_modules/git-raw-commits/node_modules/meow": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", - "integrity": "sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==", + "node_modules/index-to-position": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-0.1.2.tgz", + "integrity": "sha512-MWDKS3AS1bGCHLBA2VLImJz42f7bJh8wQsTGCzI3j519/CASStoDONUBVz2I/VID0MpiX3SGSnbOD2xUalbE5g==", "dev": true, - "dependencies": { - "@types/minimist": "^1.2.0", - "camelcase-keys": "^6.2.2", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.0", - "read-pkg-up": "^7.0.1", - "redent": "^3.0.0", - "trim-newlines": "^3.0.0", - "type-fest": "^0.18.0", - "yargs-parser": "^20.2.3" - }, "engines": { - "node": ">=10" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/git-raw-commits/node_modules/normalize-package-data": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", - "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "node_modules/inflection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/inflection/-/inflection-3.0.0.tgz", + "integrity": "sha512-1zEJU1l19SgJlmwqsEyFTbScw/tkMHFenUo//Y0i+XEP83gDFdMvPizAD/WGcE+l1ku12PcTVHQhO6g5E0UCMw==", + "dev": true, + "engines": { + "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==", + "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", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ini": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.1.tgz", + "integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/internal-slot": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", + "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", "dev": true, "dependencies": { - "hosted-git-info": "^4.0.1", - "is-core-module": "^2.5.0", - "semver": "^7.3.4", - "validate-npm-package-license": "^3.0.1" + "es-errors": "^1.3.0", + "hasown": "^2.0.0", + "side-channel": "^1.0.4" }, "engines": { - "node": ">=10" + "node": ">= 0.4" } }, - "node_modules/git-raw-commits/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "node_modules/into-stream": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-7.0.0.tgz", + "integrity": "sha512-2dYz766i9HprMBasCMvHMuazJ7u4WzhJwo5kb3iPSiW/iRYV6uPari3zHoqZlnuaR7V1bEiNMxikhp37rdBXbw==", "dev": true, "dependencies": { - "p-try": "^2.0.0" + "from2": "^2.3.0", + "p-is-promise": "^3.0.0" }, "engines": { - "node": ">=6" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/git-raw-commits/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "node_modules/is-array-buffer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", + "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", "dev": true, "dependencies": { - "p-limit": "^2.2.0" + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/git-raw-commits/node_modules/read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", "dev": true, "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" + "has-bigints": "^1.0.1" }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/git-raw-commits/node_modules/read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", "dev": true, "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/git-raw-commits/node_modules/read-pkg-up/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "dev": true, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/git-raw-commits/node_modules/read-pkg/node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, - "node_modules/git-raw-commits/node_modules/read-pkg/node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "node_modules/is-ci": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz", + "integrity": "sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==", "dev": true, "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" + "ci-info": "^3.2.0" + }, + "bin": { + "is-ci": "bin.js" } }, - "node_modules/git-raw-commits/node_modules/read-pkg/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, - "bin": { - "semver": "bin/semver" + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/git-raw-commits/node_modules/read-pkg/node_modules/type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "node_modules/is-data-view": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", + "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", "dev": true, + "dependencies": { + "is-typed-array": "^1.1.13" + }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/git-raw-commits/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", "dev": true, "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">= 6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/git-raw-commits/node_modules/split2": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", - "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, - "dependencies": { - "readable-stream": "^3.0.0" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/git-raw-commits/node_modules/type-fest": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", - "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", "dev": true, "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/git-raw-commits/node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/git-semver-tags": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-7.0.1.tgz", - "integrity": "sha512-NY0ZHjJzyyNXHTDZmj+GG7PyuAKtMsyWSwh07CR2hOZFa+/yoTsXci/nF2obzL8UDhakFNkD9gNdt/Ed+cxh2Q==", + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "dependencies": { - "meow": "^12.0.1", - "semver": "^7.5.2" - }, - "bin": { - "git-semver-tags": "cli.mjs" + "is-extglob": "^2.1.1" }, "engines": { - "node": ">=16" + "node": ">=0.10.0" } }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", "dev": true, - "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" - }, "engines": { - "node": "*" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, - "dependencies": { - "is-glob": "^4.0.3" - }, "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/glob/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==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "node": ">=0.12.0" } }, - "node_modules/glob/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "has-tostringtag": "^1.0.0" }, "engines": { - "node": "*" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/global-dirs": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", - "integrity": "sha512-NknMLn7F2J7aflwFOlGdNIuCDpN3VGoSoB+aap3KABFWbHVn1TCgFC+np23J8W2BiZbjfEw3BFBycSMv1AFblg==", + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", "dev": true, - "dependencies": { - "ini": "^1.3.4" - }, "engines": { - "node": ">=4" + "node": ">=8" } }, - "node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", "dev": true, "dependencies": { - "type-fest": "^0.20.2" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/globalthis": { + "node_modules/is-shared-array-buffer": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", - "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", + "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", "dev": true, "dependencies": { - "define-properties": "^1.1.3" + "call-bind": "^1.0.7" }, "engines": { "node": ">= 0.4" @@ -5871,152 +4961,68 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, "engines": { - "node": ">=10" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/got": { - "version": "14.2.0", - "resolved": "https://registry.npmjs.org/got/-/got-14.2.0.tgz", - "integrity": "sha512-dBq2KkHcQl3AwPoIWsLsQScCPpUgRulz1qZVthjPYKYOPmYfBnekR3vxecjZbm91Vc3JUGnV9mqFX7B+Fe2quw==", + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", "dev": true, "dependencies": { - "@sindresorhus/is": "^6.1.0", - "@szmarczak/http-timer": "^5.0.1", - "cacheable-lookup": "^7.0.0", - "cacheable-request": "^10.2.14", - "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" + "has-tostringtag": "^1.0.0" }, - "funding": { - "url": "https://github.com/sindresorhus/got?sponsor=1" - } - }, - "node_modules/got/node_modules/get-stream": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", - "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", - "dev": true, "engines": { - "node": ">=16" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true - }, - "node_modules/handlebars": { - "version": "4.7.8", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", - "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", "dev": true, "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.2", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" + "has-symbols": "^1.0.2" }, "engines": { - "node": ">=0.4.7" + "node": ">= 0.4" }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, - "node_modules/hard-rejection": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", - "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/has-bigints": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", - "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/is-text-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz", + "integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==", "dev": true, + "dependencies": { + "text-extensions": "^2.0.0" + }, "engines": { "node": ">=8" } }, - "node_modules/has-property-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", - "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "node_modules/is-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.2" + "which-typed-array": "^1.1.14" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -6024,6106 +5030,3926 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "node_modules/is-unicode-supported": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.0.0.tgz", + "integrity": "sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==", "dev": true, "engines": { - "node": ">= 0.4" + "node": ">=18" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/has-tostringtag": { + "node_modules/is-weakref": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", - "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", "dev": true, "dependencies": { - "has-symbols": "^1.0.3" - }, - "engines": { - "node": ">= 0.4" + "call-bind": "^1.0.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/hasown": { + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, + "node_modules/isexe": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", - "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "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==", "dev": true, "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/hook-std": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hook-std/-/hook-std-3.0.0.tgz", - "integrity": "sha512-jHRQzjSDzMtFy34AGj1DN+vq54WVuhSvKgrHf0OMiFQTwDD4L/qqofVEWjLOBMTn5+lCD3fPg32W9yOfnEJTTw==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "lodash.capitalize": "^4.2.1", + "lodash.escaperegexp": "^4.1.2", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.uniqby": "^4.7.0" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": "^18.17 || >=20.6.1" } }, - "node_modules/hosted-git-info": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz", - "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==", + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", "dev": true, - "dependencies": { - "lru-cache": "^10.0.1" - }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": ">=8" } }, - "node_modules/html-escaper": { - "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 - }, - "node_modules/http-proxy-agent": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", - "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, "dependencies": { - "agent-base": "^7.1.0", - "debug": "^4.3.4" + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" }, "engines": { - "node": ">= 14" + "node": ">=10" } }, - "node_modules/http2-client": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/http2-client/-/http2-client-1.3.5.tgz", - "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==", + "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==", "dev": true, "dependencies": { - "quick-lru": "^5.1.1", - "resolve-alpn": "^1.2.0" + "@jridgewell/trace-mapping": "^0.3.23", + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0" }, "engines": { - "node": ">=10.19.0" + "node": ">=10" } }, - "node_modules/https-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", - "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "node_modules/istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", "dev": true, "dependencies": { - "agent-base": "^7.0.2", - "debug": "4" + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" }, "engines": { - "node": ">= 14" + "node": ">=8" } }, - "node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "node_modules/java-properties": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/java-properties/-/java-properties-1.0.2.tgz", + "integrity": "sha512-qjdpeo2yKlYTH7nFdK0vbZWuTCesk4o63v5iVOlhMQPfuIZQfW/HI35SjfhA+4qpg36rnFSvUK5b1m+ckIblQQ==", "dev": true, "engines": { - "node": ">=10.17.0" + "node": ">= 0.6.0" } }, - "node_modules/husky": { - "version": "9.0.10", - "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.10.tgz", - "integrity": "sha512-TQGNknoiy6bURzIO77pPRu+XHi6zI7T93rX+QnJsoYFf3xdjKOur+IlfqzJGMHIK/wXrLg+GsvMs8Op7vI2jVA==", + "node_modules/jiti": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", "dev": true, "bin": { - "husky": "bin.mjs" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/typicode" + "jiti": "bin/jiti.js" } }, - "node_modules/ignore": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", - "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", - "dev": true, - "engines": { - "node": ">= 4" - } + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" + "argparse": "^2.0.1" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/import-fresh/node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "engines": { - "node": ">=4" - } + "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/import-from-esm": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/import-from-esm/-/import-from-esm-1.3.3.tgz", - "integrity": "sha512-U3Qt/CyfFpTUv6LOP2jRTLYjphH6zg3okMfHbyqRa/W2w6hr8OsJWVggNlR4jxuojQy81TgTJTxgSkyoteRGMQ==", + "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", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, "dependencies": { - "debug": "^4.3.4", - "import-meta-resolve": "^4.0.0" + "universalify": "^2.0.0" }, - "engines": { - "node": ">=16.20" + "optionalDependencies": { + "graceful-fs": "^4.1.6" } }, - "node_modules/import-meta-resolve": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.0.0.tgz", - "integrity": "sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA==", + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } + "engines": [ + "node >= 0.2.0" + ] }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "node_modules/jsonpointer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz", + "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==", "dev": true, "engines": { - "node": ">=0.8.19" + "node": ">=0.10.0" } }, - "node_modules/indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", "dev": true, + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, "engines": { - "node": ">=8" + "node": "*" } }, - "node_modules/index-to-position": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-0.1.2.tgz", - "integrity": "sha512-MWDKS3AS1bGCHLBA2VLImJz42f7bJh8wQsTGCzI3j519/CASStoDONUBVz2I/VID0MpiX3SGSnbOD2xUalbE5g==", + "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==", "dev": true, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "dependencies": { + "json-buffer": "3.0.1" } }, - "node_modules/inflection": { + "node_modules/levdist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/levdist/-/levdist-1.0.0.tgz", + "integrity": "sha512-YguwC2spb0pqpJM3a5OsBhih/GG2ZHoaSHnmBqhEI7997a36buhqcRTegEjozHxyxByIwLpZHZTVYMThq+Zd3g==", + "dev": true + }, + "node_modules/lilconfig": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/inflection/-/inflection-3.0.0.tgz", - "integrity": "sha512-1zEJU1l19SgJlmwqsEyFTbScw/tkMHFenUo//Y0i+XEP83gDFdMvPizAD/WGcE+l1ku12PcTVHQhO6g5E0UCMw==", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.0.0.tgz", + "integrity": "sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==", "dev": true, "engines": { - "node": ">=18.0.0" + "node": ">=14" } }, - "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==", + "node_modules/line-diff": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/line-diff/-/line-diff-2.1.1.tgz", + "integrity": "sha512-vswdynAI5AMPJacOo2o+JJ4caDJbnY2NEqms4MhMW0NJbjh3skP/brpVTAgBxrg55NRZ2Vtw88ef18hnagIpYQ==", "dev": true, "dependencies": { - "once": "^1.3.0", - "wrappy": "1" + "levdist": "^1.0.0" } }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, - "node_modules/internal-slot": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.6.tgz", - "integrity": "sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==", + "node_modules/lint-staged": { + "version": "15.2.2", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.2.tgz", + "integrity": "sha512-TiTt93OPh1OZOsb5B7k96A/ATl2AjIZo+vnzFZ6oHK5FuTk63ByDtxGQpHm+kFETjEWqgkF95M8FRXKR/LEBcw==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.2", - "hasown": "^2.0.0", - "side-channel": "^1.0.4" + "chalk": "5.3.0", + "commander": "11.1.0", + "debug": "4.3.4", + "execa": "8.0.1", + "lilconfig": "3.0.0", + "listr2": "8.0.1", + "micromatch": "4.0.5", + "pidtree": "0.6.0", + "string-argv": "0.3.2", + "yaml": "2.3.4" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" }, "engines": { - "node": ">= 0.4" + "node": ">=18.12.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" } }, - "node_modules/into-stream": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-7.0.0.tgz", - "integrity": "sha512-2dYz766i9HprMBasCMvHMuazJ7u4WzhJwo5kb3iPSiW/iRYV6uPari3zHoqZlnuaR7V1bEiNMxikhp37rdBXbw==", + "node_modules/listr2": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.0.1.tgz", + "integrity": "sha512-ovJXBXkKGfq+CwmKTjluEqFi3p4h8xvkxGQQAQan22YCgef4KZ1mKGjzfGh6PL6AW5Csw0QiQPNuQyH+6Xk3hA==", "dev": true, "dependencies": { - "from2": "^2.3.0", - "p-is-promise": "^3.0.0" + "cli-truncate": "^4.0.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^6.0.0", + "rfdc": "^1.3.0", + "wrap-ansi": "^9.0.0" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=18.0.0" } }, - "node_modules/is-array-buffer": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", - "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1" + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=4" } }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true - }, - "node_modules/is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "node_modules/load-json-file/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", "dev": true, "dependencies": { - "has-bigints": "^1.0.1" + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">=4" } }, - "node_modules/is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "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": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "mlly": "^1.4.2", + "pkg-types": "^1.0.3" }, "engines": { - "node": ">= 0.4" + "node": ">=14" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/antfu" } }, - "node_modules/is-builtin-module": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", - "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", + "node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", "dev": true, "dependencies": { - "builtin-modules": "^3.3.0" + "p-locate": "^6.0.0" }, "engines": { - "node": ">=6" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", + "dev": true + }, + "node_modules/lodash.camelcase": { + "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 + }, + "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 + }, + "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 + }, + "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 + }, + "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 + }, + "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 + }, + "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 + }, + "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 + }, + "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 + }, + "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 + }, + "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 + }, + "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 + }, + "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 + }, + "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==", "dev": true, + "dependencies": { + "ansi-escapes": "^6.2.0", + "cli-cursor": "^4.0.0", + "slice-ansi": "^7.0.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, "engines": { - "node": ">= 0.4" + "node": ">=18" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-ci": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz", - "integrity": "sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==", + "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==", "dev": true, - "dependencies": { - "ci-info": "^3.2.0" + "engines": { + "node": ">=12" }, - "bin": { - "is-ci": "bin.js" - } - }, - "node_modules/is-ci/node_modules/ci-info": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", - "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, - "node_modules/is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "node_modules/log-update/node_modules/is-fullwidth-code-point": { + "version": "5.0.0", + "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, "dependencies": { - "hasown": "^2.0.0" + "get-east-asian-width": "^1.0.0" + }, + "engines": { + "node": ">=18" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "node_modules/log-update/node_modules/slice-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.0.tgz", + "integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==", "dev": true, "dependencies": { - "has-tostringtag": "^1.0.0" + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" }, "engines": { - "node": ">= 0.4" + "node": ">=18" }, "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/is-fullwidth-code-point": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", - "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "node_modules/log-update/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, + "dependencies": { + "ansi-regex": "^6.0.1" + }, "engines": { "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "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": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" + "get-func-name": "^2.0.1" } }, - "node_modules/is-negative-zero": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", - "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "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==", "dev": true, "engines": { - "node": ">= 0.4" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "node_modules/lru-cache": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", + "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", "dev": true, "engines": { - "node": ">=0.12.0" + "node": "14 || >=16.14" } }, - "node_modules/is-number-object": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", - "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "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==", "dev": true, "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true, - "engines": { - "node": ">=8" + "@jridgewell/sourcemap-codec": "^1.4.15" } }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "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==", "dev": true, - "engines": { - "node": ">=8" + "dependencies": { + "@babel/parser": "^7.24.4", + "@babel/types": "^7.24.0", + "source-map-js": "^1.2.0" } }, - "node_modules/is-plain-obj": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", - "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, "engines": { - "node": ">=12" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "node_modules/make-synchronous": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/make-synchronous/-/make-synchronous-1.0.0.tgz", + "integrity": "sha512-IgPLsc2Pf6c7qiIGRQiE8ns0GaCdHmwfz1dJBqJAOwMN2naVp9+JlirSqNPYlGsDSrNRCgVqEiPOieaNqWxeqA==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "subsume": "^4.0.0", + "type-fest": "^2.3.3" }, "engines": { - "node": ">= 0.4" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-shared-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", - "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "node_modules/make-synchronous/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", "dev": true, - "dependencies": { - "call-bind": "^1.0.2" + "engines": { + "node": ">=12.20" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "node_modules/marked": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-12.0.2.tgz", + "integrity": "sha512-qXUm7e/YKFoqFPYPa3Ukg9xlI5cyAtGmyEIzMfW//m6kXwCy2Ps9DYf5ioijFKQ8qyuscrHoY04iJGctu2Kg0Q==", "dev": true, - "engines": { - "node": ">=8" + "bin": { + "marked": "bin/marked.js" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": ">= 18" } }, - "node_modules/is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "node_modules/marked-terminal": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/marked-terminal/-/marked-terminal-7.0.0.tgz", + "integrity": "sha512-sNEx8nn9Ktcm6pL0TnRz8tnXq/mSS0Q1FRSwJOAqw4lAB4l49UeDf85Gm1n9RPFm5qurCPjwi1StAQT2XExhZw==", "dev": true, "dependencies": { - "has-tostringtag": "^1.0.0" + "ansi-escapes": "^6.2.0", + "chalk": "^5.3.0", + "cli-highlight": "^2.1.11", + "cli-table3": "^0.6.3", + "node-emoji": "^2.1.3", + "supports-hyperlinks": "^3.0.0" }, "engines": { - "node": ">= 0.4" + "node": ">=16.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "peerDependencies": { + "marked": ">=1 <13" } }, - "node_modules/is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "node_modules/meow": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", + "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", "dev": true, - "dependencies": { - "has-symbols": "^1.0.2" - }, "engines": { - "node": ">= 0.4" + "node": ">=16.10" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-text-path": { + "node_modules/merge-stream": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz", - "integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, - "dependencies": { - "text-extensions": "^2.0.0" - }, "engines": { - "node": ">=8" + "node": ">= 8" } }, - "node_modules/is-typed-array": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", - "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "dependencies": { - "which-typed-array": "^1.1.14" + "braces": "^3.0.2", + "picomatch": "^2.3.1" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=8.6" } }, - "node_modules/is-unicode-supported": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.0.0.tgz", - "integrity": "sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==", + "node_modules/mime": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-4.0.1.tgz", + "integrity": "sha512-5lZ5tyrIfliMXzFtkYyekWbtRXObT9OWa8IwQ5uxTBDHucNNwniRqo0yInflj+iYi5CBa6qxadGzGarDfuEOxA==", "dev": true, - "engines": { - "node": ">=18" + "funding": [ + "https://github.com/sponsors/broofa" + ], + "bin": { + "mime": "bin/cli.js" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": ">=16" } }, - "node_modules/is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", "dev": true, - "dependencies": { - "call-bind": "^1.0.2" + "engines": { + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/issue-parser": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-6.0.0.tgz", - "integrity": "sha512-zKa/Dxq2lGsBIXQ7CUZWTHfvxPC2ej0KfO7fIPqLlHB9J2hJ7rGhZ5rilhuufylr4RXYPzJUeFjKxz305OsNlA==", - "dev": true, - "dependencies": { - "lodash.capitalize": "^4.2.1", - "lodash.escaperegexp": "^4.1.2", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.uniqby": "^4.7.0" - }, - "engines": { - "node": ">=10.13" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", - "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "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==", "dev": true, "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", - "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", - "dev": true, - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^4.0.0", - "supports-color": "^7.1.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, - "engines": { - "node": ">=10" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=10" + "node": "*" } }, - "node_modules/istanbul-reports": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", - "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true, - "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/java-properties": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/java-properties/-/java-properties-1.0.2.tgz", - "integrity": "sha512-qjdpeo2yKlYTH7nFdK0vbZWuTCesk4o63v5iVOlhMQPfuIZQfW/HI35SjfhA+4qpg36rnFSvUK5b1m+ckIblQQ==", + "node_modules/mlly": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.6.1.tgz", + "integrity": "sha512-vLgaHvaeunuOXHSmEbZ9izxPx3USsk8KCQ8iC+aTlp5sKRSoZvwhHh5L9VbKSaVC6sJDqbyohIS76E2VmHIPAA==", "dev": true, - "engines": { - "node": ">= 0.6.0" + "dependencies": { + "acorn": "^8.11.3", + "pathe": "^1.1.2", + "pkg-types": "^1.0.3", + "ufo": "^1.3.2" } }, - "node_modules/jiti": { - "version": "1.21.0", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", - "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", + "node_modules/mnemonist": { + "version": "0.39.8", + "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.39.8.tgz", + "integrity": "sha512-vyWo2K3fjrUw8YeeZ1zF0fy6Mu59RHokURlld8ymdUPjMlD9EC9ov1/YPqTgqRvUN9nTr3Gqfz29LYAmu0PHPQ==", "dev": true, - "bin": { - "jiti": "bin/jiti.js" + "dependencies": { + "obliterator": "^2.0.1" } }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "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 }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", "dev": true, "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" } }, - "node_modules/jsesc": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", - "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", + "node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "bin": { - "jsesc": "bin/jsesc" + "nanoid": "bin/nanoid.cjs" }, "engines": { - "node": ">=6" + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "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", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, - "node_modules/json-schema-traverse": { + "node_modules/nerf-dart": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "resolved": "https://registry.npmjs.org/nerf-dart/-/nerf-dart-1.0.0.tgz", + "integrity": "sha512-EZSPZB70jiVsivaBLYDCyntd5eH8NTSMOn3rB+HxwdmKThGELLdYv8qVIMWvZEFy9w8ZZpW9h9OB32l1rGtj7g==", "dev": true }, - "node_modules/json5": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "node_modules/nock": { + "version": "13.5.4", + "resolved": "https://registry.npmjs.org/nock/-/nock-13.5.4.tgz", + "integrity": "sha512-yAyTfdeNJGGBFxWdzSKCBYxs5FxLbCg5X5Q4ets974hcQzG1+qCxvIyOo4j2Ry6MUlhWVMX4OoYDefAIIwupjw==", "dev": true, "dependencies": { - "minimist": "^1.2.0" + "debug": "^4.1.0", + "json-stringify-safe": "^5.0.1", + "propagate": "^2.0.0" }, - "bin": { - "json5": "lib/cli.js" + "engines": { + "node": ">= 10.13" } }, - "node_modules/jsonc-parser": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", - "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", - "dev": true - }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "node_modules/node-emoji": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.1.3.tgz", + "integrity": "sha512-E2WEOVsgs7O16zsURJ/eH8BqhF029wGpEOnv7Urwdo2wmQanOACwJQh0devF9D9RhoZru0+9JXIS0dBXIAz+lA==", "dev": true, "dependencies": { - "universalify": "^2.0.0" + "@sindresorhus/is": "^4.6.0", + "char-regex": "^1.0.2", + "emojilib": "^2.4.0", + "skin-tone": "^2.0.0" }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" + "engines": { + "node": ">=18" } }, - "node_modules/jsonparse": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", - "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", - "dev": true, - "engines": [ - "node >= 0.2.0" - ] - }, - "node_modules/jsonpointer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz", - "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==", + "node_modules/node-emoji/node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" } }, - "node_modules/JSONStream": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", - "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dev": true, "dependencies": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - }, - "bin": { - "JSONStream": "bin.js" + "whatwg-url": "^5.0.0" }, "engines": { - "node": "*" + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } } }, - "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==", - "dev": true, - "dependencies": { - "json-buffer": "3.0.1" - } - }, - "node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/levdist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/levdist/-/levdist-1.0.0.tgz", - "integrity": "sha512-YguwC2spb0pqpJM3a5OsBhih/GG2ZHoaSHnmBqhEI7997a36buhqcRTegEjozHxyxByIwLpZHZTVYMThq+Zd3g==", - "dev": true - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "node_modules/node-fetch-h2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/node-fetch-h2/-/node-fetch-h2-2.3.0.tgz", + "integrity": "sha512-ofRW94Ab0T4AOh5Fk8t0h8OBWrmjb0SSB20xh1H8YnPV9EJ+f5AMoYSUQ2zgJ4Iq2HAK0I2l5/Nequ8YzFS3Hg==", "dev": true, "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" + "http2-client": "^1.2.5" }, "engines": { - "node": ">= 0.8.0" + "node": "4.x || >=6.0.0" } }, - "node_modules/lilconfig": { + "node_modules/node-object-hash": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.0.0.tgz", - "integrity": "sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==", + "resolved": "https://registry.npmjs.org/node-object-hash/-/node-object-hash-3.0.0.tgz", + "integrity": "sha512-jLF6tlyletktvSAawuPmH1SReP0YfZQ+tBrDiTCK+Ai7eXPMS9odi5xW/iKC7ZhrWJJ0Z5xYcW/x+1fVMn1Qvw==", "dev": true, "engines": { - "node": ">=14" - } - }, - "node_modules/line-diff": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/line-diff/-/line-diff-2.1.1.tgz", - "integrity": "sha512-vswdynAI5AMPJacOo2o+JJ4caDJbnY2NEqms4MhMW0NJbjh3skP/brpVTAgBxrg55NRZ2Vtw88ef18hnagIpYQ==", - "dev": true, - "dependencies": { - "levdist": "^1.0.0" + "node": ">=16", + "pnpm": ">=8" } }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true - }, - "node_modules/lint-staged": { - "version": "15.2.2", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.2.tgz", - "integrity": "sha512-TiTt93OPh1OZOsb5B7k96A/ATl2AjIZo+vnzFZ6oHK5FuTk63ByDtxGQpHm+kFETjEWqgkF95M8FRXKR/LEBcw==", + "node_modules/node-readfiles": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/node-readfiles/-/node-readfiles-0.2.0.tgz", + "integrity": "sha512-SU00ZarexNlE4Rjdm83vglt5Y9yiQ+XI1XpflWlb7q7UTN1JUItm69xMeiQCTxtTfnzt+83T8Cx+vI2ED++VDA==", "dev": true, "dependencies": { - "chalk": "5.3.0", - "commander": "11.1.0", - "debug": "4.3.4", - "execa": "8.0.1", - "lilconfig": "3.0.0", - "listr2": "8.0.1", - "micromatch": "4.0.5", - "pidtree": "0.6.0", - "string-argv": "0.3.2", - "yaml": "2.3.4" - }, - "bin": { - "lint-staged": "bin/lint-staged.js" - }, - "engines": { - "node": ">=18.12.0" - }, - "funding": { - "url": "https://opencollective.com/lint-staged" - } - }, - "node_modules/lint-staged/node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "dev": true, - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "es6-promise": "^3.2.1" } }, - "node_modules/lint-staged/node_modules/execa": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", - "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "node_modules/normalize-package-data": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.0.tgz", + "integrity": "sha512-UL7ELRVxYBHBgYEtZCXjxuD5vPxnmvMGq0jp/dGPKKrN7tfsBh2IY7TlJ15WWwdjRWD3RJbnsygUurTK3xkPkg==", "dev": true, "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^8.0.1", - "human-signals": "^5.0.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^4.1.0", - "strip-final-newline": "^3.0.0" + "hosted-git-info": "^7.0.0", + "is-core-module": "^2.8.1", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" }, "engines": { - "node": ">=16.17" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/lint-staged/node_modules/get-stream": { + "node_modules/normalize-url": { "version": "8.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", - "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lint-staged/node_modules/human-signals": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", - "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", - "dev": true, - "engines": { - "node": ">=16.17.0" - } - }, - "node_modules/lint-staged/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lint-staged/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lint-staged/node_modules/npm-run-path": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", - "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.1.tgz", + "integrity": "sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w==", "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lint-staged/node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "node_modules/npm": { + "version": "10.5.2", + "resolved": "https://registry.npmjs.org/npm/-/npm-10.5.2.tgz", + "integrity": "sha512-cHVG7QEJwJdZyOrK0dKX5uf3R5Fd0E8AcmSES1jLtO52UT1enUKZ96Onw/xwq4CbrTZEnDuu2Vf9kCQh/Sd12w==", + "bundleDependencies": [ + "@isaacs/string-locale-compare", + "@npmcli/arborist", + "@npmcli/config", + "@npmcli/fs", + "@npmcli/map-workspaces", + "@npmcli/package-json", + "@npmcli/promise-spawn", + "@npmcli/redact", + "@npmcli/run-script", + "@sigstore/tuf", + "abbrev", + "archy", + "cacache", + "chalk", + "ci-info", + "cli-columns", + "cli-table3", + "columnify", + "fastest-levenshtein", + "fs-minipass", + "glob", + "graceful-fs", + "hosted-git-info", + "ini", + "init-package-json", + "is-cidr", + "json-parse-even-better-errors", + "libnpmaccess", + "libnpmdiff", + "libnpmexec", + "libnpmfund", + "libnpmhook", + "libnpmorg", + "libnpmpack", + "libnpmpublish", + "libnpmsearch", + "libnpmteam", + "libnpmversion", + "make-fetch-happen", + "minimatch", + "minipass", + "minipass-pipeline", + "ms", + "node-gyp", + "nopt", + "normalize-package-data", + "npm-audit-report", + "npm-install-checks", + "npm-package-arg", + "npm-pick-manifest", + "npm-profile", + "npm-registry-fetch", + "npm-user-validate", + "npmlog", + "p-map", + "pacote", + "parse-conflict-json", + "proc-log", + "qrcode-terminal", + "read", + "semver", + "spdx-expression-parse", + "ssri", + "supports-color", + "tar", + "text-table", + "tiny-relative-date", + "treeverse", + "validate-npm-package-name", + "which", + "write-file-atomic" + ], "dev": true, "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lint-staged/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lint-staged/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/lint-staged/node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/listr2": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.0.1.tgz", - "integrity": "sha512-ovJXBXkKGfq+CwmKTjluEqFi3p4h8xvkxGQQAQan22YCgef4KZ1mKGjzfGh6PL6AW5Csw0QiQPNuQyH+6Xk3hA==", - "dev": true, - "dependencies": { - "cli-truncate": "^4.0.0", - "colorette": "^2.0.20", - "eventemitter3": "^5.0.1", - "log-update": "^6.0.0", - "rfdc": "^1.3.0", - "wrap-ansi": "^9.0.0" - }, - "engines": { - "node": ">=18.0.0" - } - }, - "node_modules/load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/load-json-file/node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", - "dev": true, - "dependencies": { - "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" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "node_modules/lodash-es": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", - "dev": true - }, - "node_modules/lodash.camelcase": { - "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 - }, - "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 - }, - "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 - }, - "node_modules/lodash.isfunction": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz", - "integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==", - "dev": true - }, - "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 - }, - "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 - }, - "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 - }, - "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 - }, - "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 - }, - "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 - }, - "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 - }, - "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 - }, - "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 - }, - "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 - }, - "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==", - "dev": true, - "dependencies": { - "ansi-escapes": "^6.2.0", - "cli-cursor": "^4.0.0", - "slice-ansi": "^7.0.0", - "strip-ansi": "^7.1.0", - "wrap-ansi": "^9.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==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/log-update/node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/log-update/node_modules/is-fullwidth-code-point": { - "version": "5.0.0", - "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, - "dependencies": { - "get-east-asian-width": "^1.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/log-update/node_modules/slice-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.0.tgz", - "integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==", - "dev": true, - "dependencies": { - "ansi-styles": "^6.2.1", - "is-fullwidth-code-point": "^5.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" - } - }, - "node_modules/log-update/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, - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "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==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lru-cache": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", - "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", - "dev": true, - "engines": { - "node": "14 || >=16.14" - } - }, - "node_modules/magic-string": { - "version": "0.30.7", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.7.tgz", - "integrity": "sha512-8vBuFF/I/+OSLRmdf2wwFCJCz+nSn0m6DPvGH1fS/KiQoSaR+sETbov0eIk9KhEKy8CYqIkIAnbohxT/4H0kuA==", - "dev": true, - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/magicast": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.3.tgz", - "integrity": "sha512-ZbrP1Qxnpoes8sz47AM0z08U+jW6TyRgZzcWy3Ma3vDhJttwMwAFDMMQFobwdBxByBD46JYmxRzeF7w2+wJEuw==", - "dev": true, - "dependencies": { - "@babel/parser": "^7.23.6", - "@babel/types": "^7.23.6", - "source-map-js": "^1.0.2" - } - }, - "node_modules/make-dir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", - "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", - "dev": true, - "dependencies": { - "semver": "^7.5.3" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-synchronous": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/make-synchronous/-/make-synchronous-1.0.0.tgz", - "integrity": "sha512-IgPLsc2Pf6c7qiIGRQiE8ns0GaCdHmwfz1dJBqJAOwMN2naVp9+JlirSqNPYlGsDSrNRCgVqEiPOieaNqWxeqA==", - "dev": true, - "dependencies": { - "subsume": "^4.0.0", - "type-fest": "^2.3.3" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-synchronous/node_modules/type-fest": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", - "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/map-obj": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", - "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/marked": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-11.2.0.tgz", - "integrity": "sha512-HR0m3bvu0jAPYiIvLUUQtdg1g6D247//lvcekpHO1WMvbwDlwSkZAX9Lw4F4YHE1T0HaaNve0tuAWuV1UJ6vtw==", - "dev": true, - "bin": { - "marked": "bin/marked.js" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/marked-terminal": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/marked-terminal/-/marked-terminal-6.2.0.tgz", - "integrity": "sha512-ubWhwcBFHnXsjYNsu+Wndpg0zhY4CahSpPlA70PlO0rR9r2sZpkyU+rkCsOWH+KMEkx847UpALON+HWgxowFtw==", - "dev": true, - "dependencies": { - "ansi-escapes": "^6.2.0", - "cardinal": "^2.1.1", - "chalk": "^5.3.0", - "cli-table3": "^0.6.3", - "node-emoji": "^2.1.3", - "supports-hyperlinks": "^3.0.0" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "marked": ">=1 <12" - } - }, - "node_modules/marked-terminal/node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "dev": true, - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/meow": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", - "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", - "dev": true, - "engines": { - "node": ">=16.10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mime": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-4.0.1.tgz", - "integrity": "sha512-5lZ5tyrIfliMXzFtkYyekWbtRXObT9OWa8IwQ5uxTBDHucNNwniRqo0yInflj+iYi5CBa6qxadGzGarDfuEOxA==", - "dev": true, - "funding": [ - "https://github.com/sponsors/broofa" - ], - "bin": { - "mime": "bin/cli.js" - }, - "engines": { - "node": ">=16" - } - }, - "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/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==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/min-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", - "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/minimist-options": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", - "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", - "dev": true, - "dependencies": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0", - "kind-of": "^6.0.3" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/minimist-options/node_modules/is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/mlly": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.5.0.tgz", - "integrity": "sha512-NPVQvAY1xr1QoVeG0cy8yUYC7FQcOx6evl/RjT1wL5FvzPnzOysoqB/jmx/DhssT2dYa8nxECLAaFI/+gVLhDQ==", - "dev": true, - "dependencies": { - "acorn": "^8.11.3", - "pathe": "^1.1.2", - "pkg-types": "^1.0.3", - "ufo": "^1.3.2" - } - }, - "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 - }, - "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true - }, - "node_modules/nerf-dart": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/nerf-dart/-/nerf-dart-1.0.0.tgz", - "integrity": "sha512-EZSPZB70jiVsivaBLYDCyntd5eH8NTSMOn3rB+HxwdmKThGELLdYv8qVIMWvZEFy9w8ZZpW9h9OB32l1rGtj7g==", - "dev": true - }, - "node_modules/nock": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/nock/-/nock-13.5.1.tgz", - "integrity": "sha512-+s7b73fzj5KnxbKH4Oaqz07tQ8degcMilU4rrmnKvI//b0JMBU4wEXFQ8zqr+3+L4eWSfU3H/UoIVGUV0tue1Q==", - "dev": true, - "dependencies": { - "debug": "^4.1.0", - "json-stringify-safe": "^5.0.1", - "propagate": "^2.0.0" - }, - "engines": { - "node": ">= 10.13" - } - }, - "node_modules/node-emoji": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.1.3.tgz", - "integrity": "sha512-E2WEOVsgs7O16zsURJ/eH8BqhF029wGpEOnv7Urwdo2wmQanOACwJQh0devF9D9RhoZru0+9JXIS0dBXIAz+lA==", - "dev": true, - "dependencies": { - "@sindresorhus/is": "^4.6.0", - "char-regex": "^1.0.2", - "emojilib": "^2.4.0", - "skin-tone": "^2.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/node-emoji/node_modules/@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/is?sponsor=1" - } - }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-fetch-h2": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/node-fetch-h2/-/node-fetch-h2-2.3.0.tgz", - "integrity": "sha512-ofRW94Ab0T4AOh5Fk8t0h8OBWrmjb0SSB20xh1H8YnPV9EJ+f5AMoYSUQ2zgJ4Iq2HAK0I2l5/Nequ8YzFS3Hg==", - "dev": true, - "dependencies": { - "http2-client": "^1.2.5" - }, - "engines": { - "node": "4.x || >=6.0.0" - } - }, - "node_modules/node-object-hash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/node-object-hash/-/node-object-hash-3.0.0.tgz", - "integrity": "sha512-jLF6tlyletktvSAawuPmH1SReP0YfZQ+tBrDiTCK+Ai7eXPMS9odi5xW/iKC7ZhrWJJ0Z5xYcW/x+1fVMn1Qvw==", - "dev": true, - "engines": { - "node": ">=16", - "pnpm": ">=8" - } - }, - "node_modules/node-readfiles": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/node-readfiles/-/node-readfiles-0.2.0.tgz", - "integrity": "sha512-SU00ZarexNlE4Rjdm83vglt5Y9yiQ+XI1XpflWlb7q7UTN1JUItm69xMeiQCTxtTfnzt+83T8Cx+vI2ED++VDA==", - "dev": true, - "dependencies": { - "es6-promise": "^3.2.1" - } - }, - "node_modules/node-releases": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", - "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", - "dev": true - }, - "node_modules/normalize-package-data": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.0.tgz", - "integrity": "sha512-UL7ELRVxYBHBgYEtZCXjxuD5vPxnmvMGq0jp/dGPKKrN7tfsBh2IY7TlJ15WWwdjRWD3RJbnsygUurTK3xkPkg==", - "dev": true, - "dependencies": { - "hosted-git-info": "^7.0.0", - "is-core-module": "^2.8.1", - "semver": "^7.3.5", - "validate-npm-package-license": "^3.0.4" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/normalize-url": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.0.tgz", - "integrity": "sha512-uVFpKhj5MheNBJRTiMZ9pE/7hD1QTeEvugSJW/OmLzAp78PB5O6adfMNTvmfKhXBkvCzC+rqifWcVYpGFwTjnw==", - "dev": true, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/npm": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/npm/-/npm-10.4.0.tgz", - "integrity": "sha512-RS7Mx0OVfXlOcQLRePuDIYdFCVBPCNapWHplDK+mh7GDdP/Tvor4ocuybRRPSvfcRb2vjRJt1fHCqw3cr8qACQ==", - "bundleDependencies": [ - "@isaacs/string-locale-compare", - "@npmcli/arborist", - "@npmcli/config", - "@npmcli/fs", - "@npmcli/map-workspaces", - "@npmcli/package-json", - "@npmcli/promise-spawn", - "@npmcli/run-script", - "@sigstore/tuf", - "abbrev", - "archy", - "cacache", - "chalk", - "ci-info", - "cli-columns", - "cli-table3", - "columnify", - "fastest-levenshtein", - "fs-minipass", - "glob", - "graceful-fs", - "hosted-git-info", - "ini", - "init-package-json", - "is-cidr", - "json-parse-even-better-errors", - "libnpmaccess", - "libnpmdiff", - "libnpmexec", - "libnpmfund", - "libnpmhook", - "libnpmorg", - "libnpmpack", - "libnpmpublish", - "libnpmsearch", - "libnpmteam", - "libnpmversion", - "make-fetch-happen", - "minimatch", - "minipass", - "minipass-pipeline", - "ms", - "node-gyp", - "nopt", - "normalize-package-data", - "npm-audit-report", - "npm-install-checks", - "npm-package-arg", - "npm-pick-manifest", - "npm-profile", - "npm-registry-fetch", - "npm-user-validate", - "npmlog", - "p-map", - "pacote", - "parse-conflict-json", - "proc-log", - "qrcode-terminal", - "read", - "semver", - "spdx-expression-parse", - "ssri", - "supports-color", - "tar", - "text-table", - "tiny-relative-date", - "treeverse", - "validate-npm-package-name", - "which", - "write-file-atomic" - ], - "dev": true, - "dependencies": { - "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^7.2.1", - "@npmcli/config": "^8.0.2", - "@npmcli/fs": "^3.1.0", - "@npmcli/map-workspaces": "^3.0.4", - "@npmcli/package-json": "^5.0.0", - "@npmcli/promise-spawn": "^7.0.1", - "@npmcli/run-script": "^7.0.4", - "@sigstore/tuf": "^2.3.0", - "abbrev": "^2.0.0", - "archy": "~1.0.0", - "cacache": "^18.0.2", - "chalk": "^5.3.0", - "ci-info": "^4.0.0", - "cli-columns": "^4.0.0", - "cli-table3": "^0.6.3", - "columnify": "^1.6.0", - "fastest-levenshtein": "^1.0.16", - "fs-minipass": "^3.0.3", - "glob": "^10.3.10", - "graceful-fs": "^4.2.11", - "hosted-git-info": "^7.0.1", - "ini": "^4.1.1", - "init-package-json": "^6.0.0", - "is-cidr": "^5.0.3", - "json-parse-even-better-errors": "^3.0.1", - "libnpmaccess": "^8.0.1", - "libnpmdiff": "^6.0.3", - "libnpmexec": "^7.0.4", - "libnpmfund": "^5.0.1", - "libnpmhook": "^10.0.0", - "libnpmorg": "^6.0.1", - "libnpmpack": "^6.0.3", - "libnpmpublish": "^9.0.2", - "libnpmsearch": "^7.0.0", - "libnpmteam": "^6.0.0", - "libnpmversion": "^5.0.1", - "make-fetch-happen": "^13.0.0", - "minimatch": "^9.0.3", - "minipass": "^7.0.4", - "minipass-pipeline": "^1.2.4", - "ms": "^2.1.2", - "node-gyp": "^10.0.1", - "nopt": "^7.2.0", - "normalize-package-data": "^6.0.0", - "npm-audit-report": "^5.0.0", - "npm-install-checks": "^6.3.0", - "npm-package-arg": "^11.0.1", - "npm-pick-manifest": "^9.0.0", - "npm-profile": "^9.0.0", - "npm-registry-fetch": "^16.1.0", - "npm-user-validate": "^2.0.0", - "npmlog": "^7.0.1", - "p-map": "^4.0.0", - "pacote": "^17.0.6", - "parse-conflict-json": "^3.0.1", - "proc-log": "^3.0.0", - "qrcode-terminal": "^0.12.0", - "read": "^2.1.0", - "semver": "^7.5.4", - "spdx-expression-parse": "^3.0.1", - "ssri": "^10.0.5", - "supports-color": "^9.4.0", - "tar": "^6.2.0", - "text-table": "~0.2.0", - "tiny-relative-date": "^1.3.0", - "treeverse": "^3.0.0", - "validate-npm-package-name": "^5.0.0", - "which": "^4.0.0", - "write-file-atomic": "^5.0.1" - }, - "bin": { - "npm": "bin/npm-cli.js", - "npx": "bin/npx-cli.js" - }, - "engines": { - "node": "^18.17.0 || >=20.5.0" - } - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/@colors/colors": { - "version": "1.5.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">=0.1.90" - } - }, - "node_modules/npm/node_modules/@isaacs/cliui": { - "version": "8.0.2", - "dev": true, - "inBundle": 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": ">=12" - } - }, - "node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex": { - "version": "9.2.2", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width": { - "version": "5.1.2", - "dev": true, - "inBundle": 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/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi": { - "version": "7.1.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/npm/node_modules/@isaacs/string-locale-compare": { - "version": "1.1.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/@npmcli/agent": { - "version": "2.2.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "agent-base": "^7.1.0", - "http-proxy-agent": "^7.0.0", - "https-proxy-agent": "^7.0.1", - "lru-cache": "^10.0.1", - "socks-proxy-agent": "^8.0.1" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/arborist": { - "version": "7.3.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/fs": "^3.1.0", - "@npmcli/installed-package-contents": "^2.0.2", - "@npmcli/map-workspaces": "^3.0.2", - "@npmcli/metavuln-calculator": "^7.0.0", - "@npmcli/name-from-folder": "^2.0.0", - "@npmcli/node-gyp": "^3.0.0", - "@npmcli/package-json": "^5.0.0", - "@npmcli/query": "^3.0.1", - "@npmcli/run-script": "^7.0.2", - "bin-links": "^4.0.1", - "cacache": "^18.0.0", - "common-ancestor-path": "^1.0.1", - "hosted-git-info": "^7.0.1", - "json-parse-even-better-errors": "^3.0.0", - "json-stringify-nice": "^1.1.4", - "minimatch": "^9.0.0", - "nopt": "^7.0.0", - "npm-install-checks": "^6.2.0", - "npm-package-arg": "^11.0.1", - "npm-pick-manifest": "^9.0.0", - "npm-registry-fetch": "^16.0.0", - "npmlog": "^7.0.1", - "pacote": "^17.0.4", - "parse-conflict-json": "^3.0.0", - "proc-log": "^3.0.0", - "promise-all-reject-late": "^1.0.0", - "promise-call-limit": "^3.0.1", - "read-package-json-fast": "^3.0.2", - "semver": "^7.3.7", - "ssri": "^10.0.5", - "treeverse": "^3.0.0", - "walk-up-path": "^3.0.1" - }, - "bin": { - "arborist": "bin/index.js" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/config": { - "version": "8.1.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/map-workspaces": "^3.0.2", - "ci-info": "^4.0.0", - "ini": "^4.1.0", - "nopt": "^7.0.0", - "proc-log": "^3.0.0", - "read-package-json-fast": "^3.0.2", - "semver": "^7.3.5", - "walk-up-path": "^3.0.1" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/disparity-colors": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "ansi-styles": "^4.3.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/disparity-colors/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/npm/node_modules/@npmcli/fs": { - "version": "3.1.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "semver": "^7.3.5" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/git": { - "version": "5.0.4", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/promise-spawn": "^7.0.0", - "lru-cache": "^10.0.1", - "npm-pick-manifest": "^9.0.0", - "proc-log": "^3.0.0", - "promise-inflight": "^1.0.1", - "promise-retry": "^2.0.1", - "semver": "^7.3.5", - "which": "^4.0.0" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/installed-package-contents": { - "version": "2.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "npm-bundled": "^3.0.0", - "npm-normalize-package-bin": "^3.0.0" - }, - "bin": { - "installed-package-contents": "lib/index.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/map-workspaces": { - "version": "3.0.4", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/name-from-folder": "^2.0.0", - "glob": "^10.2.2", - "minimatch": "^9.0.0", - "read-package-json-fast": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { - "version": "7.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "cacache": "^18.0.0", - "json-parse-even-better-errors": "^3.0.0", - "pacote": "^17.0.0", - "semver": "^7.3.5" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/name-from-folder": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/node-gyp": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/package-json": { - "version": "5.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/git": "^5.0.0", - "glob": "^10.2.2", - "hosted-git-info": "^7.0.0", - "json-parse-even-better-errors": "^3.0.0", - "normalize-package-data": "^6.0.0", - "proc-log": "^3.0.0", - "semver": "^7.5.3" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/promise-spawn": { - "version": "7.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "which": "^4.0.0" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/query": { - "version": "3.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "postcss-selector-parser": "^6.0.10" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/run-script": { - "version": "7.0.4", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/node-gyp": "^3.0.0", - "@npmcli/package-json": "^5.0.0", - "@npmcli/promise-spawn": "^7.0.0", - "node-gyp": "^10.0.0", - "which": "^4.0.0" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">=14" - } - }, - "node_modules/npm/node_modules/@sigstore/bundle": { - "version": "2.1.1", - "dev": true, - "inBundle": true, - "license": "Apache-2.0", - "dependencies": { - "@sigstore/protobuf-specs": "^0.2.1" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@sigstore/core": { - "version": "0.2.0", - "dev": true, - "inBundle": true, - "license": "Apache-2.0", - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@sigstore/protobuf-specs": { - "version": "0.2.1", - "dev": true, - "inBundle": true, - "license": "Apache-2.0", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@sigstore/sign": { - "version": "2.2.1", - "dev": true, - "inBundle": true, - "license": "Apache-2.0", - "dependencies": { - "@sigstore/bundle": "^2.1.1", - "@sigstore/core": "^0.2.0", - "@sigstore/protobuf-specs": "^0.2.1", - "make-fetch-happen": "^13.0.0" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@sigstore/tuf": { - "version": "2.3.0", - "dev": true, - "inBundle": true, - "license": "Apache-2.0", - "dependencies": { - "@sigstore/protobuf-specs": "^0.2.1", - "tuf-js": "^2.2.0" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@sigstore/verify": { - "version": "0.1.0", - "dev": true, - "inBundle": true, - "license": "Apache-2.0", - "dependencies": { - "@sigstore/bundle": "^2.1.1", - "@sigstore/core": "^0.2.0", - "@sigstore/protobuf-specs": "^0.2.1" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@tufjs/canonical-json": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@tufjs/models": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "@tufjs/canonical-json": "2.0.0", - "minimatch": "^9.0.3" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/abbrev": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/agent-base": { - "version": "7.1.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "debug": "^4.3.4" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/npm/node_modules/aggregate-error": { - "version": "3.1.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/ansi-regex": { - "version": "5.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/ansi-styles": { - "version": "6.2.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/npm/node_modules/aproba": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/archy": { - "version": "1.0.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/are-we-there-yet": { - "version": "4.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/balanced-match": { - "version": "1.0.2", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/bin-links": { - "version": "4.0.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "cmd-shim": "^6.0.0", - "npm-normalize-package-bin": "^3.0.0", - "read-cmd-shim": "^4.0.0", - "write-file-atomic": "^5.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/binary-extensions": { - "version": "2.2.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/brace-expansion": { - "version": "2.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/npm/node_modules/builtins": { - "version": "5.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "semver": "^7.0.0" - } - }, - "node_modules/npm/node_modules/cacache": { - "version": "18.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/fs": "^3.1.0", - "fs-minipass": "^3.0.0", - "glob": "^10.2.2", - "lru-cache": "^10.0.1", - "minipass": "^7.0.3", - "minipass-collect": "^2.0.1", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "p-map": "^4.0.0", - "ssri": "^10.0.0", - "tar": "^6.1.11", - "unique-filename": "^3.0.0" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/chalk": { - "version": "5.3.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/npm/node_modules/chownr": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/npm/node_modules/ci-info": { - "version": "4.0.0", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/cidr-regex": { - "version": "4.0.3", - "dev": true, - "inBundle": true, - "license": "BSD-2-Clause", - "dependencies": { - "ip-regex": "^5.0.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/npm/node_modules/clean-stack": { - "version": "2.2.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/npm/node_modules/cli-columns": { - "version": "4.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/npm/node_modules/cli-table3": { - "version": "0.6.3", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "string-width": "^4.2.0" - }, - "engines": { - "node": "10.* || >= 12.*" - }, - "optionalDependencies": { - "@colors/colors": "1.5.0" - } - }, - "node_modules/npm/node_modules/clone": { - "version": "1.0.4", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/npm/node_modules/cmd-shim": { - "version": "6.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/npm/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/color-support": { - "version": "1.1.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "bin": { - "color-support": "bin.js" - } - }, - "node_modules/npm/node_modules/columnify": { - "version": "1.6.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "strip-ansi": "^6.0.1", - "wcwidth": "^1.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/npm/node_modules/common-ancestor-path": { - "version": "1.0.1", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/console-control-strings": { - "version": "1.1.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/cross-spawn": { - "version": "7.0.3", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/npm/node_modules/cross-spawn/node_modules/which": { - "version": "2.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/npm/node_modules/cssesc": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/npm/node_modules/debug": { - "version": "4.3.4", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/npm/node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/defaults": { - "version": "1.0.4", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "clone": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/npm/node_modules/diff": { - "version": "5.1.0", - "dev": true, - "inBundle": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/npm/node_modules/eastasianwidth": { - "version": "0.2.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/emoji-regex": { - "version": "8.0.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/encoding": { - "version": "0.1.13", - "dev": true, - "inBundle": true, - "license": "MIT", - "optional": true, - "dependencies": { - "iconv-lite": "^0.6.2" - } - }, - "node_modules/npm/node_modules/env-paths": { - "version": "2.2.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/npm/node_modules/err-code": { - "version": "2.0.3", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/exponential-backoff": { - "version": "3.1.1", - "dev": true, - "inBundle": true, - "license": "Apache-2.0" - }, - "node_modules/npm/node_modules/fastest-levenshtein": { - "version": "1.0.16", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 4.9.1" - } - }, - "node_modules/npm/node_modules/foreground-child": { - "version": "3.1.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/fs-minipass": { - "version": "3.0.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^7.0.3" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/function-bind": { - "version": "1.1.2", - "dev": true, - "inBundle": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/npm/node_modules/gauge": { - "version": "5.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.3", - "console-control-strings": "^1.1.0", - "has-unicode": "^2.0.1", - "signal-exit": "^4.0.1", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.5" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/glob": { - "version": "10.3.10", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" + "@isaacs/string-locale-compare": "^1.1.0", + "@npmcli/arborist": "^7.2.1", + "@npmcli/config": "^8.0.2", + "@npmcli/fs": "^3.1.0", + "@npmcli/map-workspaces": "^3.0.6", + "@npmcli/package-json": "^5.0.2", + "@npmcli/promise-spawn": "^7.0.1", + "@npmcli/redact": "^1.1.0", + "@npmcli/run-script": "^7.0.4", + "@sigstore/tuf": "^2.3.2", + "abbrev": "^2.0.0", + "archy": "~1.0.0", + "cacache": "^18.0.2", + "chalk": "^5.3.0", + "ci-info": "^4.0.0", + "cli-columns": "^4.0.0", + "cli-table3": "^0.6.4", + "columnify": "^1.6.0", + "fastest-levenshtein": "^1.0.16", + "fs-minipass": "^3.0.3", + "glob": "^10.3.12", + "graceful-fs": "^4.2.11", + "hosted-git-info": "^7.0.1", + "ini": "^4.1.2", + "init-package-json": "^6.0.2", + "is-cidr": "^5.0.5", + "json-parse-even-better-errors": "^3.0.1", + "libnpmaccess": "^8.0.1", + "libnpmdiff": "^6.0.3", + "libnpmexec": "^7.0.4", + "libnpmfund": "^5.0.1", + "libnpmhook": "^10.0.0", + "libnpmorg": "^6.0.1", + "libnpmpack": "^6.0.3", + "libnpmpublish": "^9.0.2", + "libnpmsearch": "^7.0.0", + "libnpmteam": "^6.0.0", + "libnpmversion": "^5.0.1", + "make-fetch-happen": "^13.0.0", + "minimatch": "^9.0.4", + "minipass": "^7.0.4", + "minipass-pipeline": "^1.2.4", + "ms": "^2.1.2", + "node-gyp": "^10.1.0", + "nopt": "^7.2.0", + "normalize-package-data": "^6.0.0", + "npm-audit-report": "^5.0.0", + "npm-install-checks": "^6.3.0", + "npm-package-arg": "^11.0.1", + "npm-pick-manifest": "^9.0.0", + "npm-profile": "^9.0.0", + "npm-registry-fetch": "^16.2.0", + "npm-user-validate": "^2.0.0", + "npmlog": "^7.0.1", + "p-map": "^4.0.0", + "pacote": "^17.0.6", + "parse-conflict-json": "^3.0.1", + "proc-log": "^3.0.0", + "qrcode-terminal": "^0.12.0", + "read": "^3.0.1", + "semver": "^7.6.0", + "spdx-expression-parse": "^4.0.0", + "ssri": "^10.0.5", + "supports-color": "^9.4.0", + "tar": "^6.2.1", + "text-table": "~0.2.0", + "tiny-relative-date": "^1.3.0", + "treeverse": "^3.0.0", + "validate-npm-package-name": "^5.0.0", + "which": "^4.0.0", + "write-file-atomic": "^5.0.1" }, "bin": { - "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/graceful-fs": { - "version": "4.2.11", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/has-unicode": { - "version": "2.0.1", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/hasown": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" + "npm": "bin/npm-cli.js", + "npx": "bin/npx-cli.js" }, "engines": { - "node": ">= 0.4" + "node": "^18.17.0 || >=20.5.0" } }, - "node_modules/npm/node_modules/hosted-git-info": { - "version": "7.0.1", + "node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", "dev": true, - "inBundle": true, - "license": "ISC", "dependencies": { - "lru-cache": "^10.0.1" + "path-key": "^4.0.0" }, "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/http-cache-semantics": { - "version": "4.1.1", - "dev": true, - "inBundle": true, - "license": "BSD-2-Clause" - }, - "node_modules/npm/node_modules/http-proxy-agent": { - "version": "7.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "agent-base": "^7.1.0", - "debug": "^4.3.4" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, - "engines": { - "node": ">= 14" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/npm/node_modules/https-proxy-agent": { - "version": "7.0.2", + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "agent-base": "^7.0.2", - "debug": "4" - }, "engines": { - "node": ">= 14" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/npm/node_modules/iconv-lite": { - "version": "0.6.3", + "node_modules/npm/node_modules/@colors/colors": { + "version": "1.5.0", "dev": true, "inBundle": true, "license": "MIT", "optional": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, "engines": { - "node": ">=0.10.0" + "node": ">=0.1.90" } }, - "node_modules/npm/node_modules/ignore-walk": { - "version": "6.0.4", + "node_modules/npm/node_modules/@isaacs/cliui": { + "version": "8.0.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "minimatch": "^9.0.0" + "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": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/imurmurhash": { - "version": "0.1.4", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=0.8.19" + "node": ">=12" } }, - "node_modules/npm/node_modules/indent-string": { - "version": "4.0.0", + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", "dev": true, "inBundle": true, "license": "MIT", "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/ini": { - "version": "4.1.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/init-package-json": { - "version": "6.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "npm-package-arg": "^11.0.0", - "promzard": "^1.0.0", - "read": "^2.0.0", - "read-package-json": "^7.0.0", - "semver": "^7.3.5", - "validate-npm-package-license": "^3.0.4", - "validate-npm-package-name": "^5.0.0" + "node": ">=12" }, - "engines": { - "node": "^16.14.0 || >=18.0.0" + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, - "node_modules/npm/node_modules/ip": { - "version": "2.0.0", + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", "dev": true, "inBundle": true, "license": "MIT" }, - "node_modules/npm/node_modules/ip-regex": { - "version": "5.0.0", + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", "dev": true, "inBundle": true, "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/npm/node_modules/is-cidr": { - "version": "5.0.3", + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", "dev": true, "inBundle": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "cidr-regex": "4.0.3" + "ansi-regex": "^6.0.1" }, "engines": { - "node": ">=14" - } - }, - "node_modules/npm/node_modules/is-core-module": { - "version": "2.13.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "hasown": "^2.0.0" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/npm/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/npm/node_modules/is-lambda": { - "version": "1.0.1", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/isexe": { - "version": "2.0.0", + "node_modules/npm/node_modules/@isaacs/string-locale-compare": { + "version": "1.1.0", "dev": true, "inBundle": true, "license": "ISC" }, - "node_modules/npm/node_modules/jackspeak": { - "version": "2.3.6", + "node_modules/npm/node_modules/@npmcli/agent": { + "version": "2.2.2", "dev": true, "inBundle": true, - "license": "BlueOak-1.0.0", + "license": "ISC", "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "agent-base": "^7.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.1", + "lru-cache": "^10.0.1", + "socks-proxy-agent": "^8.0.3" }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/npm/node_modules/json-parse-even-better-errors": { - "version": "3.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/json-stringify-nice": { - "version": "1.1.4", + "node_modules/npm/node_modules/@npmcli/arborist": { + "version": "7.4.2", "dev": true, "inBundle": true, "license": "ISC", - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/jsonparse": { - "version": "1.3.1", - "dev": true, - "engines": [ - "node >= 0.2.0" - ], - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/just-diff": { - "version": "6.0.2", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/just-diff-apply": { - "version": "5.5.0", - "dev": true, - "inBundle": true, - "license": "MIT" + "dependencies": { + "@isaacs/string-locale-compare": "^1.1.0", + "@npmcli/fs": "^3.1.0", + "@npmcli/installed-package-contents": "^2.0.2", + "@npmcli/map-workspaces": "^3.0.2", + "@npmcli/metavuln-calculator": "^7.0.0", + "@npmcli/name-from-folder": "^2.0.0", + "@npmcli/node-gyp": "^3.0.0", + "@npmcli/package-json": "^5.0.0", + "@npmcli/query": "^3.1.0", + "@npmcli/redact": "^1.1.0", + "@npmcli/run-script": "^7.0.2", + "bin-links": "^4.0.1", + "cacache": "^18.0.0", + "common-ancestor-path": "^1.0.1", + "hosted-git-info": "^7.0.1", + "json-parse-even-better-errors": "^3.0.0", + "json-stringify-nice": "^1.1.4", + "minimatch": "^9.0.4", + "nopt": "^7.0.0", + "npm-install-checks": "^6.2.0", + "npm-package-arg": "^11.0.1", + "npm-pick-manifest": "^9.0.0", + "npm-registry-fetch": "^16.2.0", + "npmlog": "^7.0.1", + "pacote": "^17.0.4", + "parse-conflict-json": "^3.0.0", + "proc-log": "^3.0.0", + "promise-all-reject-late": "^1.0.0", + "promise-call-limit": "^3.0.1", + "read-package-json-fast": "^3.0.2", + "semver": "^7.3.7", + "ssri": "^10.0.5", + "treeverse": "^3.0.0", + "walk-up-path": "^3.0.1" + }, + "bin": { + "arborist": "bin/index.js" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } }, - "node_modules/npm/node_modules/libnpmaccess": { - "version": "8.0.2", + "node_modules/npm/node_modules/@npmcli/config": { + "version": "8.2.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "npm-package-arg": "^11.0.1", - "npm-registry-fetch": "^16.0.0" + "@npmcli/map-workspaces": "^3.0.2", + "ci-info": "^4.0.0", + "ini": "^4.1.2", + "nopt": "^7.0.0", + "proc-log": "^3.0.0", + "read-package-json-fast": "^3.0.2", + "semver": "^7.3.5", + "walk-up-path": "^3.0.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/libnpmdiff": { - "version": "6.0.6", + "node_modules/npm/node_modules/@npmcli/disparity-colors": { + "version": "3.0.0", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^7.2.1", - "@npmcli/disparity-colors": "^3.0.0", - "@npmcli/installed-package-contents": "^2.0.2", - "binary-extensions": "^2.2.0", - "diff": "^5.1.0", - "minimatch": "^9.0.0", - "npm-package-arg": "^11.0.1", - "pacote": "^17.0.4", - "tar": "^6.2.0" + "ansi-styles": "^4.3.0" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/libnpmexec": { - "version": "7.0.7", + "node_modules/npm/node_modules/@npmcli/disparity-colors/node_modules/ansi-styles": { + "version": "4.3.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "@npmcli/arborist": "^7.2.1", - "@npmcli/run-script": "^7.0.2", - "ci-info": "^4.0.0", - "npm-package-arg": "^11.0.1", - "npmlog": "^7.0.1", - "pacote": "^17.0.4", - "proc-log": "^3.0.0", - "read": "^2.0.0", - "read-package-json-fast": "^3.0.2", - "semver": "^7.3.7", - "walk-up-path": "^3.0.1" + "color-convert": "^2.0.1" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/npm/node_modules/libnpmfund": { - "version": "5.0.4", + "node_modules/npm/node_modules/@npmcli/fs": { + "version": "3.1.0", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^7.2.1" + "semver": "^7.3.5" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/libnpmhook": { - "version": "10.0.1", + "node_modules/npm/node_modules/@npmcli/git": { + "version": "5.0.5", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "aproba": "^2.0.0", - "npm-registry-fetch": "^16.0.0" + "@npmcli/promise-spawn": "^7.0.0", + "lru-cache": "^10.0.1", + "npm-pick-manifest": "^9.0.0", + "proc-log": "^3.0.0", + "promise-inflight": "^1.0.1", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^4.0.0" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/libnpmorg": { - "version": "6.0.2", + "node_modules/npm/node_modules/@npmcli/installed-package-contents": { + "version": "2.0.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "aproba": "^2.0.0", - "npm-registry-fetch": "^16.0.0" + "npm-bundled": "^3.0.0", + "npm-normalize-package-bin": "^3.0.0" + }, + "bin": { + "installed-package-contents": "lib/index.js" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/libnpmpack": { - "version": "6.0.6", + "node_modules/npm/node_modules/@npmcli/map-workspaces": { + "version": "3.0.6", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^7.2.1", - "@npmcli/run-script": "^7.0.2", - "npm-package-arg": "^11.0.1", - "pacote": "^17.0.4" + "@npmcli/name-from-folder": "^2.0.0", + "glob": "^10.2.2", + "minimatch": "^9.0.0", + "read-package-json-fast": "^3.0.0" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/libnpmpublish": { - "version": "9.0.4", + "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { + "version": "7.0.0", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "ci-info": "^4.0.0", - "normalize-package-data": "^6.0.0", - "npm-package-arg": "^11.0.1", - "npm-registry-fetch": "^16.0.0", - "proc-log": "^3.0.0", - "semver": "^7.3.7", - "sigstore": "^2.2.0", - "ssri": "^10.0.5" + "cacache": "^18.0.0", + "json-parse-even-better-errors": "^3.0.0", + "pacote": "^17.0.0", + "semver": "^7.3.5" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/libnpmsearch": { - "version": "7.0.1", + "node_modules/npm/node_modules/@npmcli/name-from-folder": { + "version": "2.0.0", "dev": true, "inBundle": true, "license": "ISC", - "dependencies": { - "npm-registry-fetch": "^16.0.0" - }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/libnpmteam": { - "version": "6.0.1", + "node_modules/npm/node_modules/@npmcli/node-gyp": { + "version": "3.0.0", "dev": true, "inBundle": true, "license": "ISC", - "dependencies": { - "aproba": "^2.0.0", - "npm-registry-fetch": "^16.0.0" - }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/libnpmversion": { + "node_modules/npm/node_modules/@npmcli/package-json": { "version": "5.0.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/git": "^5.0.3", - "@npmcli/run-script": "^7.0.2", + "@npmcli/git": "^5.0.0", + "glob": "^10.2.2", + "hosted-git-info": "^7.0.0", "json-parse-even-better-errors": "^3.0.0", + "normalize-package-data": "^6.0.0", "proc-log": "^3.0.0", - "semver": "^7.3.7" + "semver": "^7.5.3" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/lru-cache": { - "version": "10.1.0", + "node_modules/npm/node_modules/@npmcli/promise-spawn": { + "version": "7.0.1", "dev": true, "inBundle": true, "license": "ISC", + "dependencies": { + "which": "^4.0.0" + }, "engines": { - "node": "14 || >=16.14" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/make-fetch-happen": { - "version": "13.0.0", + "node_modules/npm/node_modules/@npmcli/query": { + "version": "3.1.0", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/agent": "^2.0.0", - "cacache": "^18.0.0", - "http-cache-semantics": "^4.1.1", - "is-lambda": "^1.0.1", - "minipass": "^7.0.2", - "minipass-fetch": "^3.0.0", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "negotiator": "^0.6.3", - "promise-retry": "^2.0.1", - "ssri": "^10.0.0" + "postcss-selector-parser": "^6.0.10" }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/redact": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", "engines": { "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/minimatch": { - "version": "9.0.3", + "node_modules/npm/node_modules/@npmcli/run-script": { + "version": "7.0.4", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "brace-expansion": "^2.0.1" + "@npmcli/node-gyp": "^3.0.0", + "@npmcli/package-json": "^5.0.0", + "@npmcli/promise-spawn": "^7.0.0", + "node-gyp": "^10.0.0", + "which": "^4.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/minipass": { - "version": "7.0.4", + "node_modules/npm/node_modules/@pkgjs/parseargs": { + "version": "0.11.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", + "optional": true, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=14" } }, - "node_modules/npm/node_modules/minipass-collect": { - "version": "2.0.1", + "node_modules/npm/node_modules/@sigstore/bundle": { + "version": "2.3.1", "dev": true, "inBundle": true, - "license": "ISC", + "license": "Apache-2.0", "dependencies": { - "minipass": "^7.0.3" + "@sigstore/protobuf-specs": "^0.3.1" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/minipass-fetch": { - "version": "3.0.4", + "node_modules/npm/node_modules/@sigstore/core": { + "version": "1.1.0", "dev": true, "inBundle": true, - "license": "MIT", + "license": "Apache-2.0", + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@sigstore/protobuf-specs": { + "version": "0.3.1", + "dev": true, + "inBundle": true, + "license": "Apache-2.0", + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@sigstore/sign": { + "version": "2.3.0", + "dev": true, + "inBundle": true, + "license": "Apache-2.0", "dependencies": { - "minipass": "^7.0.3", - "minipass-sized": "^1.0.3", - "minizlib": "^2.1.2" + "@sigstore/bundle": "^2.3.0", + "@sigstore/core": "^1.0.0", + "@sigstore/protobuf-specs": "^0.3.1", + "make-fetch-happen": "^13.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - }, - "optionalDependencies": { - "encoding": "^0.1.13" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/minipass-flush": { - "version": "1.0.5", + "node_modules/npm/node_modules/@sigstore/tuf": { + "version": "2.3.2", "dev": true, "inBundle": true, - "license": "ISC", + "license": "Apache-2.0", "dependencies": { - "minipass": "^3.0.0" + "@sigstore/protobuf-specs": "^0.3.0", + "tuf-js": "^2.2.0" }, "engines": { - "node": ">= 8" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/minipass-flush/node_modules/minipass": { - "version": "3.3.6", + "node_modules/npm/node_modules/@sigstore/verify": { + "version": "1.2.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "Apache-2.0", "dependencies": { - "yallist": "^4.0.0" + "@sigstore/bundle": "^2.3.1", + "@sigstore/core": "^1.1.0", + "@sigstore/protobuf-specs": "^0.3.1" }, "engines": { - "node": ">=8" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/minipass-json-stream": { - "version": "1.0.1", + "node_modules/npm/node_modules/@tufjs/canonical-json": { + "version": "2.0.0", "dev": true, "inBundle": true, "license": "MIT", - "dependencies": { - "jsonparse": "^1.3.1", - "minipass": "^3.0.0" + "engines": { + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/minipass-json-stream/node_modules/minipass": { - "version": "3.3.6", + "node_modules/npm/node_modules/@tufjs/models": { + "version": "2.0.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "yallist": "^4.0.0" + "@tufjs/canonical-json": "2.0.0", + "minimatch": "^9.0.3" }, "engines": { - "node": ">=8" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/minipass-pipeline": { - "version": "1.2.4", + "node_modules/npm/node_modules/abbrev": { + "version": "2.0.0", "dev": true, "inBundle": true, "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, "engines": { - "node": ">=8" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass": { - "version": "3.3.6", + "node_modules/npm/node_modules/agent-base": { + "version": "7.1.1", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "yallist": "^4.0.0" + "debug": "^4.3.4" }, "engines": { - "node": ">=8" + "node": ">= 14" } }, - "node_modules/npm/node_modules/minipass-sized": { - "version": "1.0.3", + "node_modules/npm/node_modules/aggregate-error": { + "version": "3.1.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "minipass": "^3.0.0" + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" }, "engines": { "node": ">=8" } }, - "node_modules/npm/node_modules/minipass-sized/node_modules/minipass": { - "version": "3.3.6", + "node_modules/npm/node_modules/ansi-regex": { + "version": "5.0.1", "dev": true, "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/npm/node_modules/minizlib": { - "version": "2.1.2", + "node_modules/npm/node_modules/ansi-styles": { + "version": "6.2.1", "dev": true, "inBundle": true, "license": "MIT", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, "engines": { - "node": ">= 8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/npm/node_modules/minizlib/node_modules/minipass": { - "version": "3.3.6", + "node_modules/npm/node_modules/aproba": { + "version": "2.0.0", "dev": true, "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } + "license": "ISC" }, - "node_modules/npm/node_modules/mkdirp": { - "version": "1.0.4", + "node_modules/npm/node_modules/archy": { + "version": "1.0.0", "dev": true, "inBundle": true, - "license": "MIT", - "bin": { - "mkdirp": "bin/cmd.js" - }, + "license": "MIT" + }, + "node_modules/npm/node_modules/are-we-there-yet": { + "version": "4.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", "engines": { - "node": ">=10" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/ms": { - "version": "2.1.3", + "node_modules/npm/node_modules/balanced-match": { + "version": "1.0.2", "dev": true, "inBundle": true, "license": "MIT" }, - "node_modules/npm/node_modules/mute-stream": { - "version": "1.0.0", + "node_modules/npm/node_modules/bin-links": { + "version": "4.0.3", "dev": true, "inBundle": true, "license": "ISC", + "dependencies": { + "cmd-shim": "^6.0.0", + "npm-normalize-package-bin": "^3.0.0", + "read-cmd-shim": "^4.0.0", + "write-file-atomic": "^5.0.0" + }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/negotiator": { - "version": "0.6.3", + "node_modules/npm/node_modules/binary-extensions": { + "version": "2.3.0", "dev": true, "inBundle": true, "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/npm/node_modules/node-gyp": { - "version": "10.0.1", + "node_modules/npm/node_modules/brace-expansion": { + "version": "2.0.1", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { - "env-paths": "^2.2.0", - "exponential-backoff": "^3.1.1", - "glob": "^10.3.10", - "graceful-fs": "^4.2.6", - "make-fetch-happen": "^13.0.0", - "nopt": "^7.0.0", - "proc-log": "^3.0.0", - "semver": "^7.3.5", - "tar": "^6.1.2", - "which": "^4.0.0" - }, - "bin": { - "node-gyp": "bin/node-gyp.js" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" + "balanced-match": "^1.0.0" } }, - "node_modules/npm/node_modules/nopt": { - "version": "7.2.0", + "node_modules/npm/node_modules/builtins": { + "version": "5.1.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "abbrev": "^2.0.0" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "semver": "^7.0.0" } }, - "node_modules/npm/node_modules/normalize-package-data": { - "version": "6.0.0", + "node_modules/npm/node_modules/cacache": { + "version": "18.0.2", "dev": true, "inBundle": true, - "license": "BSD-2-Clause", + "license": "ISC", "dependencies": { - "hosted-git-info": "^7.0.0", - "is-core-module": "^2.8.1", - "semver": "^7.3.5", - "validate-npm-package-license": "^3.0.4" + "@npmcli/fs": "^3.1.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^10.0.1", + "minipass": "^7.0.3", + "minipass-collect": "^2.0.1", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^4.0.0", + "ssri": "^10.0.0", + "tar": "^6.1.11", + "unique-filename": "^3.0.0" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/npm-audit-report": { - "version": "5.0.0", + "node_modules/npm/node_modules/chalk": { + "version": "5.3.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/npm/node_modules/npm-bundled": { - "version": "3.0.0", + "node_modules/npm/node_modules/chownr": { + "version": "2.0.0", "dev": true, "inBundle": true, "license": "ISC", - "dependencies": { - "npm-normalize-package-bin": "^3.0.0" - }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": ">=10" } }, - "node_modules/npm/node_modules/npm-install-checks": { - "version": "6.3.0", + "node_modules/npm/node_modules/ci-info": { + "version": "4.0.0", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/cidr-regex": { + "version": "4.0.5", "dev": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { - "semver": "^7.1.1" + "ip-regex": "^5.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": ">=14" } }, - "node_modules/npm/node_modules/npm-normalize-package-bin": { - "version": "3.0.1", + "node_modules/npm/node_modules/clean-stack": { + "version": "2.2.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": ">=6" } }, - "node_modules/npm/node_modules/npm-package-arg": { - "version": "11.0.1", + "node_modules/npm/node_modules/cli-columns": { + "version": "4.0.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "hosted-git-info": "^7.0.0", - "proc-log": "^3.0.0", - "semver": "^7.3.5", - "validate-npm-package-name": "^5.0.0" + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/npm/node_modules/cli-table3": { + "version": "0.6.4", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "string-width": "^4.2.0" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "10.* || >= 12.*" + }, + "optionalDependencies": { + "@colors/colors": "1.5.0" + } + }, + "node_modules/npm/node_modules/clone": { + "version": "1.0.4", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=0.8" } }, - "node_modules/npm/node_modules/npm-packlist": { - "version": "8.0.2", + "node_modules/npm/node_modules/cmd-shim": { + "version": "6.0.2", "dev": true, "inBundle": true, "license": "ISC", - "dependencies": { - "ignore-walk": "^6.0.4" - }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/npm-pick-manifest": { - "version": "9.0.0", + "node_modules/npm/node_modules/color-convert": { + "version": "2.0.1", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "npm-install-checks": "^6.0.0", - "npm-normalize-package-bin": "^3.0.0", - "npm-package-arg": "^11.0.0", - "semver": "^7.3.5" + "color-name": "~1.1.4" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": ">=7.0.0" } }, - "node_modules/npm/node_modules/npm-profile": { - "version": "9.0.0", + "node_modules/npm/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/color-support": { + "version": "1.1.3", "dev": true, "inBundle": true, "license": "ISC", - "dependencies": { - "npm-registry-fetch": "^16.0.0", - "proc-log": "^3.0.0" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" + "bin": { + "color-support": "bin.js" } }, - "node_modules/npm/node_modules/npm-registry-fetch": { - "version": "16.1.0", + "node_modules/npm/node_modules/columnify": { + "version": "1.6.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "make-fetch-happen": "^13.0.0", - "minipass": "^7.0.2", - "minipass-fetch": "^3.0.0", - "minipass-json-stream": "^1.0.1", - "minizlib": "^2.1.2", - "npm-package-arg": "^11.0.0", - "proc-log": "^3.0.0" + "strip-ansi": "^6.0.1", + "wcwidth": "^1.0.0" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": ">=8.0.0" } }, - "node_modules/npm/node_modules/npm-user-validate": { - "version": "2.0.0", + "node_modules/npm/node_modules/common-ancestor-path": { + "version": "1.0.1", "dev": true, "inBundle": true, - "license": "BSD-2-Clause", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } + "license": "ISC" }, - "node_modules/npm/node_modules/npmlog": { - "version": "7.0.1", + "node_modules/npm/node_modules/console-control-strings": { + "version": "1.1.0", "dev": true, "inBundle": true, - "license": "ISC", - "dependencies": { - "are-we-there-yet": "^4.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^5.0.0", - "set-blocking": "^2.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } + "license": "ISC" }, - "node_modules/npm/node_modules/p-map": { - "version": "4.0.0", + "node_modules/npm/node_modules/cross-spawn": { + "version": "7.0.3", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { - "aggregate-error": "^3.0.0" + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 8" } }, - "node_modules/npm/node_modules/pacote": { - "version": "17.0.6", + "node_modules/npm/node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/git": "^5.0.0", - "@npmcli/installed-package-contents": "^2.0.1", - "@npmcli/promise-spawn": "^7.0.0", - "@npmcli/run-script": "^7.0.0", - "cacache": "^18.0.0", - "fs-minipass": "^3.0.0", - "minipass": "^7.0.2", - "npm-package-arg": "^11.0.0", - "npm-packlist": "^8.0.0", - "npm-pick-manifest": "^9.0.0", - "npm-registry-fetch": "^16.0.0", - "proc-log": "^3.0.0", - "promise-retry": "^2.0.1", - "read-package-json": "^7.0.0", - "read-package-json-fast": "^3.0.0", - "sigstore": "^2.2.0", - "ssri": "^10.0.0", - "tar": "^6.1.11" + "isexe": "^2.0.0" }, "bin": { - "pacote": "lib/bin.js" + "node-which": "bin/node-which" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": ">= 8" } }, - "node_modules/npm/node_modules/parse-conflict-json": { - "version": "3.0.1", + "node_modules/npm/node_modules/cssesc": { + "version": "3.0.0", "dev": true, "inBundle": true, - "license": "ISC", - "dependencies": { - "json-parse-even-better-errors": "^3.0.0", - "just-diff": "^6.0.0", - "just-diff-apply": "^5.2.0" + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": ">=4" } }, - "node_modules/npm/node_modules/path-key": { - "version": "3.1.1", + "node_modules/npm/node_modules/debug": { + "version": "4.3.4", "dev": true, "inBundle": true, "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/path-scurry": { - "version": "1.10.1", - "dev": true, - "inBundle": true, - "license": "BlueOak-1.0.0", "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + "ms": "2.1.2" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=6.0" }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/npm/node_modules/postcss-selector-parser": { - "version": "6.0.15", + "node_modules/npm/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/defaults": { + "version": "1.0.4", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { - "cssesc": "^3.0.0", - "util-deprecate": "^1.0.2" + "clone": "^1.0.2" }, - "engines": { - "node": ">=4" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/npm/node_modules/proc-log": { - "version": "3.0.0", + "node_modules/npm/node_modules/diff": { + "version": "5.2.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "BSD-3-Clause", "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": ">=0.3.1" } }, - "node_modules/npm/node_modules/promise-all-reject-late": { - "version": "1.0.1", + "node_modules/npm/node_modules/eastasianwidth": { + "version": "0.2.0", "dev": true, "inBundle": true, - "license": "ISC", - "funding": { - "url": "https://github.com/sponsors/isaacs" + "license": "MIT" + }, + "node_modules/npm/node_modules/emoji-regex": { + "version": "8.0.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/encoding": { + "version": "0.1.13", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.2" } }, - "node_modules/npm/node_modules/promise-call-limit": { - "version": "3.0.1", + "node_modules/npm/node_modules/env-paths": { + "version": "2.2.1", "dev": true, "inBundle": true, - "license": "ISC", - "funding": { - "url": "https://github.com/sponsors/isaacs" + "license": "MIT", + "engines": { + "node": ">=6" } }, - "node_modules/npm/node_modules/promise-inflight": { - "version": "1.0.1", + "node_modules/npm/node_modules/err-code": { + "version": "2.0.3", "dev": true, "inBundle": true, - "license": "ISC" + "license": "MIT" }, - "node_modules/npm/node_modules/promise-retry": { - "version": "2.0.1", + "node_modules/npm/node_modules/exponential-backoff": { + "version": "3.1.1", + "dev": true, + "inBundle": true, + "license": "Apache-2.0" + }, + "node_modules/npm/node_modules/fastest-levenshtein": { + "version": "1.0.16", "dev": true, "inBundle": true, "license": "MIT", - "dependencies": { - "err-code": "^2.0.2", - "retry": "^0.12.0" - }, "engines": { - "node": ">=10" + "node": ">= 4.9.1" } }, - "node_modules/npm/node_modules/promzard": { - "version": "1.0.0", + "node_modules/npm/node_modules/foreground-child": { + "version": "3.1.1", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "read": "^2.0.0" + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/qrcode-terminal": { - "version": "0.12.0", - "dev": true, - "inBundle": true, - "bin": { - "qrcode-terminal": "bin/qrcode-terminal.js" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/npm/node_modules/read": { - "version": "2.1.0", + "node_modules/npm/node_modules/fs-minipass": { + "version": "3.0.3", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "mute-stream": "~1.0.0" + "minipass": "^7.0.3" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/read-cmd-shim": { - "version": "4.0.0", + "node_modules/npm/node_modules/function-bind": { + "version": "1.1.2", "dev": true, "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/npm/node_modules/read-package-json": { - "version": "7.0.0", + "node_modules/npm/node_modules/gauge": { + "version": "5.0.1", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "glob": "^10.2.2", - "json-parse-even-better-errors": "^3.0.0", - "normalize-package-data": "^6.0.0", - "npm-normalize-package-bin": "^3.0.0" + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.3", + "console-control-strings": "^1.1.0", + "has-unicode": "^2.0.1", + "signal-exit": "^4.0.1", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.5" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/read-package-json-fast": { - "version": "3.0.2", + "node_modules/npm/node_modules/glob": { + "version": "10.3.12", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "json-parse-even-better-errors": "^3.0.0", - "npm-normalize-package-bin": "^3.0.0" + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.6", + "minimatch": "^9.0.1", + "minipass": "^7.0.4", + "path-scurry": "^1.10.2" + }, + "bin": { + "glob": "dist/esm/bin.mjs" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/npm/node_modules/retry": { - "version": "0.12.0", + "node_modules/npm/node_modules/graceful-fs": { + "version": "4.2.11", "dev": true, "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } + "license": "ISC" }, - "node_modules/npm/node_modules/safer-buffer": { - "version": "2.1.2", + "node_modules/npm/node_modules/has-unicode": { + "version": "2.0.1", "dev": true, "inBundle": true, - "license": "MIT", - "optional": true + "license": "ISC" }, - "node_modules/npm/node_modules/semver": { - "version": "7.5.4", + "node_modules/npm/node_modules/hasown": { + "version": "2.0.2", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" + "function-bind": "^1.1.2" }, "engines": { - "node": ">=10" + "node": ">= 0.4" } }, - "node_modules/npm/node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", + "node_modules/npm/node_modules/hosted-git-info": { + "version": "7.0.1", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "yallist": "^4.0.0" + "lru-cache": "^10.0.1" }, "engines": { - "node": ">=10" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/set-blocking": { - "version": "2.0.0", + "node_modules/npm/node_modules/http-cache-semantics": { + "version": "4.1.1", "dev": true, "inBundle": true, - "license": "ISC" + "license": "BSD-2-Clause" }, - "node_modules/npm/node_modules/shebang-command": { - "version": "2.0.0", + "node_modules/npm/node_modules/http-proxy-agent": { + "version": "7.0.2", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { - "shebang-regex": "^3.0.0" + "agent-base": "^7.1.0", + "debug": "^4.3.4" }, "engines": { - "node": ">=8" + "node": ">= 14" } }, - "node_modules/npm/node_modules/shebang-regex": { - "version": "3.0.0", + "node_modules/npm/node_modules/https-proxy-agent": { + "version": "7.0.4", "dev": true, "inBundle": true, "license": "MIT", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, "engines": { - "node": ">=8" + "node": ">= 14" } }, - "node_modules/npm/node_modules/signal-exit": { - "version": "4.1.0", + "node_modules/npm/node_modules/iconv-lite": { + "version": "0.6.3", "dev": true, "inBundle": true, - "license": "ISC", - "engines": { - "node": ">=14" + "license": "MIT", + "optional": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/npm/node_modules/sigstore": { - "version": "2.2.0", + "node_modules/npm/node_modules/ignore-walk": { + "version": "6.0.4", "dev": true, "inBundle": true, - "license": "Apache-2.0", + "license": "ISC", "dependencies": { - "@sigstore/bundle": "^2.1.1", - "@sigstore/core": "^0.2.0", - "@sigstore/protobuf-specs": "^0.2.1", - "@sigstore/sign": "^2.2.1", - "@sigstore/tuf": "^2.3.0", - "@sigstore/verify": "^0.1.0" + "minimatch": "^9.0.0" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/smart-buffer": { - "version": "4.2.0", + "node_modules/npm/node_modules/imurmurhash": { + "version": "0.1.4", "dev": true, "inBundle": true, "license": "MIT", "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" + "node": ">=0.8.19" } }, - "node_modules/npm/node_modules/socks": { - "version": "2.7.1", + "node_modules/npm/node_modules/indent-string": { + "version": "4.0.0", "dev": true, "inBundle": true, "license": "MIT", - "dependencies": { - "ip": "^2.0.0", - "smart-buffer": "^4.2.0" - }, "engines": { - "node": ">= 10.13.0", - "npm": ">= 3.0.0" + "node": ">=8" } }, - "node_modules/npm/node_modules/socks-proxy-agent": { - "version": "8.0.2", + "node_modules/npm/node_modules/ini": { + "version": "4.1.2", "dev": true, "inBundle": true, - "license": "MIT", - "dependencies": { - "agent-base": "^7.0.2", - "debug": "^4.3.4", - "socks": "^2.7.1" - }, + "license": "ISC", "engines": { - "node": ">= 14" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/spdx-correct": { - "version": "3.2.0", + "node_modules/npm/node_modules/init-package-json": { + "version": "6.0.2", "dev": true, "inBundle": true, - "license": "Apache-2.0", + "license": "ISC", "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" + "@npmcli/package-json": "^5.0.0", + "npm-package-arg": "^11.0.0", + "promzard": "^1.0.0", + "read": "^3.0.1", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4", + "validate-npm-package-name": "^5.0.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/spdx-exceptions": { - "version": "2.3.0", - "dev": true, - "inBundle": true, - "license": "CC-BY-3.0" - }, - "node_modules/npm/node_modules/spdx-expression-parse": { - "version": "3.0.1", + "node_modules/npm/node_modules/ip-address": { + "version": "9.0.5", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" } }, - "node_modules/npm/node_modules/spdx-license-ids": { - "version": "3.0.16", + "node_modules/npm/node_modules/ip-address/node_modules/sprintf-js": { + "version": "1.1.3", "dev": true, "inBundle": true, - "license": "CC0-1.0" + "license": "BSD-3-Clause" }, - "node_modules/npm/node_modules/ssri": { - "version": "10.0.5", + "node_modules/npm/node_modules/ip-regex": { + "version": "5.0.0", "dev": true, "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^7.0.3" - }, + "license": "MIT", "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/npm/node_modules/string-width": { - "version": "4.2.3", + "node_modules/npm/node_modules/is-cidr": { + "version": "5.0.5", "dev": true, "inBundle": true, - "license": "MIT", + "license": "BSD-2-Clause", "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "cidr-regex": "^4.0.4" }, "engines": { - "node": ">=8" + "node": ">=14" } }, - "node_modules/npm/node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", + "node_modules/npm/node_modules/is-core-module": { + "version": "2.13.1", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "hasown": "^2.0.0" }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/npm/node_modules/strip-ansi": { - "version": "6.0.1", + "node_modules/npm/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", "dev": true, "inBundle": true, "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, "engines": { "node": ">=8" } }, - "node_modules/npm/node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", + "node_modules/npm/node_modules/is-lambda": { + "version": "1.0.1", "dev": true, "inBundle": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } + "license": "MIT" }, - "node_modules/npm/node_modules/supports-color": { - "version": "9.4.0", + "node_modules/npm/node_modules/isexe": { + "version": "2.0.0", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/jackspeak": { + "version": "2.3.6", "dev": true, "inBundle": true, - "license": "MIT", + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, "engines": { - "node": ">=12" + "node": ">=14" }, "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" } }, - "node_modules/npm/node_modules/tar": { - "version": "6.2.0", + "node_modules/npm/node_modules/jsbn": { + "version": "1.1.0", "dev": true, "inBundle": true, - "license": "ISC", - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } + "license": "MIT" }, - "node_modules/npm/node_modules/tar/node_modules/fs-minipass": { - "version": "2.1.0", + "node_modules/npm/node_modules/json-parse-even-better-errors": { + "version": "3.0.1", "dev": true, "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, + "license": "MIT", "engines": { - "node": ">= 8" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", + "node_modules/npm/node_modules/json-stringify-nice": { + "version": "1.1.4", "dev": true, "inBundle": true, "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/npm/node_modules/tar/node_modules/minipass": { - "version": "5.0.0", + "node_modules/npm/node_modules/jsonparse": { + "version": "1.3.1", "dev": true, + "engines": [ + "node >= 0.2.0" + ], "inBundle": true, - "license": "ISC", - "engines": { - "node": ">=8" - } + "license": "MIT" }, - "node_modules/npm/node_modules/text-table": { - "version": "0.2.0", + "node_modules/npm/node_modules/just-diff": { + "version": "6.0.2", "dev": true, "inBundle": true, "license": "MIT" }, - "node_modules/npm/node_modules/tiny-relative-date": { - "version": "1.3.0", + "node_modules/npm/node_modules/just-diff-apply": { + "version": "5.5.0", "dev": true, "inBundle": true, "license": "MIT" }, - "node_modules/npm/node_modules/treeverse": { - "version": "3.0.0", + "node_modules/npm/node_modules/libnpmaccess": { + "version": "8.0.3", "dev": true, "inBundle": true, "license": "ISC", + "dependencies": { + "npm-package-arg": "^11.0.1", + "npm-registry-fetch": "^16.2.0" + }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/tuf-js": { - "version": "2.2.0", + "node_modules/npm/node_modules/libnpmdiff": { + "version": "6.0.9", "dev": true, "inBundle": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "@tufjs/models": "2.0.0", - "debug": "^4.3.4", - "make-fetch-happen": "^13.0.0" + "@npmcli/arborist": "^7.2.1", + "@npmcli/disparity-colors": "^3.0.0", + "@npmcli/installed-package-contents": "^2.0.2", + "binary-extensions": "^2.3.0", + "diff": "^5.1.0", + "minimatch": "^9.0.4", + "npm-package-arg": "^11.0.1", + "pacote": "^17.0.4", + "tar": "^6.2.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/unique-filename": { - "version": "3.0.0", + "node_modules/npm/node_modules/libnpmexec": { + "version": "7.0.10", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "unique-slug": "^4.0.0" + "@npmcli/arborist": "^7.2.1", + "@npmcli/run-script": "^7.0.2", + "ci-info": "^4.0.0", + "npm-package-arg": "^11.0.1", + "npmlog": "^7.0.1", + "pacote": "^17.0.4", + "proc-log": "^3.0.0", + "read": "^3.0.1", + "read-package-json-fast": "^3.0.2", + "semver": "^7.3.7", + "walk-up-path": "^3.0.1" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/unique-slug": { - "version": "4.0.0", + "node_modules/npm/node_modules/libnpmfund": { + "version": "5.0.7", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "imurmurhash": "^0.1.4" + "@npmcli/arborist": "^7.2.1" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/util-deprecate": { - "version": "1.0.2", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/validate-npm-package-license": { - "version": "3.0.4", + "node_modules/npm/node_modules/libnpmhook": { + "version": "10.0.2", "dev": true, "inBundle": true, - "license": "Apache-2.0", + "license": "ISC", "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" + "aproba": "^2.0.0", + "npm-registry-fetch": "^16.2.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/validate-npm-package-name": { - "version": "5.0.0", + "node_modules/npm/node_modules/libnpmorg": { + "version": "6.0.3", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "builtins": "^5.0.0" + "aproba": "^2.0.0", + "npm-registry-fetch": "^16.2.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/walk-up-path": { - "version": "3.0.1", + "node_modules/npm/node_modules/libnpmpack": { + "version": "6.0.9", "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^7.2.1", + "@npmcli/run-script": "^7.0.2", + "npm-package-arg": "^11.0.1", + "pacote": "^17.0.4" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } }, - "node_modules/npm/node_modules/wcwidth": { - "version": "1.0.1", + "node_modules/npm/node_modules/libnpmpublish": { + "version": "9.0.5", "dev": true, "inBundle": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "defaults": "^1.0.3" + "ci-info": "^4.0.0", + "normalize-package-data": "^6.0.0", + "npm-package-arg": "^11.0.1", + "npm-registry-fetch": "^16.2.0", + "proc-log": "^3.0.0", + "semver": "^7.3.7", + "sigstore": "^2.2.0", + "ssri": "^10.0.5" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/which": { - "version": "4.0.0", + "node_modules/npm/node_modules/libnpmsearch": { + "version": "7.0.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "isexe": "^3.1.1" - }, - "bin": { - "node-which": "bin/which.js" + "npm-registry-fetch": "^16.2.0" }, "engines": { - "node": "^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/which/node_modules/isexe": { - "version": "3.1.1", + "node_modules/npm/node_modules/libnpmteam": { + "version": "6.0.2", "dev": true, "inBundle": true, "license": "ISC", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^16.2.0" + }, "engines": { - "node": ">=16" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/wide-align": { - "version": "1.1.5", + "node_modules/npm/node_modules/libnpmversion": { + "version": "5.0.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" + "@npmcli/git": "^5.0.3", + "@npmcli/run-script": "^7.0.2", + "json-parse-even-better-errors": "^3.0.0", + "proc-log": "^3.0.0", + "semver": "^7.3.7" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/wrap-ansi": { - "version": "8.1.0", + "node_modules/npm/node_modules/lru-cache": { + "version": "10.2.0", "dev": true, "inBundle": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, + "license": "ISC", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "node": "14 || >=16.14" } }, - "node_modules/npm/node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", + "node_modules/npm/node_modules/make-fetch-happen": { + "version": "13.0.0", "dev": true, "inBundle": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" + "@npmcli/agent": "^2.0.0", + "cacache": "^18.0.0", + "http-cache-semantics": "^4.1.1", + "is-lambda": "^1.0.1", + "minipass": "^7.0.2", + "minipass-fetch": "^3.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.3", + "promise-retry": "^2.0.1", + "ssri": "^10.0.0" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", + "node_modules/npm/node_modules/minimatch": { + "version": "9.0.4", "dev": true, "inBundle": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "color-convert": "^2.0.1" + "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=8" + "node": ">=16 || 14 >=14.17" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "6.0.1", + "node_modules/npm/node_modules/minipass": { + "version": "7.0.4", "dev": true, "inBundle": true, - "license": "MIT", + "license": "ISC", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + "node": ">=16 || 14 >=14.17" } }, - "node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex": { - "version": "9.2.2", + "node_modules/npm/node_modules/minipass-collect": { + "version": "2.0.1", "dev": true, "inBundle": true, - "license": "MIT" + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } }, - "node_modules/npm/node_modules/wrap-ansi/node_modules/string-width": { - "version": "5.1.2", + "node_modules/npm/node_modules/minipass-fetch": { + "version": "3.0.4", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" + "minipass": "^7.0.3", + "minipass-sized": "^1.0.3", + "minizlib": "^2.1.2" }, "engines": { - "node": ">=12" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "optionalDependencies": { + "encoding": "^0.1.13" } }, - "node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "7.1.0", + "node_modules/npm/node_modules/minipass-flush": { + "version": "1.0.5", "dev": true, "inBundle": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "ansi-regex": "^6.0.1" + "minipass": "^3.0.0" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" + "node": ">= 8" } }, - "node_modules/npm/node_modules/write-file-atomic": { - "version": "5.0.1", + "node_modules/npm/node_modules/minipass-flush/node_modules/minipass": { + "version": "3.3.6", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "imurmurhash": "^0.1.4", - "signal-exit": "^4.0.1" + "yallist": "^4.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": ">=8" } }, - "node_modules/npm/node_modules/yallist": { - "version": "4.0.0", + "node_modules/npm/node_modules/minipass-json-stream": { + "version": "1.0.1", "dev": true, "inBundle": true, - "license": "ISC" + "license": "MIT", + "dependencies": { + "jsonparse": "^1.3.1", + "minipass": "^3.0.0" + } }, - "node_modules/oas-kit-common": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/oas-kit-common/-/oas-kit-common-1.0.8.tgz", - "integrity": "sha512-pJTS2+T0oGIwgjGpw7sIRU8RQMcUoKCDWFLdBqKB2BNmGpbBMH2sdqAaOXUg8OzonZHU0L7vfJu1mJFEiYDWOQ==", + "node_modules/npm/node_modules/minipass-json-stream/node_modules/minipass": { + "version": "3.3.6", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "fast-safe-stringify": "^2.0.7" + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/oas-linter": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/oas-linter/-/oas-linter-3.2.2.tgz", - "integrity": "sha512-KEGjPDVoU5K6swgo9hJVA/qYGlwfbFx+Kg2QB/kd7rzV5N8N5Mg6PlsoCMohVnQmo+pzJap/F610qTodKzecGQ==", + "node_modules/npm/node_modules/minipass-pipeline": { + "version": "1.2.4", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "@exodus/schemasafe": "^1.0.0-rc.2", - "should": "^13.2.1", - "yaml": "^1.10.0" + "minipass": "^3.0.0" }, - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" + "engines": { + "node": ">=8" } }, - "node_modules/oas-linter/node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass": { + "version": "3.3.6", "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, "engines": { - "node": ">= 6" + "node": ">=8" } }, - "node_modules/oas-resolver": { - "version": "2.5.6", - "resolved": "https://registry.npmjs.org/oas-resolver/-/oas-resolver-2.5.6.tgz", - "integrity": "sha512-Yx5PWQNZomfEhPPOphFbZKi9W93CocQj18NlD2Pa4GWZzdZpSJvYwoiuurRI7m3SpcChrnO08hkuQDL3FGsVFQ==", + "node_modules/npm/node_modules/minipass-sized": { + "version": "1.0.3", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "node-fetch-h2": "^2.3.0", - "oas-kit-common": "^1.0.8", - "reftools": "^1.1.9", - "yaml": "^1.10.0", - "yargs": "^17.0.1" - }, - "bin": { - "resolve": "resolve.js" + "minipass": "^3.0.0" }, - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" + "engines": { + "node": ">=8" } }, - "node_modules/oas-resolver/node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "node_modules/npm/node_modules/minipass-sized/node_modules/minipass": { + "version": "3.3.6", "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, "engines": { - "node": ">= 6" + "node": ">=8" } }, - "node_modules/oas-schema-walker": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/oas-schema-walker/-/oas-schema-walker-1.1.5.tgz", - "integrity": "sha512-2yucenq1a9YPmeNExoUa9Qwrt9RFkjqaMAA1X+U7sbb0AqBeTIdMHky9SQQ6iN94bO5NW0W4TRYXerG+BdAvAQ==", + "node_modules/npm/node_modules/minizlib": { + "version": "2.1.2", "dev": true, - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" + "inBundle": true, + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" } }, - "node_modules/oas-validator": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/oas-validator/-/oas-validator-5.0.8.tgz", - "integrity": "sha512-cu20/HE5N5HKqVygs3dt94eYJfBi0TsZvPVXDhbXQHiEityDN+RROTleefoKRKKJ9dFAF2JBkDHgvWj0sjKGmw==", + "node_modules/npm/node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "call-me-maybe": "^1.0.1", - "oas-kit-common": "^1.0.8", - "oas-linter": "^3.2.2", - "oas-resolver": "^2.5.6", - "oas-schema-walker": "^1.1.5", - "reftools": "^1.1.9", - "should": "^13.2.1", - "yaml": "^1.10.0" + "yallist": "^4.0.0" }, - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" + "engines": { + "node": ">=8" } }, - "node_modules/oas-validator/node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "node_modules/npm/node_modules/mkdirp": { + "version": "1.0.4", "dev": true, + "inBundle": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, "engines": { - "node": ">= 6" + "node": ">=10" } }, - "node_modules/object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "node_modules/npm/node_modules/ms": { + "version": "2.1.3", "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "inBundle": true, + "license": "MIT" }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "node_modules/npm/node_modules/mute-stream": { + "version": "1.0.0", "dev": true, + "inBundle": true, + "license": "ISC", "engines": { - "node": ">= 0.4" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/object.assign": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", - "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "node_modules/npm/node_modules/negotiator": { + "version": "0.6.3", "dev": true, - "dependencies": { - "call-bind": "^1.0.5", - "define-properties": "^1.2.1", - "has-symbols": "^1.0.3", - "object-keys": "^1.1.1" - }, + "inBundle": true, + "license": "MIT", "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 0.6" } }, - "node_modules/object.fromentries": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", - "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", + "node_modules/npm/node_modules/node-gyp": { + "version": "10.1.0", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "glob": "^10.3.10", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^13.0.0", + "nopt": "^7.0.0", + "proc-log": "^3.0.0", + "semver": "^7.3.5", + "tar": "^6.1.2", + "which": "^4.0.0" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/object.groupby": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.2.tgz", - "integrity": "sha512-bzBq58S+x+uo0VjurFT0UktpKHOZmv4/xePiOA1nbB9pMqpGK7rUPNgf+1YC+7mE+0HzhTMqNUuCqvKhj6FnBw==", + "node_modules/npm/node_modules/nopt": { + "version": "7.2.0", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "array.prototype.filter": "^1.0.3", - "call-bind": "^1.0.5", - "define-properties": "^1.2.1", - "es-abstract": "^1.22.3", - "es-errors": "^1.0.0" + "abbrev": "^2.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/object.values": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", - "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", + "node_modules/npm/node_modules/normalize-package-data": { + "version": "6.0.0", "dev": true, + "inBundle": true, + "license": "BSD-2-Clause", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "hosted-git-info": "^7.0.0", + "is-core-module": "^2.8.1", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": "^16.14.0 || >=18.0.0" } }, - "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==", + "node_modules/npm/node_modules/npm-audit-report": { + "version": "5.0.0", "dev": true, - "dependencies": { - "wrappy": "1" + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "node_modules/npm/node_modules/npm-bundled": { + "version": "3.0.0", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "mimic-fn": "^2.1.0" + "npm-normalize-package-bin": "^3.0.0" }, "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/optionator": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", - "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "node_modules/npm/node_modules/npm-install-checks": { + "version": "6.3.0", "dev": true, + "inBundle": true, + "license": "BSD-2-Clause", "dependencies": { - "@aashutoshrathi/word-wrap": "^1.2.3", - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0" + "semver": "^7.1.1" }, "engines": { - "node": ">= 0.8.0" - } - }, - "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==", - "dev": true, - "engines": { - "node": ">=14.16" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/p-each-series": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-3.0.0.tgz", - "integrity": "sha512-lastgtAdoH9YaLyDa5i5z64q+kzOcQHsQ5SsZJD3q0VEyI8mq872S3geuNbRUQLVAE9siMfgKrpj7MloKFHruw==", + "node_modules/npm/node_modules/npm-normalize-package-bin": { + "version": "3.0.1", "dev": true, + "inBundle": true, + "license": "ISC", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/p-filter": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-4.1.0.tgz", - "integrity": "sha512-37/tPdZ3oJwHaS3gNJdenCDB3Tz26i9sjhnguBtvN0vYlRIiDNnvTWkuh+0hETV9rLPdJ3rlL3yVOYPIAnM8rw==", + "node_modules/npm/node_modules/npm-package-arg": { + "version": "11.0.1", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "p-map": "^7.0.1" + "hosted-git-info": "^7.0.0", + "proc-log": "^3.0.0", + "semver": "^7.3.5", + "validate-npm-package-name": "^5.0.0" }, "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/p-is-promise": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-3.0.0.tgz", - "integrity": "sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ==", + "node_modules/npm/node_modules/npm-packlist": { + "version": "8.0.2", "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "ignore-walk": "^6.0.4" + }, "engines": { - "node": ">=8" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "node_modules/npm/node_modules/npm-pick-manifest": { + "version": "9.0.0", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "yocto-queue": "^0.1.0" + "npm-install-checks": "^6.0.0", + "npm-normalize-package-bin": "^3.0.0", + "npm-package-arg": "^11.0.0", + "semver": "^7.3.5" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "node_modules/npm/node_modules/npm-profile": { + "version": "9.0.0", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "p-limit": "^3.0.2" + "npm-registry-fetch": "^16.0.0", + "proc-log": "^3.0.0" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/p-map": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.1.tgz", - "integrity": "sha512-2wnaR0XL/FDOj+TgpDuRb2KTjLnu3Fma6b1ZUwGY7LcqenMcvP/YFpjpbPKY6WVGsbuJZRuoUz8iPrt8ORnAFw==", + "node_modules/npm/node_modules/npm-registry-fetch": { + "version": "16.2.0", "dev": true, - "engines": { - "node": ">=18" + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/redact": "^1.1.0", + "make-fetch-happen": "^13.0.0", + "minipass": "^7.0.2", + "minipass-fetch": "^3.0.0", + "minipass-json-stream": "^1.0.1", + "minizlib": "^2.1.2", + "npm-package-arg": "^11.0.0", + "proc-log": "^3.0.0" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-reduce": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-3.0.0.tgz", - "integrity": "sha512-xsrIUgI0Kn6iyDYm9StOpOeK29XM1aboGji26+QEortiFST1hGZaUQOLhtEbqHErPpGW/aSz6allwK2qcptp0Q==", - "dev": true, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "node_modules/npm/node_modules/npm-user-validate": { + "version": "2.0.0", "dev": true, + "inBundle": true, + "license": "BSD-2-Clause", "engines": { - "node": ">=6" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "node_modules/npm/node_modules/npmlog": { + "version": "7.0.1", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "callsites": "^3.0.0" + "are-we-there-yet": "^4.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^5.0.0", + "set-blocking": "^2.0.0" }, "engines": { - "node": ">=6" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "node_modules/npm/node_modules/p-map": { + "version": "4.0.0", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" + "aggregate-error": "^3.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "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==", + "node_modules/npm/node_modules/pacote": { + "version": "17.0.6", "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^5.0.0", + "@npmcli/installed-package-contents": "^2.0.1", + "@npmcli/promise-spawn": "^7.0.0", + "@npmcli/run-script": "^7.0.0", + "cacache": "^18.0.0", + "fs-minipass": "^3.0.0", + "minipass": "^7.0.2", + "npm-package-arg": "^11.0.0", + "npm-packlist": "^8.0.0", + "npm-pick-manifest": "^9.0.0", + "npm-registry-fetch": "^16.0.0", + "proc-log": "^3.0.0", + "promise-retry": "^2.0.1", + "read-package-json": "^7.0.0", + "read-package-json-fast": "^3.0.0", + "sigstore": "^2.2.0", + "ssri": "^10.0.0", + "tar": "^6.1.11" + }, + "bin": { + "pacote": "lib/bin.js" + }, "engines": { - "node": ">=0.10.0" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "node_modules/npm/node_modules/parse-conflict-json": { + "version": "3.0.1", "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "json-parse-even-better-errors": "^3.0.0", + "just-diff": "^6.0.0", + "just-diff-apply": "^5.2.0" + }, "engines": { - "node": ">=8" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "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==", + "node_modules/npm/node_modules/path-key": { + "version": "3.1.1", "dev": true, + "inBundle": true, + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/pathe": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", - "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", - "dev": true - }, - "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true, - "engines": { - "node": "*" - } - }, - "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 - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "node_modules/npm/node_modules/path-scurry": { + "version": "1.10.2", "dev": true, + "inBundle": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, "engines": { - "node": ">=8.6" + "node": ">=16 || 14 >=14.17" }, "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/pidtree": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", - "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "node_modules/npm/node_modules/postcss-selector-parser": { + "version": "6.0.16", "dev": true, - "bin": { - "pidtree": "bin/pidtree.js" + "inBundle": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" }, "engines": { - "node": ">=0.10" + "node": ">=4" } }, - "node_modules/pify": { + "node_modules/npm/node_modules/proc-log": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", "dev": true, + "inBundle": true, + "license": "ISC", "engines": { - "node": ">=4" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/pkg-conf": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz", - "integrity": "sha512-C+VUP+8jis7EsQZIhDYmS5qlNtjv2yP4SNtjXK9AP1ZcTRlnSfuumaTnRfYZnYgUUYVIKqL0fRvmUGDV2fmp6g==", + "node_modules/npm/node_modules/promise-all-reject-late": { + "version": "1.0.1", "dev": true, - "dependencies": { - "find-up": "^2.0.0", - "load-json-file": "^4.0.0" - }, - "engines": { - "node": ">=4" + "inBundle": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/pkg-conf/node_modules/find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "node_modules/npm/node_modules/promise-call-limit": { + "version": "3.0.1", "dev": true, - "dependencies": { - "locate-path": "^2.0.0" - }, - "engines": { - "node": ">=4" + "inBundle": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/pkg-conf/node_modules/locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "node_modules/npm/node_modules/promise-inflight": { + "version": "1.0.1", "dev": true, - "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=4" - } + "inBundle": true, + "license": "ISC" }, - "node_modules/pkg-conf/node_modules/p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "node_modules/npm/node_modules/promise-retry": { + "version": "2.0.1", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "p-try": "^1.0.0" + "err-code": "^2.0.2", + "retry": "^0.12.0" }, "engines": { - "node": ">=4" + "node": ">=10" } }, - "node_modules/pkg-conf/node_modules/p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "node_modules/npm/node_modules/promzard": { + "version": "1.0.1", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "p-limit": "^1.1.0" + "read": "^3.0.1" }, "engines": { - "node": ">=4" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/pkg-conf/node_modules/p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "node_modules/npm/node_modules/qrcode-terminal": { + "version": "0.12.0", "dev": true, - "engines": { - "node": ">=4" + "inBundle": true, + "bin": { + "qrcode-terminal": "bin/qrcode-terminal.js" } }, - "node_modules/pkg-conf/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "node_modules/npm/node_modules/read": { + "version": "3.0.1", "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "mute-stream": "^1.0.0" + }, "engines": { - "node": ">=4" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/pkg-types": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", - "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "node_modules/npm/node_modules/read-cmd-shim": { + "version": "4.0.0", "dev": true, - "dependencies": { - "jsonc-parser": "^3.2.0", - "mlly": "^1.2.0", - "pathe": "^1.1.0" + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/pluralize": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", - "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "node_modules/npm/node_modules/read-package-json": { + "version": "7.0.0", "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "glob": "^10.2.2", + "json-parse-even-better-errors": "^3.0.0", + "normalize-package-data": "^6.0.0", + "npm-normalize-package-bin": "^3.0.0" + }, "engines": { - "node": ">=4" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/postcss": { - "version": "8.4.33", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", - "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", + "node_modules/npm/node_modules/read-package-json-fast": { + "version": "3.0.2", "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], + "inBundle": true, + "license": "ISC", "dependencies": { - "nanoid": "^3.3.7", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "json-parse-even-better-errors": "^3.0.0", + "npm-normalize-package-bin": "^3.0.0" }, "engines": { - "node": "^10 || ^12 || >=14" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "node_modules/npm/node_modules/retry": { + "version": "0.12.0", "dev": true, + "inBundle": true, + "license": "MIT", "engines": { - "node": ">= 0.8.0" + "node": ">= 4" } }, - "node_modules/prettier": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", - "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "node_modules/npm/node_modules/safer-buffer": { + "version": "2.1.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true + }, + "node_modules/npm/node_modules/semver": { + "version": "7.6.0", "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { - "prettier": "bin/prettier.cjs" + "semver": "bin/semver.js" }, "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" + "node": ">=10" } }, - "node_modules/prettier-linter-helpers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "node_modules/npm/node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "fast-diff": "^1.1.2" + "yallist": "^4.0.0" }, "engines": { - "node": ">=6.0.0" + "node": ">=10" } }, - "node_modules/prettier-plugin-packagejson": { - "version": "2.4.10", - "resolved": "https://registry.npmjs.org/prettier-plugin-packagejson/-/prettier-plugin-packagejson-2.4.10.tgz", - "integrity": "sha512-qFzOfQDHi1tzvVJRuZ2jh1j6IFV5MURh5m5WDt+qfEMOf4SSL5RpwSysiX8u0W1PJYsM0vKJGNULt43wwteKiQ==", + "node_modules/npm/node_modules/set-blocking": { + "version": "2.0.0", "dev": true, - "dependencies": { - "sort-package-json": "2.7.0", - "synckit": "0.9.0" - }, - "peerDependencies": { - "prettier": ">= 1.16.0" - }, - "peerDependenciesMeta": { - "prettier": { - "optional": true - } - } + "inBundle": true, + "license": "ISC" }, - "node_modules/prettier-plugin-packagejson/node_modules/synckit": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.0.tgz", - "integrity": "sha512-7RnqIMq572L8PeEzKeBINYEJDDxpcH8JEgLwUqBd3TkofhFRbkq4QLR0u+36avGAhCRbk2nnmjcW9SE531hPDg==", + "node_modules/npm/node_modules/shebang-command": { + "version": "2.0.0", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "@pkgr/core": "^0.1.0", - "tslib": "^2.6.2" + "shebang-regex": "^3.0.0" }, "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/unts" + "node": ">=8" } }, - "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==", + "node_modules/npm/node_modules/shebang-regex": { + "version": "3.0.0", "dev": true, - "dependencies": { - "@jest/schemas": "^29.6.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, + "inBundle": true, + "license": "MIT", "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">=8" } }, - "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==", + "node_modules/npm/node_modules/signal-exit": { + "version": "4.1.0", "dev": true, + "inBundle": true, + "license": "ISC", "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, - "node_modules/propagate": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz", - "integrity": "sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==", + "node_modules/npm/node_modules/sigstore": { + "version": "2.3.0", "dev": true, + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/bundle": "^2.3.1", + "@sigstore/core": "^1.0.0", + "@sigstore/protobuf-specs": "^0.3.1", + "@sigstore/sign": "^2.3.0", + "@sigstore/tuf": "^2.3.1", + "@sigstore/verify": "^1.2.0" + }, "engines": { - "node": ">= 8" - } - }, - "node_modules/proto-list": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", - "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": "^16.14.0 || >=18.0.0" } }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "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==", + "node_modules/npm/node_modules/smart-buffer": { + "version": "4.2.0", "dev": true, + "inBundle": true, + "license": "MIT", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 6.0.0", + "npm": ">= 3.0.0" } }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "node_modules/npm/node_modules/socks": { + "version": "2.8.3", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" + "ip-address": "^9.0.5", + "smart-buffer": "^4.2.0" }, - "bin": { - "rc": "cli.js" + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" } }, - "node_modules/rc/node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "node_modules/npm/node_modules/socks-proxy-agent": { + "version": "8.0.3", "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.1", + "debug": "^4.3.4", + "socks": "^2.7.1" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 14" } }, - "node_modules/react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "dev": true - }, - "node_modules/read-pkg": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-8.1.0.tgz", - "integrity": "sha512-PORM8AgzXeskHO/WEv312k9U03B8K9JSiWF/8N9sUuFjBa+9SF2u6K7VClzXwDXab51jCd8Nd36CNM+zR97ScQ==", + "node_modules/npm/node_modules/spdx-correct": { + "version": "3.2.0", "dev": true, + "inBundle": true, + "license": "Apache-2.0", "dependencies": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^6.0.0", - "parse-json": "^7.0.0", - "type-fest": "^4.2.0" - }, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" } }, - "node_modules/read-pkg-up": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-10.1.0.tgz", - "integrity": "sha512-aNtBq4jR8NawpKJQldrQcSW9y/d+KWH4v24HWkHljOZ7H0av+YTGANBzRh9A5pw7v/bLVsLVPpOhJ7gHNVy8lA==", + "node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse": { + "version": "3.0.1", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "find-up": "^6.3.0", - "read-pkg": "^8.1.0", - "type-fest": "^4.2.0" - }, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" } }, - "node_modules/read-pkg-up/node_modules/find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "node_modules/npm/node_modules/spdx-exceptions": { + "version": "2.5.0", + "dev": true, + "inBundle": true, + "license": "CC-BY-3.0" + }, + "node_modules/npm/node_modules/spdx-expression-parse": { + "version": "4.0.0", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" } }, - "node_modules/read-pkg-up/node_modules/locate-path": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", - "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "node_modules/npm/node_modules/spdx-license-ids": { + "version": "3.0.17", + "dev": true, + "inBundle": true, + "license": "CC0-1.0" + }, + "node_modules/npm/node_modules/ssri": { + "version": "10.0.5", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "p-locate": "^6.0.0" + "minipass": "^7.0.3" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/read-pkg-up/node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "node_modules/npm/node_modules/string-width": { + "version": "4.2.3", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "yocto-queue": "^1.0.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/read-pkg-up/node_modules/p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "node_modules/npm/node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "p-limit": "^4.0.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/read-pkg-up/node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "node_modules/npm/node_modules/strip-ansi": { + "version": "6.0.1", "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=8" } }, - "node_modules/read-pkg-up/node_modules/type-fest": { - "version": "4.10.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.10.2.tgz", - "integrity": "sha512-anpAG63wSpdEbLwOqH8L84urkL6PiVIov3EMmgIhhThevh9aiMQov+6Btx0wldNcvm4wV+e2/Rt1QdDwKHFbHw==", + "node_modules/npm/node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", "dev": true, - "engines": { - "node": ">=16" + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": ">=8" } }, - "node_modules/read-pkg-up/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==", + "node_modules/npm/node_modules/supports-color": { + "version": "9.4.0", "dev": true, + "inBundle": true, + "license": "MIT", "engines": { - "node": ">=12.20" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/read-pkg/node_modules/json-parse-even-better-errors": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.1.tgz", - "integrity": "sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg==", + "node_modules/npm/node_modules/tar": { + "version": "6.2.1", "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": ">=10" } }, - "node_modules/read-pkg/node_modules/lines-and-columns": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.4.tgz", - "integrity": "sha512-wM1+Z03eypVAVUCE7QdSqpVIvelbOakn1M0bPDoA4SGWPx3sNDVUiMo3L6To6WWGClB7VyXnhQ4Sn7gxiJbE6A==", + "node_modules/npm/node_modules/tar/node_modules/fs-minipass": { + "version": "2.1.0", "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">= 8" } }, - "node_modules/read-pkg/node_modules/parse-json": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-7.1.1.tgz", - "integrity": "sha512-SgOTCX/EZXtZxBE5eJ97P4yGM5n37BwRU+YMsH4vNzFqJV/oWFXXCmwFlgWUM4PrakybVOueJJ6pwHqSVhTFDw==", + "node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "@babel/code-frame": "^7.21.4", - "error-ex": "^1.3.2", - "json-parse-even-better-errors": "^3.0.0", - "lines-and-columns": "^2.0.3", - "type-fest": "^3.8.0" + "yallist": "^4.0.0" }, "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/read-pkg/node_modules/parse-json/node_modules/type-fest": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", - "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", + "node_modules/npm/node_modules/tar/node_modules/minipass": { + "version": "5.0.0", "dev": true, + "inBundle": true, + "license": "ISC", "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/read-pkg/node_modules/type-fest": { - "version": "4.10.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.10.2.tgz", - "integrity": "sha512-anpAG63wSpdEbLwOqH8L84urkL6PiVIov3EMmgIhhThevh9aiMQov+6Btx0wldNcvm4wV+e2/Rt1QdDwKHFbHw==", + "node_modules/npm/node_modules/text-table": { + "version": "0.2.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/tiny-relative-date": { + "version": "1.3.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/treeverse": { + "version": "3.0.0", "dev": true, + "inBundle": true, + "license": "ISC", "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "node_modules/npm/node_modules/tuf-js": { + "version": "2.2.0", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "@tufjs/models": "2.0.0", + "debug": "^4.3.4", + "make-fetch-happen": "^13.0.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/readable-stream/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, - "node_modules/redent": { + "node_modules/npm/node_modules/unique-filename": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", - "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "indent-string": "^4.0.0", - "strip-indent": "^3.0.0" + "unique-slug": "^4.0.0" }, "engines": { - "node": ">=8" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/redeyed": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/redeyed/-/redeyed-2.1.1.tgz", - "integrity": "sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ==", + "node_modules/npm/node_modules/unique-slug": { + "version": "4.0.0", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "esprima": "~4.0.0" - } - }, - "node_modules/reftools": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/reftools/-/reftools-1.1.9.tgz", - "integrity": "sha512-OVede/NQE13xBQ+ob5CKd5KyeJYU2YInb1bmV4nRoOfquZPkAkxuOXicSe1PvqIuZZ4kD13sPKBbR7UFDmli6w==", - "dev": true, - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/regexp-tree": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.27.tgz", - "integrity": "sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==", + "node_modules/npm/node_modules/util-deprecate": { + "version": "1.0.2", "dev": true, - "bin": { - "regexp-tree": "bin/regexp-tree" - } + "inBundle": true, + "license": "MIT" }, - "node_modules/regexp.prototype.flags": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", - "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", + "node_modules/npm/node_modules/validate-npm-package-license": { + "version": "3.0.4", "dev": true, + "inBundle": true, + "license": "Apache-2.0", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "set-function-name": "^2.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" } }, - "node_modules/registry-auth-token": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.0.2.tgz", - "integrity": "sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ==", + "node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse": { + "version": "3.0.1", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "@pnpm/npm-conf": "^2.1.0" - }, - "engines": { - "node": ">=14" + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" } }, - "node_modules/regjsparser": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.10.0.tgz", - "integrity": "sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==", + "node_modules/npm/node_modules/validate-npm-package-name": { + "version": "5.0.0", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "jsesc": "~0.5.0" + "builtins": "^5.0.0" }, - "bin": { - "regjsparser": "bin/parser" + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/regjsparser/node_modules/jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", + "node_modules/npm/node_modules/walk-up-path": { + "version": "3.0.1", "dev": true, - "bin": { - "jsesc": "bin/jsesc" - } + "inBundle": true, + "license": "ISC" }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "node_modules/npm/node_modules/wcwidth": { + "version": "1.0.1", "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "engines": { - "node": ">=0.10.0" + "inBundle": true, + "license": "MIT", + "dependencies": { + "defaults": "^1.0.3" } }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "node_modules/npm/node_modules/which": { + "version": "4.0.0", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" + "isexe": "^3.1.1" }, "bin": { - "resolve": "bin/resolve" + "node-which": "bin/which.js" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "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", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, "engines": { - "node": ">=8" + "node": "^16.13.0 || >=18.0.0" } }, - "node_modules/resolve-global": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-global/-/resolve-global-1.0.0.tgz", - "integrity": "sha512-zFa12V4OLtT5XUX/Q4VLvTfBf+Ok0SPc1FNGM/z9ctUdiU618qwKpWnd0CHs3+RqROfyEg/DhuHbMWYqcgljEw==", + "node_modules/npm/node_modules/which/node_modules/isexe": { + "version": "3.1.1", "dev": true, - "dependencies": { - "global-dirs": "^0.1.1" - }, + "inBundle": true, + "license": "ISC", "engines": { - "node": ">=8" + "node": ">=16" } }, - "node_modules/resolve-pkg-maps": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", - "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "node_modules/npm/node_modules/wide-align": { + "version": "1.1.5", "dev": true, - "funding": { - "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + "inBundle": true, + "license": "ISC", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" } }, - "node_modules/responselike": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", - "integrity": "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==", + "node_modules/npm/node_modules/wrap-ansi": { + "version": "8.1.0", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "lowercase-keys": "^3.0.0" + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" }, "engines": { - "node": ">=14.16" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "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==", + "node_modules/npm/node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/rfdc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.1.tgz", - "integrity": "sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==", - "dev": true - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "glob": "^7.1.3" + "color-convert": "^2.0.1" }, - "bin": { - "rimraf": "bin.js" + "engines": { + "node": ">=8" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/rollup": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.6.tgz", - "integrity": "sha512-05lzkCS2uASX0CiLFybYfVkwNbKZG5NFQ6Go0VWyogFTXXbR039UVsegViTntkk4OglHBdF54ccApXRRuXRbsg==", + "node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.0.1", "dev": true, - "dependencies": { - "@types/estree": "1.0.5" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, + "inBundle": true, + "license": "MIT", "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" + "node": ">=12" }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.9.6", - "@rollup/rollup-android-arm64": "4.9.6", - "@rollup/rollup-darwin-arm64": "4.9.6", - "@rollup/rollup-darwin-x64": "4.9.6", - "@rollup/rollup-linux-arm-gnueabihf": "4.9.6", - "@rollup/rollup-linux-arm64-gnu": "4.9.6", - "@rollup/rollup-linux-arm64-musl": "4.9.6", - "@rollup/rollup-linux-riscv64-gnu": "4.9.6", - "@rollup/rollup-linux-x64-gnu": "4.9.6", - "@rollup/rollup-linux-x64-musl": "4.9.6", - "@rollup/rollup-win32-arm64-msvc": "4.9.6", - "@rollup/rollup-win32-ia32-msvc": "4.9.6", - "@rollup/rollup-win32-x64-msvc": "4.9.6", - "fsevents": "~2.3.2" + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "9.2.2", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } + "inBundle": true, + "license": "MIT" }, - "node_modules/safe-array-concat": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.0.tgz", - "integrity": "sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==", + "node_modules/npm/node_modules/wrap-ansi/node_modules/string-width": { + "version": "5.1.2", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.5", - "get-intrinsic": "^1.2.2", - "has-symbols": "^1.0.3", - "isarray": "^2.0.5" + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" }, "engines": { - "node": ">=0.4" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "node_modules/safe-regex-test": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.2.tgz", - "integrity": "sha512-83S9w6eFq12BBIJYvjMux6/dkirb8+4zJRA9cxNBVb7Wq5fJBW+Xze48WqR8pxua7bDuAaaAxtVVd4Idjp1dBQ==", + "node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.0", "dev": true, + "inBundle": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.5", - "get-intrinsic": "^1.2.2", - "is-regex": "^1.1.4" + "ansi-regex": "^6.0.1" }, "engines": { - "node": ">= 0.4" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/semantic-release": { - "version": "23.0.0", - "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-23.0.0.tgz", - "integrity": "sha512-Jz7jEWO2igTtske112gC4PPE2whCMVrsgxUPG3/SZI7VE357suIUZFlJd1Yu0g2I6RPc2HxNEfUg7KhmDTjwqg==", + "node_modules/npm/node_modules/write-file-atomic": { + "version": "5.0.1", "dev": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "@semantic-release/commit-analyzer": "^11.0.0", - "@semantic-release/error": "^4.0.0", - "@semantic-release/github": "^9.0.0", - "@semantic-release/npm": "^11.0.0", - "@semantic-release/release-notes-generator": "^12.0.0", - "aggregate-error": "^5.0.0", - "cosmiconfig": "^9.0.0", - "debug": "^4.0.0", - "env-ci": "^11.0.0", - "execa": "^8.0.0", - "figures": "^6.0.0", - "find-versions": "^5.1.0", - "get-stream": "^6.0.0", - "git-log-parser": "^1.2.0", - "hook-std": "^3.0.0", - "hosted-git-info": "^7.0.0", - "import-from-esm": "^1.3.1", - "lodash-es": "^4.17.21", - "marked": "^11.0.0", - "marked-terminal": "^6.0.0", - "micromatch": "^4.0.2", - "p-each-series": "^3.0.0", - "p-reduce": "^3.0.0", - "read-pkg-up": "^11.0.0", - "resolve-from": "^5.0.0", - "semver": "^7.3.2", - "semver-diff": "^4.0.0", - "signale": "^1.2.1", - "yargs": "^17.5.1" - }, - "bin": { - "semantic-release": "bin/semantic-release.js" + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" }, "engines": { - "node": ">=20.8.1" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/semantic-release/node_modules/@semantic-release/error": { + "node_modules/npm/node_modules/yallist": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-4.0.0.tgz", - "integrity": "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==", "dev": true, - "engines": { - "node": ">=18" - } + "inBundle": true, + "license": "ISC" }, - "node_modules/semantic-release/node_modules/aggregate-error": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-5.0.0.tgz", - "integrity": "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw==", + "node_modules/oas-kit-common": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/oas-kit-common/-/oas-kit-common-1.0.8.tgz", + "integrity": "sha512-pJTS2+T0oGIwgjGpw7sIRU8RQMcUoKCDWFLdBqKB2BNmGpbBMH2sdqAaOXUg8OzonZHU0L7vfJu1mJFEiYDWOQ==", "dev": true, "dependencies": { - "clean-stack": "^5.2.0", - "indent-string": "^5.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "fast-safe-stringify": "^2.0.7" } }, - "node_modules/semantic-release/node_modules/clean-stack": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-5.2.0.tgz", - "integrity": "sha512-TyUIUJgdFnCISzG5zu3291TAsE77ddchd0bepon1VVQrKLGKFED4iXFEDQ24mIPdPBbyE16PK3F8MYE1CmcBEQ==", + "node_modules/oas-linter": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/oas-linter/-/oas-linter-3.2.2.tgz", + "integrity": "sha512-KEGjPDVoU5K6swgo9hJVA/qYGlwfbFx+Kg2QB/kd7rzV5N8N5Mg6PlsoCMohVnQmo+pzJap/F610qTodKzecGQ==", "dev": true, "dependencies": { - "escape-string-regexp": "5.0.0" + "@exodus/schemasafe": "^1.0.0-rc.2", + "should": "^13.2.1", + "yaml": "^1.10.0" }, + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/oas-linter/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 6" } }, - "node_modules/semantic-release/node_modules/cosmiconfig": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", - "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", + "node_modules/oas-resolver": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/oas-resolver/-/oas-resolver-2.5.6.tgz", + "integrity": "sha512-Yx5PWQNZomfEhPPOphFbZKi9W93CocQj18NlD2Pa4GWZzdZpSJvYwoiuurRI7m3SpcChrnO08hkuQDL3FGsVFQ==", "dev": true, "dependencies": { - "env-paths": "^2.2.1", - "import-fresh": "^3.3.0", - "js-yaml": "^4.1.0", - "parse-json": "^5.2.0" + "node-fetch-h2": "^2.3.0", + "oas-kit-common": "^1.0.8", + "reftools": "^1.1.9", + "yaml": "^1.10.0", + "yargs": "^17.0.1" }, - "engines": { - "node": ">=14" + "bin": { + "resolve": "resolve.js" }, "funding": { - "url": "https://github.com/sponsors/d-fischer" - }, - "peerDependencies": { - "typescript": ">=4.9.5" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "url": "https://github.com/Mermade/oas-kit?sponsor=1" } }, - "node_modules/semantic-release/node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "node_modules/oas-resolver/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", "dev": true, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 6" } }, - "node_modules/semantic-release/node_modules/execa": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", - "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "node_modules/oas-schema-walker": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/oas-schema-walker/-/oas-schema-walker-1.1.5.tgz", + "integrity": "sha512-2yucenq1a9YPmeNExoUa9Qwrt9RFkjqaMAA1X+U7sbb0AqBeTIdMHky9SQQ6iN94bO5NW0W4TRYXerG+BdAvAQ==", "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^8.0.1", - "human-signals": "^5.0.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^4.1.0", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": ">=16.17" - }, "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" + "url": "https://github.com/Mermade/oas-kit?sponsor=1" } }, - "node_modules/semantic-release/node_modules/execa/node_modules/get-stream": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", - "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "node_modules/oas-validator": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/oas-validator/-/oas-validator-5.0.8.tgz", + "integrity": "sha512-cu20/HE5N5HKqVygs3dt94eYJfBi0TsZvPVXDhbXQHiEityDN+RROTleefoKRKKJ9dFAF2JBkDHgvWj0sjKGmw==", "dev": true, - "engines": { - "node": ">=16" + "dependencies": { + "call-me-maybe": "^1.0.1", + "oas-kit-common": "^1.0.8", + "oas-linter": "^3.2.2", + "oas-resolver": "^2.5.6", + "oas-schema-walker": "^1.1.5", + "reftools": "^1.1.9", + "should": "^13.2.1", + "yaml": "^1.10.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/Mermade/oas-kit?sponsor=1" } }, - "node_modules/semantic-release/node_modules/human-signals": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", - "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "node_modules/oas-validator/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", "dev": true, "engines": { - "node": ">=16.17.0" + "node": ">= 6" } }, - "node_modules/semantic-release/node_modules/indent-string": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", - "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "dev": true, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=0.10.0" } }, - "node_modules/semantic-release/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "node_modules/object-inspect": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/semantic-release/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 0.4" } }, - "node_modules/semantic-release/node_modules/npm-run-path": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", - "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "node_modules/object.assign": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", + "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", "dev": true, "dependencies": { - "path-key": "^4.0.0" + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/obliterator": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz", + "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/semantic-release/node_modules/onetime": { + "node_modules/onetime": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", @@ -12138,64 +8964,34 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/semantic-release/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semantic-release/node_modules/read-pkg": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-9.0.1.tgz", - "integrity": "sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==", + "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==", "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.3", - "normalize-package-data": "^6.0.0", - "parse-json": "^8.0.0", - "type-fest": "^4.6.0", - "unicorn-magic": "^0.1.0" - }, "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=14.16" } }, - "node_modules/semantic-release/node_modules/read-pkg-up": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-11.0.0.tgz", - "integrity": "sha512-LOVbvF1Q0SZdjClSefZ0Nz5z8u+tIE7mV5NibzmE9VYmDe9CaBbAVtz1veOSZbofrdsilxuDAYnFenukZVp8/Q==", - "deprecated": "Renamed to read-package-up", + "node_modules/p-each-series": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-3.0.0.tgz", + "integrity": "sha512-lastgtAdoH9YaLyDa5i5z64q+kzOcQHsQ5SsZJD3q0VEyI8mq872S3geuNbRUQLVAE9siMfgKrpj7MloKFHruw==", "dev": true, - "dependencies": { - "find-up-simple": "^1.0.0", - "read-pkg": "^9.0.0", - "type-fest": "^4.6.0" - }, "engines": { - "node": ">=18" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/semantic-release/node_modules/read-pkg/node_modules/parse-json": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.1.0.tgz", - "integrity": "sha512-rum1bPifK5SSar35Z6EKZuYPJx85pkNaFrxBK3mwdfSJ1/WKbYrjoW/zTPSjRRamfmVX1ACBIdFAO0VRErW/EA==", + "node_modules/p-filter": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-4.1.0.tgz", + "integrity": "sha512-37/tPdZ3oJwHaS3gNJdenCDB3Tz26i9sjhnguBtvN0vYlRIiDNnvTWkuh+0hETV9rLPdJ3rlL3yVOYPIAnM8rw==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.13", - "index-to-position": "^0.1.2", - "type-fest": "^4.7.1" + "p-map": "^7.0.1" }, "engines": { "node": ">=18" @@ -12204,76 +9000,61 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/semantic-release/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/semantic-release/node_modules/strip-final-newline": { + "node_modules/p-is-promise": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-3.0.0.tgz", + "integrity": "sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ==", "dev": true, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/semantic-release/node_modules/type-fest": { - "version": "4.10.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.10.2.tgz", - "integrity": "sha512-anpAG63wSpdEbLwOqH8L84urkL6PiVIov3EMmgIhhThevh9aiMQov+6Btx0wldNcvm4wV+e2/Rt1QdDwKHFbHw==", + "node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, "engines": { - "node": ">=16" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", "dev": true, "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" + "p-limit": "^4.0.0" }, "engines": { - "node": ">=10" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/semver-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-4.0.0.tgz", - "integrity": "sha512-0Ju4+6A8iOnpL/Thra7dZsSlOHYAHIeMxfhWQRI1/VLcT3WDBZKKtQt/QkBOsiIN9ZpuvHE6cGZ0x4glCMmfiA==", + "node_modules/p-map": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.2.tgz", + "integrity": "sha512-z4cYYMMdKHzw4O5UkWJImbZynVIo0lSGTXc7bzB1e/rrDqkgGUNysK/o4bTr+0+xKvvLoTyGqYC4Fgljy9qe1Q==", "dev": true, - "dependencies": { - "semver": "^7.3.5" - }, "engines": { - "node": ">=12" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/semver-regex": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-4.0.5.tgz", - "integrity": "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw==", + "node_modules/p-reduce": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-3.0.0.tgz", + "integrity": "sha512-xsrIUgI0Kn6iyDYm9StOpOeK29XM1aboGji26+QEortiFST1hGZaUQOLhtEbqHErPpGW/aSz6allwK2qcptp0Q==", "dev": true, "engines": { "node": ">=12" @@ -12282,617 +9063,704 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, "engines": { - "node": ">=10" + "node": ">=4" } }, - "node_modules/set-function-length": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", - "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", + "node_modules/pandemonium": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/pandemonium/-/pandemonium-2.4.1.tgz", + "integrity": "sha512-wRqjisUyiUfXowgm7MFH2rwJzKIr20rca5FsHXCMNm1W5YPP1hCtrZfgmQ62kP7OZ7Xt+cR858aB28lu5NX55g==", "dev": true, "dependencies": { - "define-data-property": "^1.1.1", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.2", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" + "mnemonist": "^0.39.2" } }, - "node_modules/set-function-name": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", - "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, "dependencies": { - "define-data-property": "^1.0.1", - "functions-have-names": "^1.2.3", - "has-property-descriptors": "^1.0.0" + "callsites": "^3.0.0" }, "engines": { - "node": ">= 0.4" + "node": ">=6" } }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, "dependencies": { - "shebang-regex": "^3.0.0" + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "node_modules/parse5": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", + "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", + "dev": true + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", + "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", + "dev": true, + "dependencies": { + "parse5": "^6.0.1" + } + }, + "node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", + "dev": true + }, + "node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", "dev": true, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/should": { - "version": "13.2.3", - "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz", - "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==", + "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, - "dependencies": { - "should-equal": "^2.0.0", - "should-format": "^3.0.3", - "should-type": "^1.4.0", - "should-type-adaptors": "^1.0.1", - "should-util": "^1.0.0" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/should-equal": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", - "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, - "dependencies": { - "should-type": "^1.4.0" + "engines": { + "node": ">=8" } }, - "node_modules/should-format": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", - "integrity": "sha512-hZ58adtulAk0gKtua7QxevgUaXTTXxIi8t41L3zo9AHvjXO1/7sdLECuHeIN2SRtYXpNkmhoUP2pdeWgricQ+Q==", + "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, - "dependencies": { - "should-type": "^1.3.0", - "should-type-adaptors": "^1.0.1" + "engines": { + "node": ">=8" } }, - "node_modules/should-type": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", - "integrity": "sha512-MdAsTu3n25yDbIe1NeN69G4n6mUnJGtSJHygX3+oN0ZbO3DTiATnf7XnYJdGT42JCXurTb1JI0qOBR65shvhPQ==", + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", "dev": true }, - "node_modules/should-type-adaptors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz", - "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==", + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true, - "dependencies": { - "should-type": "^1.3.0", - "should-util": "^1.0.0" + "engines": { + "node": "*" } }, - "node_modules/should-util": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.1.tgz", - "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==", + "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 }, - "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "engines": { + "node": ">=8.6" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/siginfo": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true - }, - "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/signale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/signale/-/signale-1.4.0.tgz", - "integrity": "sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w==", + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", "dev": true, - "dependencies": { - "chalk": "^2.3.2", - "figures": "^2.0.0", - "pkg-conf": "^2.1.0" + "bin": { + "pidtree": "bin/pidtree.js" }, "engines": { - "node": ">=6" + "node": ">=0.10" } }, - "node_modules/signale/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, "engines": { "node": ">=4" } }, - "node_modules/signale/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "node_modules/pkg-conf": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz", + "integrity": "sha512-C+VUP+8jis7EsQZIhDYmS5qlNtjv2yP4SNtjXK9AP1ZcTRlnSfuumaTnRfYZnYgUUYVIKqL0fRvmUGDV2fmp6g==", "dev": true, "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "find-up": "^2.0.0", + "load-json-file": "^4.0.0" }, "engines": { "node": ">=4" } }, - "node_modules/signale/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "node_modules/pkg-conf/node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", "dev": true, "dependencies": { - "color-name": "1.1.3" + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" } }, - "node_modules/signale/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "node_modules/pkg-conf/node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } }, - "node_modules/signale/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "node_modules/pkg-conf/node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, "engines": { - "node": ">=0.8.0" + "node": ">=4" } }, - "node_modules/signale/node_modules/figures": { + "node_modules/pkg-conf/node_modules/p-locate": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", "dev": true, "dependencies": { - "escape-string-regexp": "^1.0.5" + "p-limit": "^1.1.0" }, "engines": { "node": ">=4" } }, - "node_modules/signale/node_modules/has-flag": { + "node_modules/pkg-conf/node_modules/path-exists": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", "dev": true, "engines": { "node": ">=4" } }, - "node_modules/signale/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "node_modules/pkg-types": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.1.0.tgz", + "integrity": "sha512-/RpmvKdxKf8uILTtoOhAgf30wYbP2Qw+L9p3Rvshx1JZVX+XQNZQFjlbmGHEGIm4CkVPlSn+NXmIM8+9oWQaSA==", "dev": true, "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" + "confbox": "^0.1.7", + "mlly": "^1.6.1", + "pathe": "^1.1.2" } }, - "node_modules/skin-tone": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/skin-tone/-/skin-tone-2.0.0.tgz", - "integrity": "sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==", + "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", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", "dev": true, - "dependencies": { - "unicode-emoji-modifier-base": "^1.0.0" - }, "engines": { - "node": ">=8" + "node": ">= 0.4" } }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "node_modules/postcss": { + "version": "8.4.38", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", + "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.0", + "source-map-js": "^1.2.0" + }, "engines": { - "node": ">=8" + "node": "^10 || ^12 || >=14" } }, - "node_modules/slice-ansi": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", - "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "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": { - "ansi-styles": "^6.0.0", - "is-fullwidth-code-point": "^4.0.0" + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "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": ">=12" + "node": ">=10" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/sort-object-keys": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/sort-object-keys/-/sort-object-keys-1.1.3.tgz", - "integrity": "sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg==", + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, - "node_modules/sort-package-json": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/sort-package-json/-/sort-package-json-2.7.0.tgz", - "integrity": "sha512-6AayF8bp6L+WROgpbhTMUtB9JSFmpGHjmW7DyaNPS1HwlTw2oSVlUUtlkHSEZmg5o89F3zvLBZNvMeZ1T4fjQg==", + "node_modules/propagate": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz", + "integrity": "sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "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", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "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", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "dev": true, "dependencies": { - "detect-indent": "^7.0.1", - "detect-newline": "^4.0.0", - "get-stdin": "^9.0.0", - "git-hooks-list": "^3.0.0", - "globby": "^13.1.2", - "is-plain-obj": "^4.1.0", - "sort-object-keys": "^1.1.3" + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" }, "bin": { - "sort-package-json": "cli.js" + "rc": "cli.js" } }, - "node_modules/sort-package-json/node_modules/globby": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", - "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "node_modules/rc/node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "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", + "integrity": "sha512-MbgfoNPANMdb4oRBNg5eqLbB2t2r+o5Ua1pNt8BqGp4I0FJZhuVSOj3PaBPni4azWuSzEdNn2evevzVmEk1ohQ==", "dev": true, "dependencies": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.3.0", - "ignore": "^5.2.4", - "merge2": "^1.4.1", - "slash": "^4.0.0" + "find-up-simple": "^1.0.0", + "read-pkg": "^9.0.0", + "type-fest": "^4.6.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/sort-package-json/node_modules/slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "node_modules/read-package-up/node_modules/parse-json": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.1.0.tgz", + "integrity": "sha512-rum1bPifK5SSar35Z6EKZuYPJx85pkNaFrxBK3mwdfSJ1/WKbYrjoW/zTPSjRRamfmVX1ACBIdFAO0VRErW/EA==", "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "index-to-position": "^0.1.2", + "type-fest": "^4.7.1" + }, "engines": { - "node": ">=12" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "node_modules/read-package-up/node_modules/read-pkg": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-9.0.1.tgz", + "integrity": "sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==", "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.3", + "normalize-package-data": "^6.0.0", + "parse-json": "^8.0.0", + "type-fest": "^4.6.0", + "unicorn-magic": "^0.1.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/spawn-error-forwarder": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/spawn-error-forwarder/-/spawn-error-forwarder-1.0.0.tgz", - "integrity": "sha512-gRjMgK5uFjbCvdibeGJuy3I5OYz6VLoVdsOJdA6wV0WlfQVLFueoqMxwwYD9RODdgb6oUIvlRlsyFSiQkMKu0g==", - "dev": true - }, - "node_modules/spdx-correct": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", - "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "node_modules/read-pkg": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-8.1.0.tgz", + "integrity": "sha512-PORM8AgzXeskHO/WEv312k9U03B8K9JSiWF/8N9sUuFjBa+9SF2u6K7VClzXwDXab51jCd8Nd36CNM+zR97ScQ==", "dev": true, "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" + "@types/normalize-package-data": "^2.4.1", + "normalize-package-data": "^6.0.0", + "parse-json": "^7.0.0", + "type-fest": "^4.2.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/spdx-exceptions": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.4.0.tgz", - "integrity": "sha512-hcjppoJ68fhxA/cjbN4T8N6uCUejN8yFw69ttpqtBeCbF3u13n7mb31NB9jKwGTTWWnt9IbRA/mf1FprYS8wfw==", - "dev": true - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "node_modules/read-pkg-up": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-10.1.0.tgz", + "integrity": "sha512-aNtBq4jR8NawpKJQldrQcSW9y/d+KWH4v24HWkHljOZ7H0av+YTGANBzRh9A5pw7v/bLVsLVPpOhJ7gHNVy8lA==", "dev": true, "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.16", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.16.tgz", - "integrity": "sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==", - "dev": true - }, - "node_modules/split2": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", - "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "find-up": "^6.3.0", + "read-pkg": "^8.1.0", + "type-fest": "^4.2.0" + }, "engines": { - "node": ">= 10.x" + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true - }, - "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 - }, - "node_modules/stream-combiner2": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", - "integrity": "sha512-3PnJbYgS56AeWgtKF5jtJRT6uFJe56Z0Hc5Ngg/6sI6rIt8iiMBTa9cvdyFfpMQjaVHr8dusbNeFGIIonxOvKw==", + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", "dev": true, "dependencies": { - "duplexer2": "~0.1.0", - "readable-stream": "^2.0.2" + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "node_modules/read-pkg/node_modules/json-parse-even-better-errors": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.1.tgz", + "integrity": "sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg==", "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/string-argv": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", - "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "node_modules/read-pkg/node_modules/lines-and-columns": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.4.tgz", + "integrity": "sha512-wM1+Z03eypVAVUCE7QdSqpVIvelbOakn1M0bPDoA4SGWPx3sNDVUiMo3L6To6WWGClB7VyXnhQ4Sn7gxiJbE6A==", "dev": true, "engines": { - "node": ">=0.6.19" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/string-width": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.1.0.tgz", - "integrity": "sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw==", + "node_modules/read-pkg/node_modules/parse-json": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-7.1.1.tgz", + "integrity": "sha512-SgOTCX/EZXtZxBE5eJ97P4yGM5n37BwRU+YMsH4vNzFqJV/oWFXXCmwFlgWUM4PrakybVOueJJ6pwHqSVhTFDw==", "dev": true, "dependencies": { - "emoji-regex": "^10.3.0", - "get-east-asian-width": "^1.0.0", - "strip-ansi": "^7.1.0" + "@babel/code-frame": "^7.21.4", + "error-ex": "^1.3.2", + "json-parse-even-better-errors": "^3.0.0", + "lines-and-columns": "^2.0.3", + "type-fest": "^3.8.0" }, "engines": { - "node": ">=18" + "node": ">=16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "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==", + "node_modules/read-pkg/node_modules/parse-json/node_modules/type-fest": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", + "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", "dev": true, "engines": { - "node": ">=12" + "node": ">=14.16" }, "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/string-width/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==", + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/reftools": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/reftools/-/reftools-1.1.9.tgz", + "integrity": "sha512-OVede/NQE13xBQ+ob5CKd5KyeJYU2YInb1bmV4nRoOfquZPkAkxuOXicSe1PvqIuZZ4kD13sPKBbR7UFDmli6w==", + "dev": true, "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" + "url": "https://github.com/Mermade/oas-kit?sponsor=1" } }, - "node_modules/string.prototype.trim": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", - "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "node_modules/regex-to-strings": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/regex-to-strings/-/regex-to-strings-2.1.0.tgz", + "integrity": "sha512-IB2KMpdYwEv58X5qWTiLqKS0RijvwcVhhpcuepu/jni2Ti4hVCH27M+/Qo0r+TpwwD698rh2gaEP3UUa/Hi1ZA==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "escape-string-regexp": "^4.0.0", + "pandemonium": "^2.0.0", + "regexp-tree": "^0.1.23" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=12" } }, - "node_modules/string.prototype.trimend": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", - "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "node_modules/regex-to-strings/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "engines": { + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", - "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "node_modules/regexp-tree": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.27.tgz", + "integrity": "sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==", + "dev": true, + "bin": { + "regexp-tree": "bin/regexp-tree" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", + "integrity": "sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.6", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "set-function-name": "^2.0.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "node_modules/registry-auth-token": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.0.2.tgz", + "integrity": "sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ==", "dev": true, "dependencies": { - "ansi-regex": "^5.0.1" + "@pnpm/npm-conf": "^2.1.0" }, "engines": { - "node": ">=8" + "node": ">=14" } }, - "node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, "engines": { - "node": ">=4" + "node": ">=0.10.0" } }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "engines": { - "node": ">=6" + "node": ">=0.10.0" } }, - "node_modules/strip-indent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", - "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "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", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true, - "dependencies": { - "min-indent": "^1.0.0" - }, "engines": { "node": ">=8" } }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", "dev": true, - "engines": { - "node": ">=8" - }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, - "node_modules/strip-literal": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", - "integrity": "sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==", + "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": { - "acorn": "^8.10.0" + "lowercase-keys": "^3.0.0" + }, + "engines": { + "node": ">=14.16" }, "funding": { - "url": "https://github.com/sponsors/antfu" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/subsume": { + "node_modules/restore-cursor": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/subsume/-/subsume-4.0.0.tgz", - "integrity": "sha512-BWnYJElmHbYZ/zKevy+TG+SsyoFCmRPDHJbR1MzLxkPOv1Jp/4hGhVUtP98s+wZBsBsHwCXvPTP0x287/WMjGg==", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", "dev": true, "dependencies": { - "escape-string-regexp": "^5.0.0", - "unique-string": "^3.0.0" + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" }, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" @@ -12901,48 +9769,150 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/subsume/node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "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": ">=12" + "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==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "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", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rfdc": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.1.tgz", + "integrity": "sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==", + "dev": true + }, + "node_modules/rollup": { + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.14.3.tgz", + "integrity": "sha512-ag5tTQKYsj1bhrFC9+OEWqb5O6VYgtQDO9hPDBMmIbePwhfSr+ExlcU741t8Dhw5DkPCQf6noz0jb36D6W9/hw==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=8" + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.14.3", + "@rollup/rollup-android-arm64": "4.14.3", + "@rollup/rollup-darwin-arm64": "4.14.3", + "@rollup/rollup-darwin-x64": "4.14.3", + "@rollup/rollup-linux-arm-gnueabihf": "4.14.3", + "@rollup/rollup-linux-arm-musleabihf": "4.14.3", + "@rollup/rollup-linux-arm64-gnu": "4.14.3", + "@rollup/rollup-linux-arm64-musl": "4.14.3", + "@rollup/rollup-linux-powerpc64le-gnu": "4.14.3", + "@rollup/rollup-linux-riscv64-gnu": "4.14.3", + "@rollup/rollup-linux-s390x-gnu": "4.14.3", + "@rollup/rollup-linux-x64-gnu": "4.14.3", + "@rollup/rollup-linux-x64-musl": "4.14.3", + "@rollup/rollup-win32-arm64-msvc": "4.14.3", + "@rollup/rollup-win32-ia32-msvc": "4.14.3", + "@rollup/rollup-win32-x64-msvc": "4.14.3", + "fsevents": "~2.3.2" } }, - "node_modules/supports-hyperlinks": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.0.0.tgz", - "integrity": "sha512-QBDPHyPQDRTy9ku4URNGY5Lah8PAaXs6tAAwp55sL5WCsSW7GIfdf6W5ixfziW+t7wh3GVvHyHHyQ1ESsoRvaA==", + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], "dependencies": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", + "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" }, "engines": { - "node": ">=14.18" + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "node_modules/safe-array-concat/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/safe-regex-test": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", + "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-regex": "^1.1.4" + }, "engines": { "node": ">= 0.4" }, @@ -12950,86 +9920,81 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/swagger2openapi": { - "version": "7.0.8", - "resolved": "https://registry.npmjs.org/swagger2openapi/-/swagger2openapi-7.0.8.tgz", - "integrity": "sha512-upi/0ZGkYgEcLeGieoz8gT74oWHA0E7JivX7aN9mAf+Tc7BQoRBvnIGHoPDw+f9TXTW4s6kGYCZJtauP6OYp7g==", + "node_modules/semantic-release": { + "version": "23.0.8", + "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-23.0.8.tgz", + "integrity": "sha512-yZkuWcTTfh5h/DrR4Q4QvJSARJdb6wjwn/sN0qKMYEkvwaVFek8YWfrgtL8oWaRdl0fLte0Y1wWMzLbwoaII1g==", "dev": true, "dependencies": { - "call-me-maybe": "^1.0.1", - "node-fetch": "^2.6.1", - "node-fetch-h2": "^2.3.0", - "node-readfiles": "^0.2.0", - "oas-kit-common": "^1.0.8", - "oas-resolver": "^2.5.6", - "oas-schema-walker": "^1.1.5", - "oas-validator": "^5.0.8", - "reftools": "^1.1.9", - "yaml": "^1.10.0", - "yargs": "^17.0.1" + "@semantic-release/commit-analyzer": "^12.0.0", + "@semantic-release/error": "^4.0.0", + "@semantic-release/github": "^10.0.0", + "@semantic-release/npm": "^12.0.0", + "@semantic-release/release-notes-generator": "^13.0.0", + "aggregate-error": "^5.0.0", + "cosmiconfig": "^9.0.0", + "debug": "^4.0.0", + "env-ci": "^11.0.0", + "execa": "^8.0.0", + "figures": "^6.0.0", + "find-versions": "^6.0.0", + "get-stream": "^6.0.0", + "git-log-parser": "^1.2.0", + "hook-std": "^3.0.0", + "hosted-git-info": "^7.0.0", + "import-from-esm": "^1.3.1", + "lodash-es": "^4.17.21", + "marked": "^12.0.0", + "marked-terminal": "^7.0.0", + "micromatch": "^4.0.2", + "p-each-series": "^3.0.0", + "p-reduce": "^3.0.0", + "read-package-up": "^11.0.0", + "resolve-from": "^5.0.0", + "semver": "^7.3.2", + "semver-diff": "^4.0.0", + "signale": "^1.2.1", + "yargs": "^17.5.1" }, "bin": { - "boast": "boast.js", - "oas-validate": "oas-validate.js", - "swagger2openapi": "swagger2openapi.js" + "semantic-release": "bin/semantic-release.js" }, - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" + "engines": { + "node": ">=20.8.1" } }, - "node_modules/swagger2openapi/node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "node_modules/semantic-release/node_modules/@semantic-release/error": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-4.0.0.tgz", + "integrity": "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==", "dev": true, "engines": { - "node": ">= 6" + "node": ">=18" } }, - "node_modules/synckit": { - "version": "0.8.8", - "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.8.tgz", - "integrity": "sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==", + "node_modules/semantic-release/node_modules/aggregate-error": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-5.0.0.tgz", + "integrity": "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw==", "dev": true, "dependencies": { - "@pkgr/core": "^0.1.0", - "tslib": "^2.6.2" + "clean-stack": "^5.2.0", + "indent-string": "^5.0.0" }, "engines": { - "node": "^14.18.0 || >=16.0.0" + "node": ">=18" }, "funding": { - "url": "https://opencollective.com/unts" - } - }, - "node_modules/tapable": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", - "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/temp-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", - "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", - "dev": true, - "engines": { - "node": ">=14.16" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/tempy": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/tempy/-/tempy-3.1.0.tgz", - "integrity": "sha512-7jDLIdD2Zp0bDe5r3D2qtkd1QOCacylBuL7oa4udvN6v2pqr4+LcCr67C8DR1zkpaZ8XosF5m1yQSabKAW6f2g==", + "node_modules/semantic-release/node_modules/clean-stack": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-5.2.0.tgz", + "integrity": "sha512-TyUIUJgdFnCISzG5zu3291TAsE77ddchd0bepon1VVQrKLGKFED4iXFEDQ24mIPdPBbyE16PK3F8MYE1CmcBEQ==", "dev": true, "dependencies": { - "is-stream": "^3.0.0", - "temp-dir": "^3.0.0", - "type-fest": "^2.12.2", - "unique-string": "^3.0.0" + "escape-string-regexp": "5.0.0" }, "engines": { "node": ">=14.16" @@ -13038,1436 +10003,1301 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/tempy/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "node_modules/semantic-release/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/tempy/node_modules/type-fest": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", - "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "node_modules/semantic-release/node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", "dev": true, "engines": { - "node": ">=12.20" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "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==", + "node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" }, "engines": { - "node": ">=8" - } - }, - "node_modules/test-exclude/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==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "node": ">=10" } }, - "node_modules/test-exclude/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/semver-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-4.0.0.tgz", + "integrity": "sha512-0Ju4+6A8iOnpL/Thra7dZsSlOHYAHIeMxfhWQRI1/VLcT3WDBZKKtQt/QkBOsiIN9ZpuvHE6cGZ0x4glCMmfiA==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "semver": "^7.3.5" }, "engines": { - "node": "*" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/text-extensions": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz", - "integrity": "sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==", + "node_modules/semver-regex": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-4.0.5.tgz", + "integrity": "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw==", "dev": true, "engines": { - "node": ">=8" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true - }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true - }, - "node_modules/through2": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", - "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, "dependencies": { - "readable-stream": "3" + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" } }, - "node_modules/through2/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", "dev": true, "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" }, "engines": { - "node": ">= 6" + "node": ">= 0.4" } }, - "node_modules/tinybench": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.6.0.tgz", - "integrity": "sha512-N8hW3PG/3aOoZAN5V/NSAEDz0ZixDSSt5b/a05iqtpgfLWMSVuCo7w0k2vVvEjdrIoeGqZzweX2WlyioNIHchA==", - "dev": true - }, - "node_modules/tinypool": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.2.tgz", - "integrity": "sha512-SUszKYe5wgsxnNOVlBYO6IC+8VGWdVGZWAqUxp3UErNBtptZvWbwyUOyzNL59zigz2rCA92QiL3wvG+JDSdJdQ==", + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, "engines": { - "node": ">=14.0.0" + "node": ">= 0.4" } }, - "node_modules/tinyspy": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.0.tgz", - "integrity": "sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==", + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, "engines": { - "node": ">=14.0.0" + "node": ">=8" } }, - "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/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, "engines": { - "node": ">=4" + "node": ">=8" } }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "node_modules/should": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz", + "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==", "dev": true, "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" + "should-equal": "^2.0.0", + "should-format": "^3.0.3", + "should-type": "^1.4.0", + "should-type-adaptors": "^1.0.1", + "should-util": "^1.0.0" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true - }, - "node_modules/traverse": { - "version": "0.6.8", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.8.tgz", - "integrity": "sha512-aXJDbk6SnumuaZSANd21XAo15ucCDE38H4fkqiGsc3MhCK+wOlZvLP9cB/TvpHT0mOyWgC4Z8EwRlzqYSUzdsA==", + "node_modules/should-equal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", + "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "dependencies": { + "should-type": "^1.4.0" } }, - "node_modules/trim-newlines": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", - "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", + "node_modules/should-format": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "integrity": "sha512-hZ58adtulAk0gKtua7QxevgUaXTTXxIi8t41L3zo9AHvjXO1/7sdLECuHeIN2SRtYXpNkmhoUP2pdeWgricQ+Q==", "dev": true, - "engines": { - "node": ">=8" + "dependencies": { + "should-type": "^1.3.0", + "should-type-adaptors": "^1.0.1" } }, - "node_modules/ts-api-utils": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.2.0.tgz", - "integrity": "sha512-d+3WxW4r8WQy2cZWpNRPPGExX8ffOLGcIhheUANKbL5Sqjbhkneki76fRAWeXkaslV2etTb4tSJBSxOsH5+CJw==", - "dev": true, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "typescript": ">=4.2.0" - } + "node_modules/should-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "integrity": "sha512-MdAsTu3n25yDbIe1NeN69G4n6mUnJGtSJHygX3+oN0ZbO3DTiATnf7XnYJdGT42JCXurTb1JI0qOBR65shvhPQ==", + "dev": true }, - "node_modules/tsconfig-paths": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", - "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "node_modules/should-type-adaptors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz", + "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==", "dev": true, "dependencies": { - "@types/json5": "^0.0.29", - "json5": "^1.0.2", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" + "should-type": "^1.3.0", + "should-util": "^1.0.0" } }, - "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + "node_modules/should-util": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.1.tgz", + "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==", + "dev": true }, - "node_modules/tsx": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.7.0.tgz", - "integrity": "sha512-I+t79RYPlEYlHn9a+KzwrvEwhJg35h/1zHsLC2JXvhC2mdynMv6Zxzvhv5EMV6VF5qJlLlkSnMVvdZV3PSIGcg==", + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dev": true, "dependencies": { - "esbuild": "~0.19.10", - "get-tsconfig": "^4.7.2" - }, - "bin": { - "tsx": "dist/cli.mjs" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" }, "engines": { - "node": ">=18.0.0" + "node": ">= 0.4" }, - "optionalDependencies": { - "fsevents": "~2.3.3" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", - "integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", - "cpu": [ - "ppc64" - ], + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, - "optional": true, - "os": [ - "aix" - ], "engines": { - "node": ">=12" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/tsx/node_modules/@esbuild/android-arm": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", - "integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", - "cpu": [ - "arm" - ], + "node_modules/signale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/signale/-/signale-1.4.0.tgz", + "integrity": "sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w==", "dev": true, - "optional": true, - "os": [ - "android" - ], + "dependencies": { + "chalk": "^2.3.2", + "figures": "^2.0.0", + "pkg-conf": "^2.1.0" + }, "engines": { - "node": ">=12" + "node": ">=6" } }, - "node_modules/tsx/node_modules/@esbuild/android-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", - "integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", - "cpu": [ - "arm64" - ], + "node_modules/signale/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, - "optional": true, - "os": [ - "android" - ], + "dependencies": { + "color-convert": "^1.9.0" + }, "engines": { - "node": ">=12" + "node": ">=4" } }, - "node_modules/tsx/node_modules/@esbuild/android-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", - "integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", - "cpu": [ - "x64" - ], + "node_modules/signale/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, - "optional": true, - "os": [ - "android" - ], + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, "engines": { - "node": ">=12" + "node": ">=4" } }, - "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", - "integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", - "cpu": [ - "arm64" - ], + "node_modules/signale/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], "engines": { - "node": ">=12" + "node": ">=0.8.0" } }, - "node_modules/tsx/node_modules/@esbuild/darwin-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", - "integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", - "cpu": [ - "x64" - ], + "node_modules/signale/node_modules/figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, "engines": { - "node": ">=12" + "node": ">=4" } }, - "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", - "integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", - "cpu": [ - "arm64" - ], + "node_modules/signale/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], "engines": { - "node": ">=12" + "node": ">=4" } }, - "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", - "integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", - "cpu": [ - "x64" - ], + "node_modules/signale/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "dependencies": { + "has-flag": "^3.0.0" + }, "engines": { - "node": ">=12" + "node": ">=4" } }, - "node_modules/tsx/node_modules/@esbuild/linux-arm": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", - "integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", - "cpu": [ - "arm" - ], + "node_modules/skin-tone": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/skin-tone/-/skin-tone-2.0.0.tgz", + "integrity": "sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "dependencies": { + "unicode-emoji-modifier-base": "^1.0.0" + }, "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/tsx/node_modules/@esbuild/linux-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", - "integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", - "cpu": [ - "arm64" - ], + "node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { - "node": ">=12" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/tsx/node_modules/@esbuild/linux-ia32": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", - "integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", - "cpu": [ - "ia32" - ], + "node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, "engines": { "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/tsx/node_modules/@esbuild/linux-loong64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", - "integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", - "cpu": [ - "loong64" - ], + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { - "node": ">=12" + "node": ">=0.10.0" } }, - "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", - "integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", - "cpu": [ - "mips64el" - ], + "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==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { - "node": ">=12" + "node": ">=0.10.0" } }, - "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", - "integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", - "cpu": [ - "ppc64" - ], + "node_modules/spawn-error-forwarder": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/spawn-error-forwarder/-/spawn-error-forwarder-1.0.0.tgz", + "integrity": "sha512-gRjMgK5uFjbCvdibeGJuy3I5OYz6VLoVdsOJdA6wV0WlfQVLFueoqMxwwYD9RODdgb6oUIvlRlsyFSiQkMKu0g==", + "dev": true + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" } }, - "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", - "integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", - "cpu": [ - "riscv64" - ], + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.17.tgz", + "integrity": "sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==", + "dev": true + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", "engines": { - "node": ">=12" + "node": ">= 10.x" } }, - "node_modules/tsx/node_modules/@esbuild/linux-s390x": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", - "integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", - "cpu": [ - "s390x" - ], + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true + }, + "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 + }, + "node_modules/stream-combiner2": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", + "integrity": "sha512-3PnJbYgS56AeWgtKF5jtJRT6uFJe56Z0Hc5Ngg/6sI6rIt8iiMBTa9cvdyFfpMQjaVHr8dusbNeFGIIonxOvKw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "dependencies": { + "duplexer2": "~0.1.0", + "readable-stream": "^2.0.2" } }, - "node_modules/tsx/node_modules/@esbuild/linux-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", - "integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", - "cpu": [ - "x64" - ], + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { - "node": ">=12" + "node": ">=0.6.19" } }, - "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", - "integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", - "cpu": [ - "x64" - ], + "node_modules/string-width": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.1.0.tgz", + "integrity": "sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw==", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, "engines": { - "node": ">=12" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", - "integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", - "cpu": [ - "x64" - ], + "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==", "dev": true, - "optional": true, - "os": [ - "openbsd" - ], "engines": { "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, - "node_modules/tsx/node_modules/@esbuild/sunos-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", - "integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", - "cpu": [ - "x64" - ], + "node_modules/string-width/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, - "optional": true, - "os": [ - "sunos" - ], + "dependencies": { + "ansi-regex": "^6.0.1" + }, "engines": { "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/tsx/node_modules/@esbuild/win32-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", - "integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", - "cpu": [ - "arm64" - ], + "node_modules/string.prototype.trim": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", + "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-object-atoms": "^1.0.0" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tsx/node_modules/@esbuild/win32-ia32": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", - "integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", - "cpu": [ - "ia32" - ], + "node_modules/string.prototype.trimend": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", + "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tsx/node_modules/@esbuild/win32-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", - "integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", - "cpu": [ - "x64" - ], + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tsx/node_modules/esbuild": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", - "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", + "node_modules/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, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" + "dependencies": { + "ansi-regex": "^5.0.1" }, "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.19.12", - "@esbuild/android-arm": "0.19.12", - "@esbuild/android-arm64": "0.19.12", - "@esbuild/android-x64": "0.19.12", - "@esbuild/darwin-arm64": "0.19.12", - "@esbuild/darwin-x64": "0.19.12", - "@esbuild/freebsd-arm64": "0.19.12", - "@esbuild/freebsd-x64": "0.19.12", - "@esbuild/linux-arm": "0.19.12", - "@esbuild/linux-arm64": "0.19.12", - "@esbuild/linux-ia32": "0.19.12", - "@esbuild/linux-loong64": "0.19.12", - "@esbuild/linux-mips64el": "0.19.12", - "@esbuild/linux-ppc64": "0.19.12", - "@esbuild/linux-riscv64": "0.19.12", - "@esbuild/linux-s390x": "0.19.12", - "@esbuild/linux-x64": "0.19.12", - "@esbuild/netbsd-x64": "0.19.12", - "@esbuild/openbsd-x64": "0.19.12", - "@esbuild/sunos-x64": "0.19.12", - "@esbuild/win32-arm64": "0.19.12", - "@esbuild/win32-ia32": "0.19.12", - "@esbuild/win32-x64": "0.19.12" - } - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" + "node": ">=8" } }, - "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==", + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true, "engines": { "node": ">=4" } }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", "dev": true, "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/typed-array-buffer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", - "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true, + "engines": { + "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": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1", - "is-typed-array": "^1.1.10" + "js-tokens": "^9.0.0" }, - "engines": { - "node": ">= 0.4" + "funding": { + "url": "https://github.com/sponsors/antfu" } }, - "node_modules/typed-array-byte-length": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", - "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "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", + "integrity": "sha512-BWnYJElmHbYZ/zKevy+TG+SsyoFCmRPDHJbR1MzLxkPOv1Jp/4hGhVUtP98s+wZBsBsHwCXvPTP0x287/WMjGg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "has-proto": "^1.0.1", - "is-typed-array": "^1.1.10" + "escape-string-regexp": "^5.0.0", + "unique-string": "^3.0.0" }, "engines": { - "node": ">= 0.4" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/typed-array-byte-offset": { + "node_modules/super-regex": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", - "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "resolved": "https://registry.npmjs.org/super-regex/-/super-regex-1.0.0.tgz", + "integrity": "sha512-CY8u7DtbvucKuquCmOFEKhr9Besln7n9uN8eFbwcoGYWXOMW07u2o8njWaiXt11ylS3qoGF55pILjRmPlbodyg==", "dev": true, "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "has-proto": "^1.0.1", - "is-typed-array": "^1.1.10" + "function-timeout": "^1.0.1", + "time-span": "^5.1.0" }, "engines": { - "node": ">= 0.4" + "node": ">=18" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/typed-array-length": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", - "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "is-typed-array": "^1.1.9" + "has-flag": "^4.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">=8" } }, - "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "node_modules/supports-hyperlinks": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.0.0.tgz", + "integrity": "sha512-QBDPHyPQDRTy9ku4URNGY5Lah8PAaXs6tAAwp55sL5WCsSW7GIfdf6W5ixfziW+t7wh3GVvHyHHyQ1ESsoRvaA==", "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" + "dependencies": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" }, "engines": { - "node": ">=14.17" + "node": ">=14.18" } }, - "node_modules/ufo": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.2.tgz", - "integrity": "sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==", - "dev": true - }, - "node_modules/uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "node_modules/swagger2openapi": { + "version": "7.0.8", + "resolved": "https://registry.npmjs.org/swagger2openapi/-/swagger2openapi-7.0.8.tgz", + "integrity": "sha512-upi/0ZGkYgEcLeGieoz8gT74oWHA0E7JivX7aN9mAf+Tc7BQoRBvnIGHoPDw+f9TXTW4s6kGYCZJtauP6OYp7g==", "dev": true, - "optional": true, + "dependencies": { + "call-me-maybe": "^1.0.1", + "node-fetch": "^2.6.1", + "node-fetch-h2": "^2.3.0", + "node-readfiles": "^0.2.0", + "oas-kit-common": "^1.0.8", + "oas-resolver": "^2.5.6", + "oas-schema-walker": "^1.1.5", + "oas-validator": "^5.0.8", + "reftools": "^1.1.9", + "yaml": "^1.10.0", + "yargs": "^17.0.1" + }, "bin": { - "uglifyjs": "bin/uglifyjs" + "boast": "boast.js", + "oas-validate": "oas-validate.js", + "swagger2openapi": "swagger2openapi.js" }, + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/swagger2openapi/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, "engines": { - "node": ">=0.8.0" + "node": ">= 6" } }, - "node_modules/unbox-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", - "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "node_modules/temp-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", + "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", + "dev": true, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/tempy": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/tempy/-/tempy-3.1.0.tgz", + "integrity": "sha512-7jDLIdD2Zp0bDe5r3D2qtkd1QOCacylBuL7oa4udvN6v2pqr4+LcCr67C8DR1zkpaZ8XosF5m1yQSabKAW6f2g==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "has-bigints": "^1.0.2", - "has-symbols": "^1.0.3", - "which-boxed-primitive": "^1.0.2" + "is-stream": "^3.0.0", + "temp-dir": "^3.0.0", + "type-fest": "^2.12.2", + "unique-string": "^3.0.0" + }, + "engines": { + "node": ">=14.16" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "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 + "node_modules/tempy/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/unicode-emoji-modifier-base": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz", - "integrity": "sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==", + "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==", "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, "engines": { - "node": ">=4" + "node": ">=8" } }, - "node_modules/unicorn-magic": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", - "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", + "node_modules/text-extensions": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz", + "integrity": "sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==", "dev": true, "engines": { - "node": ">=18" + "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/unique-string": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-3.0.0.tgz", - "integrity": "sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ==", + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", "dev": true, "dependencies": { - "crypto-random-string": "^4.0.0" + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "dependencies": { + "thenify": ">= 3.1.0 < 4" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=0.8" } }, - "node_modules/universal-user-agent": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", - "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, - "node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", "dev": true, - "engines": { - "node": ">= 10.0.0" + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" } }, - "node_modules/update-browserslist-db": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", - "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "node_modules/time-span": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/time-span/-/time-span-5.1.0.tgz", + "integrity": "sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA==", "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "convert-hrtime": "^5.0.0" }, - "bin": { - "update-browserslist-db": "cli.js" + "engines": { + "node": ">=12" }, - "peerDependencies": { - "browserslist": ">= 4.21.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "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/tinybench": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.7.0.tgz", + "integrity": "sha512-Qgayeb106x2o4hNzNjsZEfFziw8IbKqtbXBjVh7VIZfBxfD5M4gWtpyx5+YTae2gJ6Y6Dz/KLepiv16RFeQWNA==", + "dev": true }, - "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==", + "node_modules/tinypool": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.4.tgz", + "integrity": "sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==", "dev": true, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=14.0.0" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true - }, - "node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "node_modules/tinyspy": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", + "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", "dev": true, - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "bin": { - "uuid": "dist/bin/uuid" + "engines": { + "node": ">=14.0.0" } }, - "node_modules/v8-to-istanbul": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", - "integrity": "sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==", + "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==", "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^2.0.0" - }, "engines": { - "node": ">=10.12.0" + "node": ">=4" } }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" } }, - "node_modules/variable-diff": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/variable-diff/-/variable-diff-2.0.2.tgz", - "integrity": "sha512-PqE1fUTrENftNWiNlfVqwFODxu9Zcl+AGOC9zdw+9N2KYW5kwtK0oXtJotwycAs1YwWttUcM739eM0x7CrkOyQ==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0" - } + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true }, - "node_modules/vite": { - "version": "5.0.12", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz", - "integrity": "sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==", + "node_modules/traverse": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.9.tgz", + "integrity": "sha512-7bBrcF+/LQzSgFmT0X5YclVqQxtv7TDJ1f8Wj7ibBu/U6BMLeOpUxuZjV7rMc44UtKxlnMFigdhFAIszSX1DMg==", "dev": true, "dependencies": { - "esbuild": "^0.19.3", - "postcss": "^8.4.32", - "rollup": "^4.2.0" - }, - "bin": { - "vite": "bin/vite.js" + "gopd": "^1.0.1", + "typedarray.prototype.slice": "^1.0.3", + "which-typed-array": "^1.1.15" }, "engines": { - "node": "^18.0.0 || >=20.0.0" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^18.0.0 || >=20.0.0", - "less": "*", - "lightningcss": "^1.21.0", - "sass": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.4.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - } + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/vite-node": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.2.2.tgz", - "integrity": "sha512-1as4rDTgVWJO3n1uHmUYqq7nsFgINQ9u+mRcXpjeOMJUmviqNKjcZB7UfRZrlM7MjYXMKpuWp5oGkjaFLnjawg==", + "node_modules/tsx": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.11.0.tgz", + "integrity": "sha512-vzGGELOgAupsNVssAmZjbUDfdm/pWP4R+Kg8TVdsonxbXk0bEpE1qh0yV6/QxUVXaVlNemgcPajGdJJ82n3stg==", "dev": true, "dependencies": { - "cac": "^6.7.14", - "debug": "^4.3.4", - "pathe": "^1.1.1", - "picocolors": "^1.0.0", - "vite": "^5.0.0" + "esbuild": "~0.20.2", + "get-tsconfig": "^4.7.5" }, "bin": { - "vite-node": "vite-node.mjs" + "tsx": "dist/cli.mjs" }, "engines": { - "node": "^18.0.0 || >=20.0.0" + "node": ">=18.0.0" }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/vite/node_modules/@esbuild/aix-ppc64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", - "integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=12" + "optionalDependencies": { + "fsevents": "~2.3.3" } }, - "node_modules/vite/node_modules/@esbuild/android-arm": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", - "integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", - "cpu": [ - "arm" - ], + "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, - "optional": true, - "os": [ - "android" - ], "engines": { - "node": ">=12" + "node": ">=4" } }, - "node_modules/vite/node_modules/@esbuild/android-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", - "integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", - "cpu": [ - "arm64" - ], + "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==", "dev": true, - "optional": true, - "os": [ - "android" - ], "engines": { - "node": ">=12" + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/vite/node_modules/@esbuild/android-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", - "integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", - "cpu": [ - "x64" - ], + "node_modules/typed-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", + "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", "dev": true, - "optional": true, - "os": [ - "android" - ], + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.13" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" } }, - "node_modules/vite/node_modules/@esbuild/darwin-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", - "integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", - "cpu": [ - "arm64" - ], + "node_modules/typed-array-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", + "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/vite/node_modules/@esbuild/darwin-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", - "integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", - "cpu": [ - "x64" - ], + "node_modules/typed-array-byte-offset": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", + "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", - "integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", - "cpu": [ - "arm64" - ], + "node_modules/typed-array-length": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", + "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/vite/node_modules/@esbuild/freebsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", - "integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", - "cpu": [ - "x64" - ], + "node_modules/typedarray.prototype.slice": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typedarray.prototype.slice/-/typedarray.prototype.slice-1.0.3.tgz", + "integrity": "sha512-8WbVAQAUlENo1q3c3zZYuy5k9VzBQvp8AX9WOtbvyWlLM1v5JaSRmjubLjzHF4JFtptjH/5c/i95yaElvcjC0A==", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-errors": "^1.3.0", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-offset": "^1.0.2" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/vite/node_modules/@esbuild/linux-arm": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", - "integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", - "cpu": [ - "arm" - ], + "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==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, "engines": { - "node": ">=12" + "node": ">=14.17" } }, - "node_modules/vite/node_modules/@esbuild/linux-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", - "integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", - "cpu": [ - "arm64" - ], + "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", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", "dev": true, "optional": true, - "os": [ - "linux" - ], + "bin": { + "uglifyjs": "bin/uglifyjs" + }, "engines": { - "node": ">=12" + "node": ">=0.8.0" } }, - "node_modules/vite/node_modules/@esbuild/linux-ia32": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", - "integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", - "cpu": [ - "ia32" - ], + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/vite/node_modules/@esbuild/linux-loong64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", - "integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", - "cpu": [ - "loong64" - ], + "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 + }, + "node_modules/unicode-emoji-modifier-base": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz", + "integrity": "sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { - "node": ">=12" + "node": ">=4" } }, - "node_modules/vite/node_modules/@esbuild/linux-mips64el": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", - "integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", - "cpu": [ - "mips64el" - ], + "node_modules/unicorn-magic": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", + "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { - "node": ">=12" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/vite/node_modules/@esbuild/linux-ppc64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", - "integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", - "cpu": [ - "ppc64" - ], + "node_modules/unique-string": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-3.0.0.tgz", + "integrity": "sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "dependencies": { + "crypto-random-string": "^4.0.0" + }, "engines": { "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/vite/node_modules/@esbuild/linux-riscv64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", - "integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", - "cpu": [ - "riscv64" - ], + "node_modules/universal-user-agent": { + "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 + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { - "node": ">=12" + "node": ">= 10.0.0" } }, - "node_modules/vite/node_modules/@esbuild/linux-s390x": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", - "integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "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/vite/node_modules/@esbuild/linux-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", - "integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", - "cpu": [ - "x64" - ], + "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, - "optional": true, - "os": [ - "linux" - ], "engines": { - "node": ">=12" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/vite/node_modules/@esbuild/netbsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", - "integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", - "cpu": [ - "x64" - ], + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" } }, - "node_modules/vite/node_modules/@esbuild/openbsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", - "integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", - "cpu": [ - "x64" - ], + "node_modules/variable-diff": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/variable-diff/-/variable-diff-2.0.2.tgz", + "integrity": "sha512-PqE1fUTrENftNWiNlfVqwFODxu9Zcl+AGOC9zdw+9N2KYW5kwtK0oXtJotwycAs1YwWttUcM739eM0x7CrkOyQ==", "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" + "dependencies": { + "chalk": "^4.1.0" } }, - "node_modules/vite/node_modules/@esbuild/sunos-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", - "integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", - "cpu": [ - "x64" - ], + "node_modules/variable-diff/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, - "optional": true, - "os": [ - "sunos" - ], + "dependencies": { + "color-convert": "^2.0.1" + }, "engines": { - "node": ">=12" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/vite/node_modules/@esbuild/win32-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", - "integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", - "cpu": [ - "arm64" - ], + "node_modules/variable-diff/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, "engines": { - "node": ">=12" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/vite/node_modules/@esbuild/win32-ia32": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", - "integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", - "cpu": [ - "ia32" - ], + "node_modules/variable-diff/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, - "optional": true, - "os": [ - "win32" - ], + "dependencies": { + "color-name": "~1.1.4" + }, "engines": { - "node": ">=12" + "node": ">=7.0.0" } }, - "node_modules/vite/node_modules/@esbuild/win32-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", - "integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", - "cpu": [ - "x64" - ], + "node_modules/variable-diff/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 + }, + "node_modules/vite": { + "version": "5.2.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.9.tgz", + "integrity": "sha512-uOQWfuZBlc6Y3W/DTuQ1Sr+oIXWvqljLvS881SVmAj00d5RdgShLcuXWxseWPd4HXwiYBFW/vXHfKFeqj9uQnw==", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "dependencies": { + "esbuild": "^0.20.1", + "postcss": "^8.4.38", + "rollup": "^4.13.0" + }, + "bin": { + "vite": "bin/vite.js" + }, "engines": { - "node": ">=12" + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } } }, - "node_modules/vite/node_modules/esbuild": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", - "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", + "node_modules/vite-node": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.5.0.tgz", + "integrity": "sha512-tV8h6gMj6vPzVCa7l+VGq9lwoJjW8Y79vst8QZZGiuRAfijU+EEWuc0kFpmndQrWhMMhet1jdSF+40KSZUqIIw==", "dev": true, - "hasInstallScript": true, + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^5.0.0" + }, "bin": { - "esbuild": "bin/esbuild" + "vite-node": "vite-node.mjs" }, "engines": { - "node": ">=12" + "node": "^18.0.0 || >=20.0.0" }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.19.12", - "@esbuild/android-arm": "0.19.12", - "@esbuild/android-arm64": "0.19.12", - "@esbuild/android-x64": "0.19.12", - "@esbuild/darwin-arm64": "0.19.12", - "@esbuild/darwin-x64": "0.19.12", - "@esbuild/freebsd-arm64": "0.19.12", - "@esbuild/freebsd-x64": "0.19.12", - "@esbuild/linux-arm": "0.19.12", - "@esbuild/linux-arm64": "0.19.12", - "@esbuild/linux-ia32": "0.19.12", - "@esbuild/linux-loong64": "0.19.12", - "@esbuild/linux-mips64el": "0.19.12", - "@esbuild/linux-ppc64": "0.19.12", - "@esbuild/linux-riscv64": "0.19.12", - "@esbuild/linux-s390x": "0.19.12", - "@esbuild/linux-x64": "0.19.12", - "@esbuild/netbsd-x64": "0.19.12", - "@esbuild/openbsd-x64": "0.19.12", - "@esbuild/sunos-x64": "0.19.12", - "@esbuild/win32-arm64": "0.19.12", - "@esbuild/win32-ia32": "0.19.12", - "@esbuild/win32-x64": "0.19.12" + "funding": { + "url": "https://opencollective.com/vitest" } }, "node_modules/vitest": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.2.2.tgz", - "integrity": "sha512-d5Ouvrnms3GD9USIK36KG8OZ5bEvKEkITFtnGv56HFaSlbItJuYr7hv2Lkn903+AvRAgSixiamozUVfORUekjw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.5.0.tgz", + "integrity": "sha512-d8UKgR0m2kjdxDWX6911uwxout6GHS0XaGH1cksSIVVG8kRlE7G7aBw7myKQCvDI5dT4j7ZMa+l706BIORMDLw==", "dev": true, "dependencies": { - "@vitest/expect": "1.2.2", - "@vitest/runner": "1.2.2", - "@vitest/snapshot": "1.2.2", - "@vitest/spy": "1.2.2", - "@vitest/utils": "1.2.2", + "@vitest/expect": "1.5.0", + "@vitest/runner": "1.5.0", + "@vitest/snapshot": "1.5.0", + "@vitest/spy": "1.5.0", + "@vitest/utils": "1.5.0", "acorn-walk": "^8.3.2", - "cac": "^6.7.14", "chai": "^4.3.10", "debug": "^4.3.4", "execa": "^8.0.1", @@ -14476,11 +11306,11 @@ "pathe": "^1.1.1", "picocolors": "^1.0.0", "std-env": "^3.5.0", - "strip-literal": "^1.3.0", + "strip-literal": "^2.0.0", "tinybench": "^2.5.1", - "tinypool": "^0.8.2", + "tinypool": "^0.8.3", "vite": "^5.0.0", - "vite-node": "1.2.2", + "vite-node": "1.5.0", "why-is-node-running": "^2.2.2" }, "bin": { @@ -14495,8 +11325,8 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "^1.0.0", - "@vitest/ui": "^1.0.0", + "@vitest/browser": "1.5.0", + "@vitest/ui": "1.5.0", "happy-dom": "*", "jsdom": "*" }, @@ -14521,140 +11351,6 @@ } } }, - "node_modules/vitest/node_modules/execa": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", - "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^8.0.1", - "human-signals": "^5.0.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^4.1.0", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": ">=16.17" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/vitest/node_modules/get-stream": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", - "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/vitest/node_modules/human-signals": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", - "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", - "dev": true, - "engines": { - "node": ">=16.17.0" - } - }, - "node_modules/vitest/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/vitest/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/vitest/node_modules/npm-run-path": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", - "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", - "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/vitest/node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/vitest/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/vitest/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/vitest/node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -14703,16 +11399,16 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.14.tgz", - "integrity": "sha512-VnXFiIW8yNn9kIHN88xvZ4yOWchftKDsRJ8fEPacX/wl1lOvBrhsJ/OeJCXq7B0AaijRuqgzSKalJoPk+D8MPg==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", "dev": true, "dependencies": { - "available-typed-arrays": "^1.0.6", - "call-bind": "^1.0.5", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", - "has-tostringtag": "^1.0.1" + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -14772,18 +11468,6 @@ "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/wrap-ansi/node_modules/strip-ansi": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", @@ -14895,12 +11579,12 @@ } }, "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", "dev": true, "engines": { - "node": ">=10" + "node": ">=12.20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" diff --git a/package.json b/package.json index abaa7fb..3b2e759 100644 --- a/package.json +++ b/package.json @@ -16,41 +16,36 @@ "./*.js": "./.dist/*.js" }, "types": "./.dist/index.d.ts", - "files": [ - ".dist", - "package.json" - ], + "files": [".dist", "package.json"], "scripts": { - "build": "node --import tsx/esm build.config.ts", + "build": "tsc -p tsconfig.dist.json", "build:docs": "npx typedoc", "build:index": "node --import tsx/esm scripts/build-index.ts", "check:coverage": "vitest run --coverage=true", "check:project": "node-standards lint", "check:types": "tsc -p tsconfig.json", - "format": "prettier \"**/*.{ts,js,json,yml,yaml,md}\" --write", - "lint": "eslint \"./{src,test,typings}/**/*.ts\" --cache --no-eslintrc --config .eslintrc.cjs", - "lint:fix": "npm run lint -- --fix", + "lint": "biome check src test examples", + "lint:fix": "npm run lint -- --apply-unsafe", "package": "rm -rf .dist && npm run build", "prepare": "husky || true", "test": "vitest run" }, "dependencies": { - "ajv": "^8.12.0", - "split2": "^4.2.0", - "tslib": "^2.6.2" + "ajv": "^8.13.0", + "split2": "^4.2.0" }, "devDependencies": { - "@skyleague/axioms": "^3.6.0", - "@skyleague/node-standards": "^5.1.9", - "@skyleague/therefore": "^4.1.1", + "@skyleague/axioms": "^4.3.3", + "@skyleague/node-standards": "^7.0.2", + "@skyleague/therefore": "^5.5.0", "@types/split2": "^4.2.3", "camelcase": "^8.0.0", - "got": "^14.2.0", - "nock": "^13.5.1", - "typescript": "^5.3.3" + "got": "^14.3.0", + "nock": "^13.5.4", + "typescript": "^5.4.5" }, "peerDependencies": { - "got": "^14.2.0" + "got": "^14.3.0" }, "engines": { "node": ">=20" diff --git a/prettier.config.cjs b/prettier.config.cjs deleted file mode 100644 index cd2cdef..0000000 --- a/prettier.config.cjs +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@skyleague/node-standards/prettier.config.cjs') diff --git a/scripts/build-index.ts b/scripts/build-index.ts index 0f75d3f..08d2fca 100644 --- a/scripts/build-index.ts +++ b/scripts/build-index.ts @@ -3,7 +3,6 @@ import camelcase from 'camelcase' import fs from 'node:fs' import path from 'node:path' import { fileURLToPath } from 'node:url' - ;(() => { const __dirname = path.dirname(fileURLToPath(import.meta.url)) const directories = fs.readdirSync(`${__dirname}/../src`) @@ -21,7 +20,9 @@ import { fileURLToPath } from 'node:url' if (file.endsWith('.type.ts')) { exports.push(`export * as ${camelcase(dir)} from './${file.replace('.ts', '.js')}'`) } else if (file.endsWith('.client.ts')) { - exports.push(`export * from './${file.replace('.ts', '.js')}'`) + const contents = fs.readFileSync(`${__dirname}/../src/${dir}/${file}`, 'utf-8') + const className = contents.match(/export class (.+) {/)?.[1] + exports.push(`export { ${className} } from './${file.replace('.ts', '.js')}'`) } } diff --git a/src/accounting-interest-accrual/index.ts b/src/accounting-interest-accrual/index.ts index 26ca35a..d3f9987 100644 --- a/src/accounting-interest-accrual/index.ts +++ b/src/accounting-interest-accrual/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuAccountingInterestAccrual } from './rest.client.js' export * as accountingInterestAccrual from './rest.type.js' diff --git a/src/accounting-interest-accrual/rest.client.ts b/src/accounting-interest-accrual/rest.client.ts index b28dba3..5357632 100644 --- a/src/accounting-interest-accrual/rest.client.ts +++ b/src/accounting-interest-accrual/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ErrorResponse, InterestAccrualSearchCriteria, SearchResponse } from './rest.type.js' /** @@ -46,7 +49,7 @@ export class MambuAccountingInterestAccrual { /** * Allows search of interest accrual breakdown entries by various criteria. */ - public async search({ + public search({ body, query, auth = [['apiKey'], ['basic']], @@ -54,11 +57,27 @@ export class MambuAccountingInterestAccrual { body: InterestAccrualSearchCriteria query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(InterestAccrualSearchCriteria, body) + }): Promise< + | SuccessResponse<'200', SearchResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(InterestAccrualSearchCriteria, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`accounting/interestaccrual:search`, { + this.buildClient(auth).post('accounting/interestaccrual:search', { json: body, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -69,45 +88,66 @@ export class MambuAccountingInterestAccrual { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +174,52 @@ export class MambuAccountingInterestAccrual { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/accounting-interest-accrual/rest.type.ts b/src/accounting-interest-accrual/rest.type.ts index fff0027..dab99bd 100644 --- a/src/accounting-interest-accrual/rest.type.ts +++ b/src/accounting-interest-accrual/rest.type.ts @@ -3,8 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as InterestAccrualSearchCriteriaValidator } from './schemas/interest-accrual-search-criteria.schema.js' +import { validate as SearchResponseValidator } from './schemas/search-response.schema.js' /** * Represents the conversion rate used in accounting to convert amounts from one currency to organisation currency @@ -13,27 +17,27 @@ export interface AccountingRate { /** * The encoded key of the accounting rate, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Rate validity end date (as Organization Time) */ - endDate?: string + endDate?: string | undefined /** * Organisation currency code */ - fromCurrencyCode?: string + fromCurrencyCode?: string | undefined /** * Value of rate to be used for accounting conversions */ - rate?: number + rate?: number | undefined /** * Rate validity start date (as Organization Time) */ - startDate?: string + startDate?: string | undefined /** * Foreign currency code */ - toCurrencyCode?: string + toCurrencyCode?: string | undefined } /** @@ -227,23 +231,25 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -251,10 +257,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -262,12 +269,12 @@ export const ErrorResponse = { * Represents the details of general ledger journal entries posted in foreign currency. */ export interface ForeignAmount { - accountingRate?: AccountingRate + accountingRate?: AccountingRate | undefined /** * The foreign currency amount of the accounting entry. */ - amount?: number - currency?: Currency + amount?: number | undefined + currency?: Currency | undefined } /** @@ -277,76 +284,76 @@ export interface InterestAccrualBreakdown { /** * The loan or deposit account ID for which interest is accrued. */ - accountId?: string + accountId?: string | undefined /** * The encoded key of the loan or deposit account for which interest is accrued. */ - accountKey?: string + accountKey?: string | undefined /** * The interest accrued amount for the account in this entry. */ - amount?: number + amount?: number | undefined /** * The booking date in the organization's timezone. */ - bookingDate?: string + bookingDate?: string | undefined /** * The encoded key of the account's branch. */ - branchKey?: string + branchKey?: string | undefined /** * The name of the account's branch */ - branchName?: string + branchName?: string | undefined /** * The creation date and time of the entry in UTC. */ - creationDate?: string + creationDate?: string | undefined /** * The generated ID of the interest accrual per account entry. */ - entryId?: number + entryId?: number | undefined /** * Debit or Credit. */ - entryType?: string - foreignAmount?: ForeignAmount + entryType?: string | undefined + foreignAmount?: ForeignAmount | undefined /** * The ID of the general ledger account. */ - glAccountId?: string + glAccountId?: string | undefined /** * The encoded key of the general ledger account used for logging the interest accrual. */ - glAccountKey?: string + glAccountKey?: string | undefined /** * The name of the general ledger account. */ - glAccountName?: string + glAccountName?: string | undefined /** * The general ledger account type, which can be: `ASSET`, `LIABILITY`, `EQUITY`, `INCOME`, or `EXPENSE`. */ - glAccountType?: string + glAccountType?: string | undefined /** * The ID of the general ledger journal entry that logged the interest accrual sum for all accounts of the same product. */ - parentEntryId?: number + parentEntryId?: number | undefined /** * The ID of the account's product. */ - productId?: string + productId?: string | undefined /** * The encoded key of the account's product. */ - productKey?: string + productKey?: string | undefined /** * The product type. */ - productType?: string + productType?: string | undefined /** * The journal entry transaction ID. */ - transactionId?: string + transactionId?: string | undefined } /** @@ -421,15 +428,15 @@ export interface InterestAccrualFilterCriteria { /** * The second value to match the searching criteria, when the `BETWEEN` operator is used. */ - secondValue?: string + secondValue?: string | undefined /** * The value to match the searching criteria. */ - value?: string + value?: string | undefined /** * List of values when the `IN` operator is used. */ - values?: string[] + values?: string[] | undefined } /** @@ -439,13 +446,12 @@ export interface InterestAccrualSearchCriteria { /** * The list of filtering criteria. */ - filterCriteria?: InterestAccrualFilterCriteria[] - sortingCriteria?: InterestAccrualSortingCriteria + filterCriteria?: InterestAccrualFilterCriteria[] | undefined + sortingCriteria?: InterestAccrualSortingCriteria | undefined } export const InterestAccrualSearchCriteria = { - validate: (await import('./schemas/interest-accrual-search-criteria.schema.js')) - .validate as ValidateFunction, + validate: InterestAccrualSearchCriteriaValidator as ValidateFunction, get schema() { return InterestAccrualSearchCriteria.validate.schema }, @@ -453,10 +459,11 @@ export const InterestAccrualSearchCriteria = { return InterestAccrualSearchCriteria.validate.errors ?? undefined }, is: (o: unknown): o is InterestAccrualSearchCriteria => InterestAccrualSearchCriteria.validate(o) === true, - assert: (o: unknown) => { - if (!InterestAccrualSearchCriteria.validate(o)) { - throw new ValidationError(InterestAccrualSearchCriteria.errors ?? []) + parse: (o: unknown): { right: InterestAccrualSearchCriteria } | { left: DefinedError[] } => { + if (InterestAccrualSearchCriteria.is(o)) { + return { right: o } } + return { left: (InterestAccrualSearchCriteria.errors ?? []) as DefinedError[] } }, } as const @@ -483,19 +490,19 @@ export interface InterestAccrualSortingCriteria { /** * The sorting order: `ASC` or `DESC`. The default order is `DESC`. */ - order?: 'ASC' | 'DESC' + order?: 'ASC' | 'DESC' | undefined } export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } export type SearchResponse = InterestAccrualBreakdown[] export const SearchResponse = { - validate: (await import('./schemas/search-response.schema.js')).validate as ValidateFunction, + validate: SearchResponseValidator as ValidateFunction, get schema() { return SearchResponse.validate.schema }, @@ -503,4 +510,10 @@ export const SearchResponse = { return SearchResponse.validate.errors ?? undefined }, is: (o: unknown): o is SearchResponse => SearchResponse.validate(o) === true, + parse: (o: unknown): { right: SearchResponse } | { left: DefinedError[] } => { + if (SearchResponse.is(o)) { + return { right: o } + } + return { left: (SearchResponse.errors ?? []) as DefinedError[] } + }, } as const diff --git a/src/accounting-interest-accrual/schemas/error-response.schema.js b/src/accounting-interest-accrual/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/accounting-interest-accrual/schemas/error-response.schema.js +++ b/src/accounting-interest-accrual/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'201', AccountingRate> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PostAccountingRateDTO, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`currencies/${path.currencyCode}/accountingRates`, { @@ -66,20 +87,20 @@ export class MambuAccountingRates { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: AccountingRate, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get accounting rates */ - public async getAll({ + public getAll({ path, query, auth = [['apiKey'], ['basic']], @@ -87,7 +108,20 @@ export class MambuAccountingRates { path: { currencyCode: string } query?: { offset?: string; limit?: string; paginationDetails?: string; from?: string; to?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`currencies/${path.currencyCode}/accountingRates`, { searchParams: query ?? {}, @@ -100,45 +134,66 @@ export class MambuAccountingRates { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -165,24 +220,52 @@ export class MambuAccountingRates { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/accounting-rates/rest.type.ts b/src/accounting-rates/rest.type.ts index 267de27..74da300 100644 --- a/src/accounting-rates/rest.type.ts +++ b/src/accounting-rates/rest.type.ts @@ -3,8 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as AccountingRateValidator } from './schemas/accounting-rate.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' +import { validate as PostAccountingRateDTOValidator } from './schemas/post-accounting-rate-dto.schema.js' /** * Represents the conversion rate used in accounting to convert amounts from one currency to organisation currency @@ -13,31 +18,31 @@ export interface AccountingRate { /** * The encoded key of the accounting rate, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Rate validity end date (as Organization Time) */ - endDate?: string + endDate?: string | undefined /** * Organisation currency code */ - fromCurrencyCode?: string + fromCurrencyCode?: string | undefined /** * Value of rate to be used for accounting conversions */ - rate?: number + rate?: number | undefined /** * Rate validity start date (as Organization Time) */ - startDate?: string + startDate?: string | undefined /** * Foreign currency code */ - toCurrencyCode?: string + toCurrencyCode?: string | undefined } export const AccountingRate = { - validate: (await import('./schemas/accounting-rate.schema.js')).validate as ValidateFunction, + validate: AccountingRateValidator as ValidateFunction, get schema() { return AccountingRate.validate.schema }, @@ -45,14 +50,20 @@ export const AccountingRate = { return AccountingRate.validate.errors ?? undefined }, is: (o: unknown): o is AccountingRate => AccountingRate.validate(o) === true, + parse: (o: unknown): { right: AccountingRate } | { left: DefinedError[] } => { + if (AccountingRate.is(o)) { + return { right: o } + } + return { left: (AccountingRate.errors ?? []) as DefinedError[] } + }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -60,17 +71,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = AccountingRate[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -78,6 +90,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -91,11 +109,11 @@ export interface PostAccountingRateDTO { /** * The start date from which the accounting rate will be applied (as Organization time) */ - startDate?: string + startDate?: string | undefined } export const PostAccountingRateDTO = { - validate: (await import('./schemas/post-accounting-rate-dto.schema.js')).validate as ValidateFunction, + validate: PostAccountingRateDTOValidator as ValidateFunction, get schema() { return PostAccountingRateDTO.validate.schema }, @@ -103,15 +121,16 @@ export const PostAccountingRateDTO = { return PostAccountingRateDTO.validate.errors ?? undefined }, is: (o: unknown): o is PostAccountingRateDTO => PostAccountingRateDTO.validate(o) === true, - assert: (o: unknown) => { - if (!PostAccountingRateDTO.validate(o)) { - throw new ValidationError(PostAccountingRateDTO.errors ?? []) + parse: (o: unknown): { right: PostAccountingRateDTO } | { left: DefinedError[] } => { + if (PostAccountingRateDTO.is(o)) { + return { right: o } } + return { left: (PostAccountingRateDTO.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/accounting-rates/schemas/accounting-rate.schema.js b/src/accounting-rates/schemas/accounting-rate.schema.js index f60a4f7..82ab6b4 100644 --- a/src/accounting-rates/schemas/accounting-rate.schema.js +++ b/src/accounting-rates/schemas/accounting-rate.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AccountingRate","type":"object","description":"Represents the conversion rate used in accounting to convert amounts from one currency to organisation currency","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the accounting rate, auto generated, unique"},"endDate":{"type":"string","title":"endDate","description":"Rate validity end date (as Organization Time)","format":"date-time"},"fromCurrencyCode":{"type":"string","title":"fromCurrencyCode","description":"Organisation currency code"},"rate":{"type":"number","title":"rate","description":"Value of rate to be used for accounting conversions"},"startDate":{"type":"string","title":"startDate","description":"Rate validity start date (as Organization Time)","format":"date-time"},"toCurrencyCode":{"type":"string","title":"toCurrencyCode","description":"Foreign currency code"}},"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.encodedKey !== undefined){const _errs2 = 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 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.endDate !== undefined){const _errs4 = errors;if(errors === _errs4){if(errors === _errs4){if(!(typeof data.endDate === "string")){validate10.errors = [{instancePath:instancePath+"/endDate",schemaPath:"#/properties/endDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.fromCurrencyCode !== undefined){const _errs6 = errors;if(typeof data.fromCurrencyCode !== "string"){validate10.errors = [{instancePath:instancePath+"/fromCurrencyCode",schemaPath:"#/properties/fromCurrencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.rate !== undefined){let data3 = data.rate;const _errs8 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate10.errors = [{instancePath:instancePath+"/rate",schemaPath:"#/properties/rate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.startDate !== undefined){const _errs10 = errors;if(errors === _errs10){if(errors === _errs10){if(!(typeof data.startDate === "string")){validate10.errors = [{instancePath:instancePath+"/startDate",schemaPath:"#/properties/startDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.toCurrencyCode !== undefined){const _errs12 = errors;if(typeof data.toCurrencyCode !== "string"){validate10.errors = [{instancePath:instancePath+"/toCurrencyCode",schemaPath:"#/properties/toCurrencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs12 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AccountingRate","type":"object","description":"Represents the conversion rate used in accounting to convert amounts from one currency to organisation currency","properties":{"encodedKey":{"type":"string","description":"The encoded key of the accounting rate, auto generated, unique"},"endDate":{"type":"string","description":"Rate validity end date (as Organization Time)","format":"date-time"},"fromCurrencyCode":{"type":"string","description":"Organisation currency code"},"rate":{"type":"number","description":"Value of rate to be used for accounting conversions"},"startDate":{"type":"string","description":"Rate validity start date (as Organization Time)","format":"date-time"},"toCurrencyCode":{"type":"string","description":"Foreign currency code"}},"additionalProperties":true};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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.encodedKey !== undefined){const _errs2 = 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 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.endDate !== undefined){let data1 = data.endDate;const _errs4 = errors;if(errors === _errs4){if(errors === _errs4){if(typeof data1 === "string"){if(!(formats0.validate(data1))){validate10.errors = [{instancePath:instancePath+"/endDate",schemaPath:"#/properties/endDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/endDate",schemaPath:"#/properties/endDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.fromCurrencyCode !== undefined){const _errs6 = errors;if(typeof data.fromCurrencyCode !== "string"){validate10.errors = [{instancePath:instancePath+"/fromCurrencyCode",schemaPath:"#/properties/fromCurrencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.rate !== undefined){let data3 = data.rate;const _errs8 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate10.errors = [{instancePath:instancePath+"/rate",schemaPath:"#/properties/rate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.startDate !== undefined){let data4 = data.startDate;const _errs10 = errors;if(errors === _errs10){if(errors === _errs10){if(typeof data4 === "string"){if(!(formats0.validate(data4))){validate10.errors = [{instancePath:instancePath+"/startDate",schemaPath:"#/properties/startDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/startDate",schemaPath:"#/properties/startDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.toCurrencyCode !== undefined){const _errs12 = errors;if(typeof data.toCurrencyCode !== "string"){validate10.errors = [{instancePath:instancePath+"/toCurrencyCode",schemaPath:"#/properties/toCurrencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs12 === 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/accounting-rates/schemas/error-response.schema.js b/src/accounting-rates/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/accounting-rates/schemas/error-response.schema.js +++ b/src/accounting-rates/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'202', AccountingReportGenerationResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(AccountingReportGenerationInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`accounting/reports`, { + this.buildClient(auth).post('accounting/reports', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 202: AccountingReportGenerationResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get accounting reports */ - public async get({ path, auth = [['apiKey'], ['basic']] }: { path: { reportKey: string }; auth?: string[][] | string[] }) { + public get({ + path, + auth = [['apiKey'], ['basic']], + }: { path: { reportKey: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', AccountingReport> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`accounting/reports/${path.reportKey}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -93,45 +129,66 @@ export class MambuAccountingReports { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -158,24 +215,52 @@ export class MambuAccountingReports { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/accounting-reports/rest.type.ts b/src/accounting-reports/rest.type.ts index e695eb1..eca06c9 100644 --- a/src/accounting-reports/rest.type.ts +++ b/src/accounting-reports/rest.type.ts @@ -3,8 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as AccountingReportGenerationInputValidator } from './schemas/accounting-report-generation-input.schema.js' +import { validate as AccountingReportGenerationResponseValidator } from './schemas/accounting-report-generation-response.schema.js' +import { validate as AccountingReportValidator } from './schemas/accounting-report.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' /** * Represents information about the accounting report. @@ -13,11 +18,11 @@ export interface AccountingReport { /** * The list of the accounting report items. */ - items?: AccountingReportItem[] + items?: AccountingReportItem[] | undefined /** * The encoded key of the generated accounting report. */ - reportKey?: string + reportKey?: string | undefined /** * The accounting report generation status. */ @@ -33,10 +38,11 @@ export interface AccountingReport { | 'TRANSIENT_ERROR' | 'OVERRIDDEN' | 'RECOVERABLE_ERROR' + | undefined } export const AccountingReport = { - validate: (await import('./schemas/accounting-report.schema.js')).validate as ValidateFunction, + validate: AccountingReportValidator as ValidateFunction, get schema() { return AccountingReport.validate.schema }, @@ -44,6 +50,12 @@ export const AccountingReport = { return AccountingReport.validate.errors ?? undefined }, is: (o: unknown): o is AccountingReport => AccountingReport.validate(o) === true, + parse: (o: unknown): { right: AccountingReport } | { left: DefinedError[] } => { + if (AccountingReport.is(o)) { + return { right: o } + } + return { left: (AccountingReport.errors ?? []) as DefinedError[] } + }, } as const /** @@ -53,23 +65,23 @@ export interface AccountingReportAmounts { /** * The closing balance amount of the general ledger account. */ - closingBalance?: number + closingBalance?: number | undefined /** * The credit amount of the general ledger account. */ - credits?: number + credits?: number | undefined /** * The debit amount of the general ledger account. */ - debits?: number + debits?: number | undefined /** * The net change amount of the general ledger account. */ - netChange?: number + netChange?: number | undefined /** * The opening balance amount of the general ledger account. */ - openingBalance?: number + openingBalance?: number | undefined } /** @@ -79,15 +91,15 @@ export interface AccountingReportGenerationInput { /** * The balance types to include in the generated report. */ - balanceTypes?: ('OPENING_BALANCE' | 'NET_CHANGE' | 'CLOSING_BALANCE')[] + balanceTypes?: ('OPENING_BALANCE' | 'NET_CHANGE' | 'CLOSING_BALANCE')[] | undefined /** * The branch ID or encoded key to filter general ledger journal entries by. */ - branchId?: string + branchId?: string | undefined /** * The ISO currency code to filter general ledger accounts by. */ - currencyCode?: string + currencyCode?: string | undefined /** * The inclusive end date in the organization time format and timezone that the general ledger journal entries' entry date is filtered to. */ @@ -95,7 +107,7 @@ export interface AccountingReportGenerationInput { /** * The account types to filter general ledger accounts by. For header general ledger accounts the report will reflect the sum of the detail general ledger accounts that match the given filters used. */ - glTypes?: AccountingReportGenerationInputGlTypesArray[] + glTypes?: GlTypes[] | undefined /** * The inclusive start date in the organization time format and timezone that the general ledger journal entries' entry date is filtered from. */ @@ -103,8 +115,7 @@ export interface AccountingReportGenerationInput { } export const AccountingReportGenerationInput = { - validate: (await import('./schemas/accounting-report-generation-input.schema.js')) - .validate as ValidateFunction, + validate: AccountingReportGenerationInputValidator as ValidateFunction, get schema() { return AccountingReportGenerationInput.validate.schema }, @@ -112,15 +123,14 @@ export const AccountingReportGenerationInput = { return AccountingReportGenerationInput.validate.errors ?? undefined }, is: (o: unknown): o is AccountingReportGenerationInput => AccountingReportGenerationInput.validate(o) === true, - assert: (o: unknown) => { - if (!AccountingReportGenerationInput.validate(o)) { - throw new ValidationError(AccountingReportGenerationInput.errors ?? []) + parse: (o: unknown): { right: AccountingReportGenerationInput } | { left: DefinedError[] } => { + if (AccountingReportGenerationInput.is(o)) { + return { right: o } } + return { left: (AccountingReportGenerationInput.errors ?? []) as DefinedError[] } }, } as const -type AccountingReportGenerationInputGlTypesArray = 'ASSET' | 'LIABILITY' | 'EQUITY' | 'INCOME' | 'EXPENSE' - /** * Represents the information about the accounting report generation status. */ @@ -128,7 +138,7 @@ export interface AccountingReportGenerationResponse { /** * The encoded key of the generated report. */ - reportKey?: string + reportKey?: string | undefined /** * The accounting report generation status. */ @@ -144,11 +154,11 @@ export interface AccountingReportGenerationResponse { | 'TRANSIENT_ERROR' | 'OVERRIDDEN' | 'RECOVERABLE_ERROR' + | undefined } export const AccountingReportGenerationResponse = { - validate: (await import('./schemas/accounting-report-generation-response.schema.js')) - .validate as ValidateFunction, + validate: AccountingReportGenerationResponseValidator as ValidateFunction, get schema() { return AccountingReportGenerationResponse.validate.schema }, @@ -156,15 +166,21 @@ export const AccountingReportGenerationResponse = { return AccountingReportGenerationResponse.validate.errors ?? undefined }, is: (o: unknown): o is AccountingReportGenerationResponse => AccountingReportGenerationResponse.validate(o) === true, + parse: (o: unknown): { right: AccountingReportGenerationResponse } | { left: DefinedError[] } => { + if (AccountingReportGenerationResponse.is(o)) { + return { right: o } + } + return { left: (AccountingReportGenerationResponse.errors ?? []) as DefinedError[] } + }, } as const /** * Represents the accounting report information about general ledger accounts and their amounts in both the organization's currency and foreign currencies. */ export interface AccountingReportItem { - amounts?: AccountingReportAmounts - foreignAmounts?: AccountingReportAmounts - glAccount?: GLAccount + amounts?: AccountingReportAmounts | undefined + foreignAmounts?: AccountingReportAmounts | undefined + glAccount?: GLAccount | undefined } /** @@ -358,23 +374,25 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -382,10 +400,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -396,60 +415,62 @@ export interface GLAccount { /** * `TRUE` if the account is activated and may be used, `FALSE` otherwise. */ - activated?: boolean + activated?: boolean | undefined /** * `TRUE` if manual journal entries are allowed, `FALSE` otherwise. */ - allowManualJournalEntries?: boolean + allowManualJournalEntries?: boolean | undefined /** * The balance of the general ledger account, which is only populated for the GET /glaccounts endpoint. */ - balance?: number + balance?: number | undefined /** * The creation date for this account, which is stored as UTC. */ - creationDate?: string - currency?: Currency + creationDate?: string | undefined + currency?: Currency | undefined /** * A description of the general ledger account. */ - description?: string + description?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The general ledger code used to identify different account types. Also used for grouping and categorizing accounts. For example: an account code of '3201' is considered a subtype of '3200'. */ - glCode?: string + glCode?: string | undefined /** * The last modification date and time, which is stored as UTC. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The data migration event key if the general ledger account was created as a part of a data migration event. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * The name of the general ledger account. */ - name?: string + name?: string | undefined /** * `TRUE` if trailing zeros are stripped, `FALSE` otherwise. */ - stripTrailingZeros?: boolean + stripTrailingZeros?: boolean | undefined /** * The general ledger account type. */ - type?: 'ASSET' | 'LIABILITY' | 'EQUITY' | 'INCOME' | 'EXPENSE' + type?: 'ASSET' | 'LIABILITY' | 'EQUITY' | 'INCOME' | 'EXPENSE' | undefined /** * The usage type of the general ledger account. `DETAIL` accounts are used to stores transaction balances. `HEADER` accounts are used to organise and group detail accounts for reporting purposes. */ - usage?: 'DETAIL' | 'HEADER' + usage?: 'DETAIL' | 'HEADER' | undefined } +type GlTypes = 'ASSET' | 'LIABILITY' | 'EQUITY' | 'INCOME' | 'EXPENSE' + export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/accounting-reports/schemas/accounting-report-generation-input.schema.js b/src/accounting-reports/schemas/accounting-report-generation-input.schema.js index 16560f5..6114a48 100644 --- a/src/accounting-reports/schemas/accounting-report-generation-input.schema.js +++ b/src/accounting-reports/schemas/accounting-report-generation-input.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AccountingReportGenerationInput","type":"object","description":"Represents the input for the accounting report generation.","properties":{"balanceTypes":{"type":"array","title":"balanceTypes","description":"The balance types to include in the generated report.","items":{"enum":["OPENING_BALANCE","NET_CHANGE","CLOSING_BALANCE"]}},"branchId":{"type":"string","title":"branchId","description":"The branch ID or encoded key to filter general ledger journal entries by."},"currencyCode":{"type":"string","title":"currencyCode","description":"The ISO currency code to filter general ledger accounts by."},"endDate":{"type":"string","title":"endDate","description":"The inclusive end date in the organization time format and timezone that the general ledger journal entries' entry date is filtered to.","format":"date"},"glTypes":{"type":"array","title":"glTypes","description":"The account types to filter general ledger accounts by. For header general ledger accounts the report will reflect the sum of the detail general ledger accounts that match the given filters used.","items":{"enum":["ASSET","LIABILITY","EQUITY","INCOME","EXPENSE"]}},"startDate":{"type":"string","title":"startDate","description":"The inclusive start date in the organization time format and timezone that the general ledger journal entries' entry date is filtered from.","format":"date"}},"required":["endDate","startDate"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.endDate === undefined) && (missing0 = "endDate")) || ((data.startDate === undefined) && (missing0 = "startDate"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.balanceTypes !== undefined){let data0 = data.balanceTypes;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/accountingrules.yaml`, { + this.buildClient(auth).get('configuration/accountingrules.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update the current accounting rules configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/accountingrules.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/accountingrules.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +166,52 @@ export class MambuAccountingRulesConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/api-consumers/index.ts b/src/api-consumers/index.ts index fc921b2..c5c1588 100644 --- a/src/api-consumers/index.ts +++ b/src/api-consumers/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuApiConsumers } from './rest.client.js' export * as apiConsumers from './rest.type.js' diff --git a/src/api-consumers/rest.client.ts b/src/api-consumers/rest.client.ts index b016e98..433b9d6 100644 --- a/src/api-consumers/rest.client.ts +++ b/src/api-consumers/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ApiConsumer, ApiKey, @@ -55,37 +58,50 @@ export class MambuApiConsumers { /** * Create API consumer */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: ApiConsumer - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(ApiConsumer, body) + }: { body: ApiConsumer; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', ApiConsumer> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ApiConsumer, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`consumers`, { + this.buildClient(auth).post('consumers', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: ApiConsumer, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create API key */ - public async createApiKeyForConsumer({ + public createApiKeyForConsumer({ body, path, headers, @@ -93,10 +109,28 @@ export class MambuApiConsumers { }: { body: ApiKeyInput path: { apiConsumerId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ApiKeyInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', ApiKey> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ApiKeyInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`consumers/${path.apiConsumerId}/apikeys`, { @@ -105,103 +139,143 @@ export class MambuApiConsumers { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: ApiKey, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create secret key */ - public async createSecretKeyForConsumer({ + public createSecretKeyForConsumer({ path, headers, auth = [['apiKey'], ['basic']], - }: { - path: { apiConsumerId: string } - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { + }: { path: { apiConsumerId: string }; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', SecretKey> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).post(`consumers/${path.apiConsumerId}/secretkeys`, { headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: SecretKey, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete API consumer */ - public async delete({ + public delete({ path, auth = [['apiKey'], ['basic']], - }: { - path: { apiConsumerId: string } - auth?: string[][] | string[] - }) { + }: { path: { apiConsumerId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`consumers/${path.apiConsumerId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete API key */ - public async deleteApiKeyForConsumer({ + public deleteApiKeyForConsumer({ path, auth = [['apiKey'], ['basic']], - }: { - path: { apiConsumerId: string; apiKeyId: string } - auth?: string[][] | string[] - }) { + }: { path: { apiConsumerId: string; apiKeyId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`consumers/${path.apiConsumerId}/apikeys/${path.apiKeyId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get all API consumers */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], - }: { query?: { offset?: string; limit?: string; paginationDetails?: string }; auth?: string[][] | string[] } = {}) { + }: { query?: { offset?: string; limit?: string; paginationDetails?: string }; auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`consumers`, { + this.buildClient(auth).get('consumers', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -211,20 +285,30 @@ export class MambuApiConsumers { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get API consumer */ - public async getById({ + public getById({ path, auth = [['apiKey'], ['basic']], - }: { - path: { apiConsumerId: string } - auth?: string[][] | string[] - }) { + }: { path: { apiConsumerId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', ApiConsumer> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`consumers/${path.apiConsumerId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -236,8 +320,8 @@ export class MambuApiConsumers { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** @@ -245,13 +329,23 @@ export class MambuApiConsumers { * * This endpoint allows you to get the API key ID and a six character clear text prefix of the API key. */ - public async getKeysByConsumerId({ + public getKeysByConsumerId({ path, auth = [['apiKey'], ['basic']], - }: { - path: { apiConsumerId: string } - auth?: string[][] | string[] - }) { + }: { path: { apiConsumerId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', GetKeysByConsumerIdResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`consumers/${path.apiConsumerId}/keys`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -263,14 +357,14 @@ export class MambuApiConsumers { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update API consumer */ - public async patch({ + public patch({ body, path, headers, @@ -278,31 +372,48 @@ export class MambuApiConsumers { }: { body: PatchRequest path: { apiConsumerId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`consumers/${path.apiConsumerId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update API consumer */ - public async update({ + public update({ body, path, headers, @@ -310,10 +421,28 @@ export class MambuApiConsumers { }: { body: ApiConsumer path: { apiConsumerId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ApiConsumer, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', ApiConsumer> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ApiConsumer, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`consumers/${path.apiConsumerId}`, { @@ -322,51 +451,72 @@ export class MambuApiConsumers { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: ApiConsumer, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -393,24 +543,52 @@ export class MambuApiConsumers { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/api-consumers/rest.type.ts b/src/api-consumers/rest.type.ts index 2ff3c1f..62b3910 100644 --- a/src/api-consumers/rest.type.ts +++ b/src/api-consumers/rest.type.ts @@ -3,49 +3,60 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ApiConsumerValidator } from './schemas/api-consumer.schema.js' +import { validate as ApiKeyInputValidator } from './schemas/api-key-input.schema.js' +import { validate as ApiKeyValidator } from './schemas/api-key.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' +import { validate as GetKeysByConsumerIdResponseValidator } from './schemas/get-keys-by-consumer-id-response.schema.js' +import { validate as PatchRequestValidator } from './schemas/patch-request.schema.js' +import { validate as SecretKeyValidator } from './schemas/secret-key.schema.js' /** * Represents an API consumer. */ export interface ApiConsumer { - access?: ApiConsumerAccess + access?: ApiConsumerAccess | undefined /** * The encoded key of the branch this API consumer is assigned to. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * The date when the API consumer was created in UTC. */ - creationDate?: string + creationDate?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the API consumer. */ - id?: string + id?: string | undefined /** * The last time the API consumer was modified in UTC. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The API consumer name. */ name: string - role?: RoleIdentifier + role?: RoleIdentifier | undefined /** * The API consumer transaction limits. */ - transactionLimits?: { - [k: string]: number - } + transactionLimits?: + | { + [k: string]: number | undefined + } + | undefined } export const ApiConsumer = { - validate: (await import('./schemas/api-consumer.schema.js')).validate as ValidateFunction, + validate: ApiConsumerValidator as ValidateFunction, get schema() { return ApiConsumer.validate.schema }, @@ -53,10 +64,11 @@ export const ApiConsumer = { return ApiConsumer.validate.errors ?? undefined }, is: (o: unknown): o is ApiConsumer => ApiConsumer.validate(o) === true, - assert: (o: unknown) => { - if (!ApiConsumer.validate(o)) { - throw new ValidationError(ApiConsumer.errors ?? []) + parse: (o: unknown): { right: ApiConsumer } | { left: DefinedError[] } => { + if (ApiConsumer.is(o)) { + return { right: o } } + return { left: (ApiConsumer.errors ?? []) as DefinedError[] } }, } as const @@ -67,31 +79,31 @@ export interface ApiConsumerAccess { /** * `TRUE` if the API consumer has the administrator user type, `FALSE` otherwise. Administrators (admins) have all permissions and can perform any action in Mambu. */ - administratorAccess?: boolean + administratorAccess?: boolean | undefined /** * `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. */ - apiAccess?: boolean + apiAccess?: boolean | undefined /** * `TRUE` if the API consumer permissions apply to all branches, `FALSE` if they only apply to specific branches. */ - canManageAllBranches?: boolean + canManageAllBranches?: boolean | undefined /** * `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. */ - canManageEntitiesAssignedToOtherOfficers?: boolean + canManageEntitiesAssignedToOtherOfficers?: boolean | undefined /** * `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. */ - creditOfficerAccess?: boolean + creditOfficerAccess?: boolean | undefined /** * 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. */ - managedBranches?: UserManagedBranch[] + managedBranches?: UserManagedBranch[] | undefined /** * 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. */ - permissions?: Local0[] + permissions?: Permissions[] | undefined } /** @@ -101,19 +113,19 @@ export interface ApiKey { /** * A six character cleartext prefix of the API key. The prefix is not guaranteed to be unique. You must base any identification process on the API key ID, not the prefix. */ - apiKey?: string + apiKey?: string | undefined /** * The time to live (TTL) for the API key in seconds. */ - expirationTime?: number + expirationTime?: number | undefined /** * The API key ID. You must base any identification process on the the API key ID as it is guaranteed to be unique. */ - id?: string + id?: string | undefined } export const ApiKey = { - validate: (await import('./schemas/api-key.schema.js')).validate as ValidateFunction, + validate: ApiKeyValidator as ValidateFunction, get schema() { return ApiKey.validate.schema }, @@ -121,6 +133,12 @@ export const ApiKey = { return ApiKey.validate.errors ?? undefined }, is: (o: unknown): o is ApiKey => ApiKey.validate(o) === true, + parse: (o: unknown): { right: ApiKey } | { left: DefinedError[] } => { + if (ApiKey.is(o)) { + return { right: o } + } + return { left: (ApiKey.errors ?? []) as DefinedError[] } + }, } as const /** @@ -130,11 +148,11 @@ export interface ApiKeyInput { /** * The time to live (TTL) for the API key in seconds. */ - expirationTime?: number + expirationTime?: number | undefined } export const ApiKeyInput = { - validate: (await import('./schemas/api-key-input.schema.js')).validate as ValidateFunction, + validate: ApiKeyInputValidator as ValidateFunction, get schema() { return ApiKeyInput.validate.schema }, @@ -142,19 +160,20 @@ export const ApiKeyInput = { return ApiKeyInput.validate.errors ?? undefined }, is: (o: unknown): o is ApiKeyInput => ApiKeyInput.validate(o) === true, - assert: (o: unknown) => { - if (!ApiKeyInput.validate(o)) { - throw new ValidationError(ApiKeyInput.errors ?? []) + parse: (o: unknown): { right: ApiKeyInput } | { left: DefinedError[] } => { + if (ApiKeyInput.is(o)) { + return { right: o } } + return { left: (ApiKeyInput.errors ?? []) as DefinedError[] } }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -162,17 +181,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = ApiConsumer[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -180,13 +200,18 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetKeysByConsumerIdResponse = ApiKey[] export const GetKeysByConsumerIdResponse = { - validate: (await import('./schemas/get-keys-by-consumer-id-response.schema.js')) - .validate as ValidateFunction, + validate: GetKeysByConsumerIdResponseValidator as ValidateFunction, get schema() { return GetKeysByConsumerIdResponse.validate.schema }, @@ -194,9 +219,56 @@ export const GetKeysByConsumerIdResponse = { return GetKeysByConsumerIdResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetKeysByConsumerIdResponse => GetKeysByConsumerIdResponse.validate(o) === true, + parse: (o: unknown): { right: GetKeysByConsumerIdResponse } | { left: DefinedError[] } => { + if (GetKeysByConsumerIdResponse.is(o)) { + return { right: o } + } + return { left: (GetKeysByConsumerIdResponse.errors ?? []) as DefinedError[] } + }, +} as const + +/** + * A single change that needs to be made to a resource + */ +export interface PatchOperation { + /** + * The field from where a value should be moved, when using move + */ + from?: string | undefined + /** + * The change to perform + */ + op: 'ADD' | 'REPLACE' | 'REMOVE' | 'MOVE' + /** + * The field to perform the operation on + */ + path: string + /** + * The value of the field, can be null + */ + value?: unknown +} + +export type PatchRequest = PatchOperation[] + +export const PatchRequest = { + validate: PatchRequestValidator as ValidateFunction, + get schema() { + return PatchRequest.validate.schema + }, + get errors() { + return PatchRequest.validate.errors ?? undefined + }, + is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } + } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } + }, } as const -type Local0 = +type Permissions = | 'AUDIT_TRANSACTIONS' | 'VIEW_EXCHANGE_RATES' | 'CREATE_EXCHANGE_RATE' @@ -442,52 +514,10 @@ type Local0 = | 'VIEW_PROFIT_SHARING_GL_ACCOUNTS' | 'VIEW_PROFIT_SHARING_BRANCHES' -/** - * A single change that needs to be made to a resource - */ -export interface PatchOperation { - /** - * The field from where a value should be moved, when using move - */ - from?: string - /** - * The change to perform - */ - op: 'ADD' | 'REPLACE' | 'REMOVE' | 'MOVE' - /** - * The field to perform the operation on - */ - path: string - /** - * The value of the field, can be null - */ - value?: { - [k: string]: unknown | undefined - } -} - -export type PatchRequest = PatchOperation[] - -export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, - get schema() { - return PatchRequest.validate.schema - }, - get errors() { - return PatchRequest.validate.errors ?? undefined - }, - is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) - } - }, -} as const - export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -497,11 +527,11 @@ export interface RoleIdentifier { /** * The encoded key of the entity, generated automatically, globally unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the role, which can be generated and customized, but must be unique. */ - id?: string + id?: string | undefined } /** @@ -511,11 +541,11 @@ export interface SecretKey { /** * The secret key */ - secretKey?: string + secretKey?: string | undefined } export const SecretKey = { - validate: (await import('./schemas/secret-key.schema.js')).validate as ValidateFunction, + validate: SecretKeyValidator as ValidateFunction, get schema() { return SecretKey.validate.schema }, @@ -523,6 +553,12 @@ export const SecretKey = { return SecretKey.validate.errors ?? undefined }, is: (o: unknown): o is SecretKey => SecretKey.validate(o) === true, + parse: (o: unknown): { right: SecretKey } | { left: DefinedError[] } => { + if (SecretKey.is(o)) { + return { right: o } + } + return { left: (SecretKey.errors ?? []) as DefinedError[] } + }, } as const /** @@ -532,5 +568,5 @@ export interface UserManagedBranch { /** * The encoded key of the branch, it is automatically generated. */ - branchKey?: string + branchKey?: string | undefined } diff --git a/src/api-consumers/schemas/api-consumer.schema.js b/src/api-consumers/schemas/api-consumer.schema.js index caabe5a..68022d2 100644 --- a/src/api-consumers/schemas/api-consumer.schema.js +++ b/src/api-consumers/schemas/api-consumer.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";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":{"title":"access","$ref":"#/$defs/ApiConsumerAccessaf30"},"assignedBranchKey":{"type":"string","title":"assignedBranchKey","description":"The encoded key of the branch this API consumer is assigned to."},"creationDate":{"type":"string","title":"creationDate","description":"The date when the API consumer was created in UTC.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"id":{"type":"string","title":"id","description":"The ID of the API consumer."},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last time the API consumer was modified in UTC.","format":"date-time"},"name":{"type":"string","title":"name","description":"The API consumer name."},"role":{"title":"role","$ref":"#/$defs/RoleIdentifieraf30"},"transactionLimits":{"type":"object","title":"transactionLimits","description":"The API consumer transaction limits.","properties":{},"additionalProperties":{"type":"integer"}}},"required":["name"],"additionalProperties":true,"$defs":{"ApiConsumerAccessaf30":{"type":"object","title":"ApiConsumerAccessaf30","description":"Represents the API consumer permissions and access rights.","properties":{"administratorAccess":{"type":"boolean","title":"administratorAccess","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","title":"apiAccess","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","title":"canManageAllBranches","description":"`TRUE` if the API consumer permissions apply to all branches, `FALSE` if they only apply to specific branches."},"canManageEntitiesAssignedToOtherOfficers":{"type":"boolean","title":"canManageEntitiesAssignedToOtherOfficers","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","title":"creditOfficerAccess","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","title":"managedBranches","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/UserManagedBranchaf30"}},"permissions":{"type":"array","title":"permissions","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},"UserManagedBranchaf30":{"type":"object","title":"UserManagedBranchaf30","description":"Represents a branch that can be managed by the user or API consumer.","properties":{"branchKey":{"type":"string","title":"branchKey","description":"The encoded key of the branch, it is automatically generated."}},"additionalProperties":true},"RoleIdentifieraf30":{"type":"object","title":"RoleIdentifieraf30","description":"Represents the role identifier.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated automatically, globally unique."},"id":{"type":"string","title":"id","description":"The ID of the role, which can be generated and customized, but must be unique."}},"additionalProperties":true}}};const schema14 = {"type":"object","title":"RoleIdentifieraf30","description":"Represents the role identifier.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated automatically, globally unique."},"id":{"type":"string","title":"id","description":"The ID of the role, which can be generated and customized, but must be unique."}},"additionalProperties":true};const schema12 = {"type":"object","title":"ApiConsumerAccessaf30","description":"Represents the API consumer permissions and access rights.","properties":{"administratorAccess":{"type":"boolean","title":"administratorAccess","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","title":"apiAccess","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","title":"canManageAllBranches","description":"`TRUE` if the API consumer permissions apply to all branches, `FALSE` if they only apply to specific branches."},"canManageEntitiesAssignedToOtherOfficers":{"type":"boolean","title":"canManageEntitiesAssignedToOtherOfficers","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","title":"creditOfficerAccess","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","title":"managedBranches","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/UserManagedBranchaf30"}},"permissions":{"type":"array","title":"permissions","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","title":"UserManagedBranchaf30","description":"Represents a branch that can be managed by the user or API consumer.","properties":{"branchKey":{"type":"string","title":"branchKey","description":"The encoded key of the branch, it is automatically generated."}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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 100000000 || isNaN(data0)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000000},message:"must be <= 100000000"}];return false;}else {if(data0 < 0 || isNaN(data0)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];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 +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApiKeyInput","type":"object","description":"Represents an API key expiration time.","properties":{"expirationTime":{"type":"integer","description":"The time to live (TTL) for the API key in seconds.","minimum":0,"maximum":100000000}},"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.expirationTime !== undefined){let data0 = data.expirationTime;const _errs2 = errors;if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}if(errors === _errs2){if((typeof data0 == "number") && (isFinite(data0))){if(data0 > 100000000 || isNaN(data0)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000000},message:"must be <= 100000000"}];return false;}else {if(data0 < 0 || isNaN(data0)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];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/api-consumers/schemas/api-key.schema.js b/src/api-consumers/schemas/api-key.schema.js index d41d9e8..82b6993 100644 --- a/src/api-consumers/schemas/api-key.schema.js +++ b/src/api-consumers/schemas/api-key.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApiKey","type":"object","description":"Represents an API key of an API consumer.","properties":{"apiKey":{"type":"string","title":"apiKey","description":"A six character cleartext prefix of the API key. The prefix is not guaranteed to be unique. You must base any identification process on the API key ID, not the prefix."},"expirationTime":{"type":"integer","title":"expirationTime","description":"The time to live (TTL) for the API key in seconds.","maximum":100000000,"minimum":0},"id":{"type":"string","title":"id","description":"The API key ID. You must base any identification process on the the API key ID as it is guaranteed to be unique."}},"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.apiKey !== undefined){const _errs2 = errors;if(typeof data.apiKey !== "string"){validate10.errors = [{instancePath:instancePath+"/apiKey",schemaPath:"#/properties/apiKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.expirationTime !== undefined){let data1 = data.expirationTime;const _errs4 = errors;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}if(errors === _errs4){if((typeof data1 == "number") && (isFinite(data1))){if(data1 > 100000000 || isNaN(data1)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000000},message:"must be <= 100000000"}];return false;}else {if(data1 < 0 || isNaN(data1)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs6 = 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 = _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 +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApiKey","type":"object","description":"Represents an API key of an API consumer.","properties":{"apiKey":{"type":"string","description":"A six character cleartext prefix of the API key. The prefix is not guaranteed to be unique. You must base any identification process on the API key ID, not the prefix."},"expirationTime":{"type":"integer","description":"The time to live (TTL) for the API key in seconds.","minimum":0,"maximum":100000000},"id":{"type":"string","description":"The API key ID. You must base any identification process on the the API key ID as it is guaranteed to be unique."}},"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.apiKey !== undefined){const _errs2 = errors;if(typeof data.apiKey !== "string"){validate10.errors = [{instancePath:instancePath+"/apiKey",schemaPath:"#/properties/apiKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.expirationTime !== undefined){let data1 = data.expirationTime;const _errs4 = errors;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}if(errors === _errs4){if((typeof data1 == "number") && (isFinite(data1))){if(data1 > 100000000 || isNaN(data1)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000000},message:"must be <= 100000000"}];return false;}else {if(data1 < 0 || isNaN(data1)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs6 = 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 = _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/api-consumers/schemas/error-response.schema.js b/src/api-consumers/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/api-consumers/schemas/error-response.schema.js +++ b/src/api-consumers/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 100000000 || isNaN(data2)){validate10.errors = [{instancePath:instancePath+"/" + i0+"/expirationTime",schemaPath:"#/$defs/ApiKey/properties/expirationTime/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000000},message:"must be <= 100000000"}];return false;}else {if(data2 < 0 || isNaN(data2)){validate10.errors = [{instancePath:instancePath+"/" + i0+"/expirationTime",schemaPath:"#/$defs/ApiKey/properties/expirationTime/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}}}var valid2 = _errs7 === errors;}else {var valid2 = true;}if(valid2){if(data0.id !== undefined){const _errs9 = errors;if(typeof data0.id !== "string"){validate10.errors = [{instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/ApiKey/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs9 === errors;}else {var valid2 = true;}}}}else {validate10.errors = [{instancePath:instancePath+"/" + i0,schemaPath:"#/$defs/ApiKey/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs1 === errors;if(!valid0){break;}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"GetKeysByConsumerIdResponse","type":"array","items":{"$ref":"#/$defs/ApiKey"},"$defs":{"ApiKey":{"type":"object","description":"Represents an API key of an API consumer.","properties":{"apiKey":{"type":"string","description":"A six character cleartext prefix of the API key. The prefix is not guaranteed to be unique. You must base any identification process on the API key ID, not the prefix."},"expirationTime":{"type":"integer","description":"The time to live (TTL) for the API key in seconds.","minimum":0,"maximum":100000000},"id":{"type":"string","description":"The API key ID. You must base any identification process on the the API key ID as it is guaranteed to be unique."}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents an API key of an API consumer.","properties":{"apiKey":{"type":"string","description":"A six character cleartext prefix of the API key. The prefix is not guaranteed to be unique. You must base any identification process on the API key ID, not the prefix."},"expirationTime":{"type":"integer","description":"The time to live (TTL) for the API key in seconds.","minimum":0,"maximum":100000000},"id":{"type":"string","description":"The API key ID. You must base any identification process on the the API key ID as it is guaranteed to be unique."}},"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(Array.isArray(data)){var valid0 = true;const len0 = data.length;for(let i0=0; i0 100000000 || isNaN(data2)){validate10.errors = [{instancePath:instancePath+"/" + i0+"/expirationTime",schemaPath:"#/$defs/ApiKey/properties/expirationTime/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000000},message:"must be <= 100000000"}];return false;}else {if(data2 < 0 || isNaN(data2)){validate10.errors = [{instancePath:instancePath+"/" + i0+"/expirationTime",schemaPath:"#/$defs/ApiKey/properties/expirationTime/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}}}var valid2 = _errs7 === errors;}else {var valid2 = true;}if(valid2){if(data0.id !== undefined){const _errs9 = errors;if(typeof data0.id !== "string"){validate10.errors = [{instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/ApiKey/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs9 === errors;}else {var valid2 = true;}}}}else {validate10.errors = [{instancePath:instancePath+"/" + i0,schemaPath:"#/$defs/ApiKey/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs1 === errors;if(!valid0){break;}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}validate10.errors = vErrors;return errors === 0;};validate.schema=schema11; \ No newline at end of file diff --git a/src/api-consumers/schemas/patch-request.schema.js b/src/api-consumers/schemas/patch-request.schema.js index 6cc0292..cf72e82 100644 --- a/src/api-consumers/schemas/patch-request.schema.js +++ b/src/api-consumers/schemas/patch-request.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"patchRequest","type":"array","items":{"$ref":"#/$defs/PatchOperationaf30"},"$defs":{"PatchOperationaf30":{"type":"object","title":"PatchOperationaf30","description":"A single change that needs to be made to a resource","properties":{"from":{"type":"string","title":"from","description":"The field from where a value should be moved, when using move"},"op":{"title":"op","description":"The change to perform","enum":["ADD","REPLACE","REMOVE","MOVE"]},"path":{"type":"string","title":"path","description":"The field to perform the operation on"},"value":{"type":"object","title":"value","description":"The value of the field, can be null","additionalProperties":{}}},"required":["op","path"],"additionalProperties":true}}};const schema12 = {"type":"object","title":"PatchOperationaf30","description":"A single change that needs to be made to a resource","properties":{"from":{"type":"string","title":"from","description":"The field from where a value should be moved, when using move"},"op":{"title":"op","description":"The change to perform","enum":["ADD","REPLACE","REMOVE","MOVE"]},"path":{"type":"string","title":"path","description":"The field to perform the operation on"},"value":{"type":"object","title":"value","description":"The value of the field, can be null","additionalProperties":{}}},"required":["op","path"],"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(Array.isArray(data)){var valid0 = true;const len0 = data.length;for(let i0=0; i0 + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ApiKey, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`apikey/rotation`, { + this.buildClient(auth).post('apikey/rotation', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', @@ -66,45 +81,66 @@ export class MambuApiKeysRotation { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildSecretkeyClient(client: Got) { @@ -114,22 +150,50 @@ export class MambuApiKeysRotation { async (options) => { const secretkey = this.auth.secretkey const key = typeof secretkey === 'function' ? await secretkey() : secretkey - options.headers['secretkey'] = key + options.headers.secretkey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'secretkey') { - client = this.buildSecretkeyClient(client) + chosenClient = this.buildSecretkeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/api-keys-rotation/rest.type.ts b/src/api-keys-rotation/rest.type.ts index 895dabc..541fc0a 100644 --- a/src/api-keys-rotation/rest.type.ts +++ b/src/api-keys-rotation/rest.type.ts @@ -3,8 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ApiKeyRotationResultValidator } from './schemas/api-key-rotation-result.schema.js' +import { validate as ApiKeyValidator } from './schemas/api-key.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' /** * Represents an API key of an API consumer. @@ -13,19 +17,19 @@ export interface ApiKey { /** * A six character cleartext prefix of the API key. The prefix is not guaranteed to be unique. You must base any identification process on the API key ID, not the prefix. */ - apiKey?: string + apiKey?: string | undefined /** * The time to live (TTL) for the API key in seconds. */ - expirationTime?: number + expirationTime?: number | undefined /** * The API key ID. You must base any identification process on the the API key ID as it is guaranteed to be unique. */ - id?: string + id?: string | undefined } export const ApiKey = { - validate: (await import('./schemas/api-key.schema.js')).validate as ValidateFunction, + validate: ApiKeyValidator as ValidateFunction, get schema() { return ApiKey.validate.schema }, @@ -33,10 +37,11 @@ export const ApiKey = { return ApiKey.validate.errors ?? undefined }, is: (o: unknown): o is ApiKey => ApiKey.validate(o) === true, - assert: (o: unknown) => { - if (!ApiKey.validate(o)) { - throw new ValidationError(ApiKey.errors ?? []) + parse: (o: unknown): { right: ApiKey } | { left: DefinedError[] } => { + if (ApiKey.is(o)) { + return { right: o } } + return { left: (ApiKey.errors ?? []) as DefinedError[] } }, } as const @@ -47,19 +52,19 @@ export interface ApiKeyRotationResult { /** * The new API key created after rotating an existing API key. */ - apiKey?: string + apiKey?: string | undefined /** * The API key ID. You must base any identification process on the the API key ID as it is guaranteed to be unique. */ - id?: string + id?: string | undefined /** * The new secret key created after rotating an existing API key. */ - secretKey?: string + secretKey?: string | undefined } export const ApiKeyRotationResult = { - validate: (await import('./schemas/api-key-rotation-result.schema.js')).validate as ValidateFunction, + validate: ApiKeyRotationResultValidator as ValidateFunction, get schema() { return ApiKeyRotationResult.validate.schema }, @@ -67,14 +72,20 @@ export const ApiKeyRotationResult = { return ApiKeyRotationResult.validate.errors ?? undefined }, is: (o: unknown): o is ApiKeyRotationResult => ApiKeyRotationResult.validate(o) === true, + parse: (o: unknown): { right: ApiKeyRotationResult } | { left: DefinedError[] } => { + if (ApiKeyRotationResult.is(o)) { + return { right: o } + } + return { left: (ApiKeyRotationResult.errors ?? []) as DefinedError[] } + }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -82,15 +93,16 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/api-keys-rotation/schemas/api-key-rotation-result.schema.js b/src/api-keys-rotation/schemas/api-key-rotation-result.schema.js index 02b06a3..0c1c684 100644 --- a/src/api-keys-rotation/schemas/api-key-rotation-result.schema.js +++ b/src/api-keys-rotation/schemas/api-key-rotation-result.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApiKeyRotationResult","type":"object","description":"Represents the result of an API key rotation.","properties":{"apiKey":{"type":"string","title":"apiKey","description":"The new API key created after rotating an existing API key."},"id":{"type":"string","title":"id","description":"The API key ID. You must base any identification process on the the API key ID as it is guaranteed to be unique."},"secretKey":{"type":"string","title":"secretKey","description":"The new secret key created after rotating an existing API key."}},"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.apiKey !== undefined){const _errs2 = errors;if(typeof data.apiKey !== "string"){validate10.errors = [{instancePath:instancePath+"/apiKey",schemaPath:"#/properties/apiKey/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.secretKey !== undefined){const _errs6 = errors;if(typeof data.secretKey !== "string"){validate10.errors = [{instancePath:instancePath+"/secretKey",schemaPath:"#/properties/secretKey/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 +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApiKeyRotationResult","type":"object","description":"Represents the result of an API key rotation.","properties":{"apiKey":{"type":"string","description":"The new API key created after rotating an existing API key."},"id":{"type":"string","description":"The API key ID. You must base any identification process on the the API key ID as it is guaranteed to be unique."},"secretKey":{"type":"string","description":"The new secret key created after rotating an existing API key."}},"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.apiKey !== undefined){const _errs2 = errors;if(typeof data.apiKey !== "string"){validate10.errors = [{instancePath:instancePath+"/apiKey",schemaPath:"#/properties/apiKey/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.secretKey !== undefined){const _errs6 = errors;if(typeof data.secretKey !== "string"){validate10.errors = [{instancePath:instancePath+"/secretKey",schemaPath:"#/properties/secretKey/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/api-keys-rotation/schemas/api-key.schema.js b/src/api-keys-rotation/schemas/api-key.schema.js index d41d9e8..82b6993 100644 --- a/src/api-keys-rotation/schemas/api-key.schema.js +++ b/src/api-keys-rotation/schemas/api-key.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApiKey","type":"object","description":"Represents an API key of an API consumer.","properties":{"apiKey":{"type":"string","title":"apiKey","description":"A six character cleartext prefix of the API key. The prefix is not guaranteed to be unique. You must base any identification process on the API key ID, not the prefix."},"expirationTime":{"type":"integer","title":"expirationTime","description":"The time to live (TTL) for the API key in seconds.","maximum":100000000,"minimum":0},"id":{"type":"string","title":"id","description":"The API key ID. You must base any identification process on the the API key ID as it is guaranteed to be unique."}},"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.apiKey !== undefined){const _errs2 = errors;if(typeof data.apiKey !== "string"){validate10.errors = [{instancePath:instancePath+"/apiKey",schemaPath:"#/properties/apiKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.expirationTime !== undefined){let data1 = data.expirationTime;const _errs4 = errors;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}if(errors === _errs4){if((typeof data1 == "number") && (isFinite(data1))){if(data1 > 100000000 || isNaN(data1)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000000},message:"must be <= 100000000"}];return false;}else {if(data1 < 0 || isNaN(data1)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs6 = 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 = _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 +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ApiKey","type":"object","description":"Represents an API key of an API consumer.","properties":{"apiKey":{"type":"string","description":"A six character cleartext prefix of the API key. The prefix is not guaranteed to be unique. You must base any identification process on the API key ID, not the prefix."},"expirationTime":{"type":"integer","description":"The time to live (TTL) for the API key in seconds.","minimum":0,"maximum":100000000},"id":{"type":"string","description":"The API key ID. You must base any identification process on the the API key ID as it is guaranteed to be unique."}},"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.apiKey !== undefined){const _errs2 = errors;if(typeof data.apiKey !== "string"){validate10.errors = [{instancePath:instancePath+"/apiKey",schemaPath:"#/properties/apiKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.expirationTime !== undefined){let data1 = data.expirationTime;const _errs4 = errors;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}if(errors === _errs4){if((typeof data1 == "number") && (isFinite(data1))){if(data1 > 100000000 || isNaN(data1)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000000},message:"must be <= 100000000"}];return false;}else {if(data1 < 0 || isNaN(data1)){validate10.errors = [{instancePath:instancePath+"/expirationTime",schemaPath:"#/properties/expirationTime/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs6 = 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 = _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/api-keys-rotation/schemas/error-response.schema.js b/src/api-keys-rotation/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/api-keys-rotation/schemas/error-response.schema.js +++ b/src/api-keys-rotation/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`application/status`, { + this.buildClient(auth).get('application/status', { headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', }), @@ -57,40 +74,48 @@ export class MambuApplication { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -117,24 +142,52 @@ export class MambuApplication { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/application/rest.type.ts b/src/application/rest.type.ts index 9296b58..52f6d22 100644 --- a/src/application/rest.type.ts +++ b/src/application/rest.type.ts @@ -3,18 +3,21 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ApplicationStatusValidator } from './schemas/application-status.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' /** * Describes the application status regarding the data access */ export interface ApplicationStatus { - dataAccessState?: 'READ_ONLY_STATE' | 'WRITE_READ_STATE' + dataAccessState?: 'READ_ONLY_STATE' | 'WRITE_READ_STATE' | undefined } export const ApplicationStatus = { - validate: (await import('./schemas/application-status.schema.js')).validate as ValidateFunction, + validate: ApplicationStatusValidator as ValidateFunction, get schema() { return ApplicationStatus.validate.schema }, @@ -22,14 +25,20 @@ export const ApplicationStatus = { return ApplicationStatus.validate.errors ?? undefined }, is: (o: unknown): o is ApplicationStatus => ApplicationStatus.validate(o) === true, + parse: (o: unknown): { right: ApplicationStatus } | { left: DefinedError[] } => { + if (ApplicationStatus.is(o)) { + return { right: o } + } + return { left: (ApplicationStatus.errors ?? []) as DefinedError[] } + }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -37,15 +46,16 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/application/schemas/application-status.schema.js b/src/application/schemas/application-status.schema.js index 96d9c26..fc9771d 100644 --- a/src/application/schemas/application-status.schema.js +++ b/src/application/schemas/application-status.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";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":{"title":"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 +"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 diff --git a/src/application/schemas/error-response.schema.js b/src/application/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/application/schemas/error-response.schema.js +++ b/src/application/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/authorizationholds.yaml`, { + this.buildClient(auth).get('configuration/authorizationholds.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update authorization holds configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/authorizationholds.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/authorizationholds.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +166,52 @@ export class MambuAuthorizationHoldsConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/background-process/index.ts b/src/background-process/index.ts index fbce17f..abc8880 100644 --- a/src/background-process/index.ts +++ b/src/background-process/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuBackgroundProcess } from './rest.client.js' export * as backgroundProcess from './rest.type.js' diff --git a/src/background-process/rest.client.ts b/src/background-process/rest.client.ts index 0d8146c..a41ac3e 100644 --- a/src/background-process/rest.client.ts +++ b/src/background-process/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { BackgroundProcess, ErrorResponse } from './rest.type.js' /** @@ -46,12 +49,18 @@ export class MambuBackgroundProcess { /** * Get the latest manual or automatic end of day (EOD) process by specifying the type */ - public async getLatestByType({ + public getLatestByType({ query, auth = [['apiKey'], ['basic']], - }: { query?: { type?: string }; auth?: string[][] | string[] } = {}) { + }: { query?: { type?: string }; auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', BackgroundProcess> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`backgroundprocess/latest`, { + this.buildClient(auth).get('backgroundprocess/latest', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -60,22 +69,32 @@ export class MambuBackgroundProcess { 200: BackgroundProcess, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Cancel manual or automatic end of day (EOD) processes using the encoded key */ - public async update({ + public update({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: string - path: { encodedKey: string } - auth?: string[][] | string[] - }) { + }: { body: string; path: { encodedKey: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', BackgroundProcess> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse<'500', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404' | '500'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).put(`backgroundprocess/${path.encodedKey}`, { body: body, @@ -89,40 +108,48 @@ export class MambuBackgroundProcess { 403: ErrorResponse, 404: ErrorResponse, 500: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -149,24 +176,52 @@ export class MambuBackgroundProcess { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/background-process/rest.type.ts b/src/background-process/rest.type.ts index 82cd4b8..f522147 100644 --- a/src/background-process/rest.type.ts +++ b/src/background-process/rest.type.ts @@ -3,8 +3,11 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as BackgroundProcessValidator } from './schemas/background-process.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' /** * Represents details of the Background Process @@ -13,19 +16,19 @@ export interface BackgroundProcess { /** * When this process was created. Stored as Organization Time */ - creationDate?: string + creationDate?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * When this process was ended. Stored as Organization Time */ - endDate?: string + endDate?: string | undefined /** * When this process was started. Stored as Organization Time */ - startDate?: string + startDate?: string | undefined /** * The current status of this process */ @@ -41,14 +44,15 @@ export interface BackgroundProcess { | 'TRANSIENT_ERROR' | 'OVERRIDDEN' | 'RECOVERABLE_ERROR' + | undefined /** * The type of the background process */ - type?: 'CRON_JOBS' | 'MANUAL_CRON_JOBS_TRIGGER' + type?: 'CRON_JOBS' | 'MANUAL_CRON_JOBS_TRIGGER' | undefined } export const BackgroundProcess = { - validate: (await import('./schemas/background-process.schema.js')).validate as ValidateFunction, + validate: BackgroundProcessValidator as ValidateFunction, get schema() { return BackgroundProcess.validate.schema }, @@ -56,19 +60,20 @@ export const BackgroundProcess = { return BackgroundProcess.validate.errors ?? undefined }, is: (o: unknown): o is BackgroundProcess => BackgroundProcess.validate(o) === true, - assert: (o: unknown) => { - if (!BackgroundProcess.validate(o)) { - throw new ValidationError(BackgroundProcess.errors ?? []) + parse: (o: unknown): { right: BackgroundProcess } | { left: DefinedError[] } => { + if (BackgroundProcess.is(o)) { + return { right: o } } + return { left: (BackgroundProcess.errors ?? []) as DefinedError[] } }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -76,15 +81,16 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/background-process/schemas/background-process.schema.js b/src/background-process/schemas/background-process.schema.js index b0bee25..0976e39 100644 --- a/src/background-process/schemas/background-process.schema.js +++ b/src/background-process/schemas/background-process.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"BackgroundProcess","type":"object","description":"Represents details of the Background Process","properties":{"creationDate":{"type":"string","title":"creationDate","description":"When this process was created. Stored as Organization Time","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"endDate":{"type":"string","title":"endDate","description":"When this process was ended. Stored as Organization Time","format":"date-time"},"startDate":{"type":"string","title":"startDate","description":"When this process was started. Stored as Organization Time","format":"date-time"},"state":{"title":"state","description":"The current status of this process","enum":["QUEUED","IN_PROGRESS","COMPLETE","NOT_FOUND","CANCEL","TO_BE_CANCELED","TIMED_OUT","ERROR","TRANSIENT_ERROR","OVERRIDDEN","RECOVERABLE_ERROR"]},"type":{"title":"type","description":"The type of the background process","enum":["CRON_JOBS","MANUAL_CRON_JOBS_TRIGGER"]}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.creationDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){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 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = 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 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.endDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(!(typeof data.endDate === "string")){validate10.errors = [{instancePath:instancePath+"/endDate",schemaPath:"#/properties/endDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.startDate !== undefined){const _errs8 = errors;if(errors === _errs8){if(errors === _errs8){if(!(typeof data.startDate === "string")){validate10.errors = [{instancePath:instancePath+"/startDate",schemaPath:"#/properties/startDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.state !== undefined){const _errs10 = errors;let valid1;valid1 = false;for(const v0 of schema11.properties.state.enum){if(func0(data.state, v0)){valid1 = true;break;}}if(!valid1){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 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.type !== undefined){let data5 = data.type;const _errs11 = errors;if(!((data5 === "CRON_JOBS") || (data5 === "MANUAL_CRON_JOBS_TRIGGER"))){validate10.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/enum",keyword:"enum",params:{allowedValues: schema11.properties.type.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs11 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"BackgroundProcess","type":"object","description":"Represents details of the Background Process","properties":{"creationDate":{"type":"string","description":"When this process was created. Stored as Organization Time","format":"date-time"},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"endDate":{"type":"string","description":"When this process was ended. Stored as Organization Time","format":"date-time"},"startDate":{"type":"string","description":"When this process was started. Stored as Organization Time","format":"date-time"},"state":{"description":"The current status of this process","enum":["QUEUED","IN_PROGRESS","COMPLETE","NOT_FOUND","CANCEL","TO_BE_CANCELED","TIMED_OUT","ERROR","TRANSIENT_ERROR","OVERRIDDEN","RECOVERABLE_ERROR"]},"type":{"description":"The type of the background process","enum":["CRON_JOBS","MANUAL_CRON_JOBS_TRIGGER"]}},"additionalProperties":true};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];const func0 = require("ajv/dist/runtime/equal").default;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.creationDate !== undefined){let data0 = data.creationDate;const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(typeof data0 === "string"){if(!(formats0.validate(data0))){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/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"){validate10.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.endDate !== undefined){let data2 = data.endDate;const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(typeof data2 === "string"){if(!(formats0.validate(data2))){validate10.errors = [{instancePath:instancePath+"/endDate",schemaPath:"#/properties/endDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/endDate",schemaPath:"#/properties/endDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.startDate !== undefined){let data3 = data.startDate;const _errs8 = errors;if(errors === _errs8){if(errors === _errs8){if(typeof data3 === "string"){if(!(formats0.validate(data3))){validate10.errors = [{instancePath:instancePath+"/startDate",schemaPath:"#/properties/startDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/startDate",schemaPath:"#/properties/startDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.state !== undefined){const _errs10 = errors;let valid1;valid1 = false;for(const v0 of schema11.properties.state.enum){if(func0(data.state, v0)){valid1 = true;break;}}if(!valid1){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 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.type !== undefined){let data5 = data.type;const _errs11 = errors;if(!((data5 === "CRON_JOBS") || (data5 === "MANUAL_CRON_JOBS_TRIGGER"))){validate10.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/enum",keyword:"enum",params:{allowedValues: schema11.properties.type.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs11 === 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/background-process/schemas/error-response.schema.js b/src/background-process/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/background-process/schemas/error-response.schema.js +++ b/src/background-process/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'204', unknown> + | FailureResponse<'403', Problem, 'response:statuscode'> + | FailureResponse<'404', Problem, 'response:statuscode'> + | FailureResponse<'422', Problem, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '403' | '404' | '422'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CommitSubscriptionCursorsRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient().post(`subscriptions/${path.subscriptionId}/cursors`, { @@ -79,12 +99,12 @@ export class BaseMambuStreaming { }), { 200: CommitSubscriptionCursorsResponse200, - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 403: Problem, 404: Problem, 422: Problem, - } - ) + }, + ) as ReturnType } /** @@ -98,11 +118,25 @@ export class BaseMambuStreaming { * * - If this endpoint is invoked several times with the same key subscription properties in body (order of even_types is not important) - the subscription will be created only once and for all other calls it will just return the subscription that was already created. */ - public async createSubscription({ body, headers }: { body: Subscription; headers?: { apikey?: string } }) { - this.validateRequestBody(Subscription, body) + public createSubscription({ + body, + headers, + }: { body: Subscription; headers?: { apikey?: string } }): Promise< + | SuccessResponse<'200', Subscription> + | SuccessResponse<'201', Subscription> + | FailureResponse<'400', Problem, 'response:statuscode'> + | FailureResponse<'422', Problem, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '400' | '422'>, string, 'response:statuscode', IncomingHttpHeaders> + > { + const _body = this.validateRequestBody(Subscription, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient().post(`subscriptions`, { + this.buildClient().post('subscriptions', { json: body, headers: headers ?? {}, responseType: 'json', @@ -112,8 +146,8 @@ export class BaseMambuStreaming { 201: Subscription, 400: Problem, 422: Problem, - } - ) + }, + ) as ReturnType } /** @@ -129,23 +163,25 @@ export class BaseMambuStreaming { * * - In case the subscription is not needed anymore, it can be manually deleted by providing its unique subscription id. */ - public async deleteSubscriptionBySubscriptionId({ + public deleteSubscriptionBySubscriptionId({ path, headers, - }: { - path: { subscriptionId: string } - headers?: { apikey?: string } - }) { + }: { path: { subscriptionId: string }; headers?: { apikey?: string } }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'404', DeleteSubscriptionBySubscriptionIdResponse404, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '404'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( this.buildClient().delete(`subscriptions/${path.subscriptionId}`, { headers: headers ?? {}, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 404: DeleteSubscriptionBySubscriptionIdResponse404, - } - ) + }, + ) as ReturnType } /** @@ -171,9 +207,10 @@ export class BaseMambuStreaming { * - If you need more than one client for your subscription to distribute load or increase throughput - you can read the subscription with multiple clients and Mambu will automatically balance the load across them. * - Currently, the maximum number of supported clients per subscription is equal to the number of event types in the subscription multiplied by `3`. * - For example if there are two event types in the subscription, the total number of clients for the subscription is `6`. The total of all the partitions within a subscription cannot be more than `100`. This gives a maximum of `33` event types per subscription. + * - Recommendation: to improve throughput, maintain the same number of partitions and consumer clients from the start. This ensures a balanced distribution of the workload, minimises delays and simplifies rebalancing. * - The API provides a guarantee of at-least-once delivery, this means that there are cases where duplicate events may be sent if there are errors committing events - a useful technique to detect and handle duplicates is to be idempotent and to check the `eid` field of event metadata. */ - public async getSubscriptionEvents({ + public getSubscriptionEvents({ path, query, headers, @@ -188,8 +225,21 @@ export class BaseMambuStreaming { stream_keep_alive_limit?: string commit_timeout?: string } - headers?: { ['X-Flow-Id']?: string; apikey?: string } - }) { + headers?: { 'X-Flow-Id'?: string; apikey?: string } + }): Promise< + | SuccessResponse<'200', SubscriptionEventStreamBatch> + | FailureResponse<'400', Problem, 'response:statuscode'> + | FailureResponse<'403', Problem, 'response:statuscode'> + | FailureResponse<'404', Problem, 'response:statuscode'> + | FailureResponse<'409', Problem, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient().get(`subscriptions/${path.subscriptionId}/events`, { searchParams: query ?? {}, @@ -202,8 +252,8 @@ export class BaseMambuStreaming { 403: Problem, 404: Problem, 409: Problem, - } - ) + }, + ) as ReturnType } /** @@ -222,15 +272,16 @@ export class BaseMambuStreaming { * * The latest offset is compared with committed offset in order to calculate unconsumed events count for specific partition. */ - public async getSubscriptionStats({ + public getSubscriptionStats({ path, query, headers, - }: { - path: { subscriptionId: string } - query?: { show_time_lag?: string } - headers?: { apikey?: string } - }) { + }: { path: { subscriptionId: string }; query?: { show_time_lag?: string }; headers?: { apikey?: string } }): Promise< + | SuccessResponse<'200', GetSubscriptionStatsResponse> + | FailureResponse<'404', Problem, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '404'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( this.buildClient().get(`subscriptions/${path.subscriptionId}/stats`, { searchParams: query ?? {}, @@ -240,45 +291,66 @@ export class BaseMambuStreaming { { 200: GetSubscriptionStatsResponse, 404: Problem, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildApiKeyAuthClient(client: Got) { @@ -288,22 +360,50 @@ export class BaseMambuStreaming { async (options) => { const apiKeyAuth = this.auth.apiKeyAuth const key = typeof apiKeyAuth === 'function' ? await apiKeyAuth() : apiKeyAuth - options.headers['apikey'] = key + options.headers.apikey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'apiKeyAuth') { - client = this.buildApiKeyAuthClient(client) + chosenClient = this.buildApiKeyAuthClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/base-streaming.schema.ts b/src/base-streaming.schema.ts index 9f0c279..36f5dbc 100644 --- a/src/base-streaming.schema.ts +++ b/src/base-streaming.schema.ts @@ -1,12 +1,7 @@ import { cloneDeep, omitUndefined, pick } from '@skyleague/axioms' import { $restclient } from '@skyleague/therefore' import type { OpenapiV3 } from '@skyleague/therefore' -import type { - APIKeySecurityScheme, - Operation, - PathItem, - Schema, -} from '@skyleague/therefore/src/lib/primitives/restclient/openapi.type.js' +import type { APIKeySecurityScheme, Operation, PathItem, Schema } from '@skyleague/therefore/src/types/openapi.type.js' import got from 'got' export const baseMambuStreaming = got @@ -20,15 +15,15 @@ export const baseMambuStreaming = got for (const path of Object.values(data.paths)) { for (const [method, op] of Object.entries( - pick(path as PathItem, ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']) + pick(path as PathItem, ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']), )) { const operation = op as Operation if (operation.operationId === '"get-subscriptions-subscription_id-events') { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-dynamic-delete delete path[method] } else if (operation.operationId === 'post-subscriptions-subscription_id-cursors') { operation.operationId = 'commitSubscriptionCursors' } else { + // biome-ignore lint/performance/noDelete: This is necessary to remove the operationId delete operation.operationId } } @@ -36,6 +31,7 @@ export const baseMambuStreaming = got const schemas = data.components?.schemas if (schemas !== undefined) { + // biome-ignore lint/performance/noDelete: This is necessary delete ((schemas.Subscription as Schema).properties?.initial_cursors as Schema).minItems const eventProperties = (schemas.Event as Schema).properties @@ -63,7 +59,7 @@ export const baseMambuStreaming = got description: 'An opaque value defined by the server.', }, }, - required: [...(cursor.required ?? []), 'event_type', 'cursor_token'] as [string, ...string[]], + required: [...(cursor.required ?? []), 'event_type', 'cursor_token'] as unknown as [string, ...string[]], }) as Schema schemas['Subscription-Cursor-Without-Token'] = omitUndefined({ ...cloneDeep(cursor), @@ -77,7 +73,7 @@ export const baseMambuStreaming = got description: "The name of the event type this partition's events belong to.", }, }, - required: [...(cursor.required ?? []), 'cursor_token'] as [string, ...string[]], + required: [...(cursor.required ?? []), 'cursor_token'] as unknown as [string, ...string[]], }) as Schema } diff --git a/src/base-streaming.type.ts b/src/base-streaming.type.ts index cee5814..a2e7d7d 100644 --- a/src/base-streaming.type.ts +++ b/src/base-streaming.type.ts @@ -3,19 +3,26 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as CommitSubscriptionCursorsRequestValidator } from './schemas/commit-subscription-cursors-request.schema.js' +import { validate as CommitSubscriptionCursorsResponse200Validator } from './schemas/commit-subscription-cursors-response200.schema.js' +import { validate as DeleteSubscriptionBySubscriptionIdResponse404Validator } from './schemas/delete-subscription-by-subscription-id-response404.schema.js' +import { validate as GetSubscriptionStatsResponseValidator } from './schemas/get-subscription-stats-response.schema.js' +import { validate as ProblemValidator } from './schemas/problem.schema.js' +import { validate as SubscriptionEventStreamBatchValidator } from './schemas/subscription-event-stream-batch.schema.js' +import { validate as SubscriptionValidator } from './schemas/subscription.schema.js' export interface CommitSubscriptionCursorsRequest { /** * List of cursors that the consumer acknowledges to have successfully processed. */ - items: [CommitSubscriptionCursorsRequestItemsArray, ...CommitSubscriptionCursorsRequestItemsArray[]] + items: [Items, ...Items[]] } export const CommitSubscriptionCursorsRequest = { - validate: (await import('./schemas/commit-subscription-cursors-request.schema.js')) - .validate as ValidateFunction, + validate: CommitSubscriptionCursorsRequestValidator as ValidateFunction, get schema() { return CommitSubscriptionCursorsRequest.validate.schema }, @@ -23,47 +30,20 @@ export const CommitSubscriptionCursorsRequest = { return CommitSubscriptionCursorsRequest.validate.errors ?? undefined }, is: (o: unknown): o is CommitSubscriptionCursorsRequest => CommitSubscriptionCursorsRequest.validate(o) === true, - assert: (o: unknown) => { - if (!CommitSubscriptionCursorsRequest.validate(o)) { - throw new ValidationError(CommitSubscriptionCursorsRequest.errors ?? []) + parse: (o: unknown): { right: CommitSubscriptionCursorsRequest } | { left: DefinedError[] } => { + if (CommitSubscriptionCursorsRequest.is(o)) { + return { right: o } } + return { left: (CommitSubscriptionCursorsRequest.errors ?? []) as DefinedError[] } }, } as const -interface CommitSubscriptionCursorsRequestItemsArray { - /** - * An opaque value defined by the server. - */ - cursor_token: string - /** - * The name of the event type this partition's events belong to. - */ - event_type: string - /** - * Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. - * - * This applies in cases when you create new subscription or reset subscription offsets. - * - * Also for stream start offsets one can use two special values: - * - * - `begin` - read from the oldest available event. - * - * - `end` - read from the most recent offset. - */ - offset: string - /** - * Id of the partition pointed to by this cursor. - */ - partition: string -} - export interface CommitSubscriptionCursorsResponse200 { items: [CursorCommitResult, ...CursorCommitResult[]] } export const CommitSubscriptionCursorsResponse200 = { - validate: (await import('./schemas/commit-subscription-cursors-response200.schema.js')) - .validate as ValidateFunction, + validate: CommitSubscriptionCursorsResponse200Validator as ValidateFunction, get schema() { return CommitSubscriptionCursorsResponse200.validate.schema }, @@ -71,6 +51,12 @@ export const CommitSubscriptionCursorsResponse200 = { return CommitSubscriptionCursorsResponse200.validate.errors ?? undefined }, is: (o: unknown): o is CommitSubscriptionCursorsResponse200 => CommitSubscriptionCursorsResponse200.validate(o) === true, + parse: (o: unknown): { right: CommitSubscriptionCursorsResponse200 } | { left: DefinedError[] } => { + if (CommitSubscriptionCursorsResponse200.is(o)) { + return { right: o } + } + return { left: (CommitSubscriptionCursorsResponse200.errors ?? []) as DefinedError[] } + }, } as const /** @@ -100,8 +86,8 @@ export interface DeleteSubscriptionBySubscriptionIdResponse404 { } export const DeleteSubscriptionBySubscriptionIdResponse404 = { - validate: (await import('./schemas/delete-subscription-by-subscription-id-response404.schema.js')) - .validate as ValidateFunction, + validate: + DeleteSubscriptionBySubscriptionIdResponse404Validator as ValidateFunction, get schema() { return DeleteSubscriptionBySubscriptionIdResponse404.validate.schema }, @@ -110,17 +96,19 @@ export const DeleteSubscriptionBySubscriptionIdResponse404 = { }, is: (o: unknown): o is DeleteSubscriptionBySubscriptionIdResponse404 => DeleteSubscriptionBySubscriptionIdResponse404.validate(o) === true, + parse: (o: unknown): { right: DeleteSubscriptionBySubscriptionIdResponse404 } | { left: DefinedError[] } => { + if (DeleteSubscriptionBySubscriptionIdResponse404.is(o)) { + return { right: o } + } + return { left: (DeleteSubscriptionBySubscriptionIdResponse404.errors ?? []) as DefinedError[] } + }, } as const /** * Payload of an Event. Usually represents a status transition in a Business process. */ export interface Event { - body: - | string - | { - [k: string]: unknown | undefined - } + body: string | {} metadata: EventMetadata /** * Name of the notification template. @@ -162,8 +150,7 @@ export interface GetSubscriptionStatsResponse { } export const GetSubscriptionStatsResponse = { - validate: (await import('./schemas/get-subscription-stats-response.schema.js')) - .validate as ValidateFunction, + validate: GetSubscriptionStatsResponseValidator as ValidateFunction, get schema() { return GetSubscriptionStatsResponse.validate.schema }, @@ -171,8 +158,41 @@ export const GetSubscriptionStatsResponse = { return GetSubscriptionStatsResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetSubscriptionStatsResponse => GetSubscriptionStatsResponse.validate(o) === true, + parse: (o: unknown): { right: GetSubscriptionStatsResponse } | { left: DefinedError[] } => { + if (GetSubscriptionStatsResponse.is(o)) { + return { right: o } + } + return { left: (GetSubscriptionStatsResponse.errors ?? []) as DefinedError[] } + }, } as const +interface Items { + /** + * An opaque value defined by the server. + */ + cursor_token: string + /** + * The name of the event type this partition's events belong to. + */ + event_type: string + /** + * Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. + * + * This applies in cases when you create new subscription or reset subscription offsets. + * + * Also for stream start offsets one can use two special values: + * + * - `begin` - read from the oldest available event. + * + * - `end` - read from the most recent offset. + */ + offset: string + /** + * Id of the partition pointed to by this cursor. + */ + partition: string +} + /** * Statistics of partition within a subscription context. */ @@ -180,7 +200,7 @@ export interface PartitionStats { /** * Subscription consumer lag for this partition in seconds. Measured as the age of the oldest event of this partition that is not yet consumed within this subscription. */ - consumer_lag_seconds?: number + consumer_lag_seconds?: number | undefined /** * The partition id. */ @@ -207,11 +227,11 @@ export interface Problem { /** * A human readable explanation specific to this occurrence of the problem. */ - detail?: string + detail?: string | undefined /** * An absolute URI that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. */ - instance?: string + instance?: string | undefined /** * The HTTP status code generated by the origin server for this occurrence of the problem. */ @@ -227,7 +247,7 @@ export interface Problem { } export const Problem = { - validate: (await import('./schemas/problem.schema.js')).validate as ValidateFunction, + validate: ProblemValidator as ValidateFunction, get schema() { return Problem.validate.schema }, @@ -235,10 +255,11 @@ export const Problem = { return Problem.validate.errors ?? undefined }, is: (o: unknown): o is Problem => Problem.validate(o) === true, - assert: (o: unknown) => { - if (!Problem.validate(o)) { - throw new ValidationError(Problem.errors ?? []) + parse: (o: unknown): { right: Problem } | { left: DefinedError[] } => { + if (Problem.is(o)) { + return { right: o } } + return { left: (Problem.errors ?? []) as DefinedError[] } }, } as const @@ -247,9 +268,7 @@ export const Problem = { * * Clients should not parse this structure. */ -export interface StreamInfo { - [k: string]: unknown | undefined -} +export interface StreamInfo {} /** * Subscription is a high level consumption unit. Subscriptions allow applications to easily scale the number of clients by managing consumed event offsets and distributing load between instances. The key properties that identify a subscription are `owning_application`, `event_types` and `consumer_group`. It is not possible to have two different subscriptions with these properties being the same. @@ -258,11 +277,11 @@ export interface Subscription { /** * The value describing the use case of this subscription. In general that is an additional identifier used to differ subscriptions having the same `owning_application` and `event_types`. */ - consumer_group?: string + consumer_group?: string | undefined /** * Timestamp of creation of the subscription. This is generated by Mambu. It should not be specified when creating subscription and sending it may result in a client error. */ - created_at?: string + created_at?: string | undefined /** * EventTypes to subscribe to. The order is not important. Subscriptions that differ only by the order of EventTypes will be considered the same and will have the same id. The size of the `event_type`s list is limited by the total number of partitions within these event types. Default limit for partition count is `100`. */ @@ -270,11 +289,11 @@ export interface Subscription { /** * ID of subscription that was created. Is generated by Mambu, should not be specified when creating a subscription. */ - id?: string + id?: string | undefined /** * List of cursors to start reading from. This property is required when `read_from` = cursors. The `initial` cursors should cover all partitions of subscription. Clients will get events starting from next offset positions. */ - initial_cursors?: SubscriptionCursorWithoutToken[] + initial_cursors?: SubscriptionCursorWithoutToken[] | undefined /** * The id of application owning the subscription. */ @@ -282,15 +301,15 @@ export interface Subscription { /** * Position to start reading events from. Currently supported values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset. - `cursors` - read from cursors provided in initial_cursors property. Applied when the client starts reading from a subscription. */ - read_from?: string + read_from?: string | undefined /** * Timestamp of last update of the subscription. This is generated by Mambu. It should not be specified when creating subscription and sending it may result in a client error. Its initial value is same as `created_at`. */ - updated_at?: string + updated_at?: string | undefined } export const Subscription = { - validate: (await import('./schemas/subscription.schema.js')).validate as ValidateFunction, + validate: SubscriptionValidator as ValidateFunction, get schema() { return Subscription.validate.schema }, @@ -298,10 +317,11 @@ export const Subscription = { return Subscription.validate.errors ?? undefined }, is: (o: unknown): o is Subscription => Subscription.validate(o) === true, - assert: (o: unknown) => { - if (!Subscription.validate(o)) { - throw new ValidationError(Subscription.errors ?? []) + parse: (o: unknown): { right: Subscription } | { left: DefinedError[] } => { + if (Subscription.is(o)) { + return { right: o } } + return { left: (Subscription.errors ?? []) as DefinedError[] } }, } as const @@ -328,7 +348,7 @@ export interface SubscriptionCursorWithoutToken { /** * The name of the event type this partition's events belong to. */ - event_type?: string + event_type?: string | undefined /** * Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. This applies in cases when you create new subscription or reset subscription offsets. Also for stream start offsets one can use two special values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset. */ @@ -351,13 +371,12 @@ export interface SubscriptionEventStreamBatch { /** * [Payload of an Event. Usually represents a status transition in a Business process.] */ - events?: [Event, ...Event[]] - info?: StreamInfo + events?: [Event, ...Event[]] | undefined + info?: StreamInfo | undefined } export const SubscriptionEventStreamBatch = { - validate: (await import('./schemas/subscription-event-stream-batch.schema.js')) - .validate as ValidateFunction, + validate: SubscriptionEventStreamBatchValidator as ValidateFunction, get schema() { return SubscriptionEventStreamBatch.validate.schema }, @@ -365,6 +384,12 @@ export const SubscriptionEventStreamBatch = { return SubscriptionEventStreamBatch.validate.errors ?? undefined }, is: (o: unknown): o is SubscriptionEventStreamBatch => SubscriptionEventStreamBatch.validate(o) === true, + parse: (o: unknown): { right: SubscriptionEventStreamBatch } | { left: DefinedError[] } => { + if (SubscriptionEventStreamBatch.is(o)) { + return { right: o } + } + return { left: (SubscriptionEventStreamBatch.errors ?? []) as DefinedError[] } + }, } as const /** diff --git a/src/branches-configuration/index.ts b/src/branches-configuration/index.ts index cbd5e3e..9fe6c85 100644 --- a/src/branches-configuration/index.ts +++ b/src/branches-configuration/index.ts @@ -1 +1 @@ -export * from './rest.client.js' +export { MambuBranchesConfiguration } from './rest.client.js' diff --git a/src/branches-configuration/rest.client.ts b/src/branches-configuration/rest.client.ts index b99a24f..f0535fc 100644 --- a/src/branches-configuration/rest.client.ts +++ b/src/branches-configuration/rest.client.ts @@ -3,10 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' /** * configuration/branches.yaml @@ -45,69 +47,99 @@ export class MambuBranchesConfiguration { /** * Get branches configuration */ - public async get({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public get({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/branches.yaml`, { + this.buildClient(auth).get('configuration/branches.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update branch configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/branches.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/branches.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +166,52 @@ export class MambuBranchesConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/branches/index.ts b/src/branches/index.ts index f434f55..91e225f 100644 --- a/src/branches/index.ts +++ b/src/branches/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuBranches } from './rest.client.js' export * as branches from './rest.type.js' diff --git a/src/branches/rest.client.ts b/src/branches/rest.client.ts index d7bbf12..9942c3b 100644 --- a/src/branches/rest.client.ts +++ b/src/branches/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { Branch, ErrorResponse, GetAllResponse } from './rest.type.js' /** @@ -46,45 +49,70 @@ export class MambuBranches { /** * Create branch */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: Branch - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(Branch, body) + }: { body: Branch; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', Branch> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Branch, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`branches`, { + this.buildClient(auth).post('branches', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: Branch, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get branches */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string; sortBy?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`branches`, { + this.buildClient(auth).get('branches', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -94,22 +122,31 @@ export class MambuBranches { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get branch */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { branchId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { branchId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Branch> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`branches/${path.branchId}`, { searchParams: query ?? {}, @@ -122,45 +159,66 @@ export class MambuBranches { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -187,24 +245,52 @@ export class MambuBranches { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/branches/rest.type.ts b/src/branches/rest.type.ts index be8cfa7..5264ee6 100644 --- a/src/branches/rest.type.ts +++ b/src/branches/rest.type.ts @@ -3,8 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as BranchValidator } from './schemas/branch.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' /** * Represents an address. @@ -13,47 +17,47 @@ export interface Address { /** * The city for the address. */ - city?: string + city?: string | undefined /** * The country. */ - country?: string + country?: string | undefined /** * The address encoded key, which is unique and generated. */ - encodedKey?: string + encodedKey?: string | undefined /** * The index of this address in the list of addresses. */ - indexInList?: number + indexInList?: number | undefined /** * The GPS latitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -90 to +90. */ - latitude?: number + latitude?: number | undefined /** * The first line of the address. */ - line1?: string + line1?: string | undefined /** * The second line of the address. */ - line2?: string + line2?: string | undefined /** * The GPS longitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -180 to +180. */ - longitude?: number + longitude?: number | undefined /** * The address parent key indicating the object owning this address. For example: client, centre, or branch. */ - parentKey?: string + parentKey?: string | undefined /** * The post code. */ - postcode?: string + postcode?: string | undefined /** * The region for the address. */ - region?: string + region?: string | undefined } /** @@ -63,23 +67,23 @@ export interface Branch { /** * The list of branch addresses. */ - addresses?: Address[] + addresses?: Address[] | undefined /** * The list of branch holidays. */ - branchHolidays?: Holiday[] + branchHolidays?: Holiday[] | undefined /** * The creation date of the branch. */ - creationDate?: string + creationDate?: string | undefined /** * The branch email address. */ - emailAddress?: string + emailAddress?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The branch ID, which must be unique. */ @@ -87,7 +91,7 @@ export interface Branch { /** * The last date when the branch was modified. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The branch name. */ @@ -95,19 +99,19 @@ export interface Branch { /** * The notes or description attached to this object. */ - notes?: string + notes?: string | undefined /** * The branch phone number. */ - phoneNumber?: string + phoneNumber?: string | undefined /** * The branch state. */ - state?: 'ACTIVE' | 'INACTIVE' + state?: 'ACTIVE' | 'INACTIVE' | undefined } export const Branch = { - validate: (await import('./schemas/branch.schema.js')).validate as ValidateFunction, + validate: BranchValidator as ValidateFunction, get schema() { return Branch.validate.schema }, @@ -115,19 +119,20 @@ export const Branch = { return Branch.validate.errors ?? undefined }, is: (o: unknown): o is Branch => Branch.validate(o) === true, - assert: (o: unknown) => { - if (!Branch.validate(o)) { - throw new ValidationError(Branch.errors ?? []) + parse: (o: unknown): { right: Branch } | { left: DefinedError[] } => { + if (Branch.is(o)) { + return { right: o } } + return { left: (Branch.errors ?? []) as DefinedError[] } }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -135,17 +140,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = Branch[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -153,6 +159,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -162,31 +174,31 @@ export interface Holiday { /** * The date when the holiday was created. */ - creationDate?: string + creationDate?: string | undefined /** * The date the holiday takes place. */ - date?: string + date?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the holiday. */ - id?: number + id?: number | undefined /** * `TRUE` if a holiday is annually recurring, `FALSE` otherwise. */ - isAnnuallyRecurring?: boolean + isAnnuallyRecurring?: boolean | undefined /** * The name of the holiday. */ - name?: string + name?: string | undefined } export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/branches/schemas/branch.schema.js b/src/branches/schemas/branch.schema.js index ffcf0cf..a4ad0bf 100644 --- a/src/branches/schemas/branch.schema.js +++ b/src/branches/schemas/branch.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"Branch","type":"object","description":"Represents a branch.","properties":{"addresses":{"type":"array","title":"addresses","description":"The list of branch addresses.","items":{"$ref":"#/$defs/Addressaf30"}},"branchHolidays":{"type":"array","title":"branchHolidays","description":"The list of branch holidays.","items":{"$ref":"#/$defs/Holidayaf30"}},"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the branch.","format":"date-time"},"emailAddress":{"type":"string","title":"emailAddress","description":"The branch email address."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"id":{"type":"string","title":"id","description":"The branch ID, which must be unique."},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last date when the branch was modified.","format":"date-time"},"name":{"type":"string","title":"name","description":"The branch name."},"notes":{"type":"string","title":"notes","description":"The notes or description attached to this object."},"phoneNumber":{"type":"string","title":"phoneNumber","description":"The branch phone number."},"state":{"title":"state","description":"The branch state.","enum":["ACTIVE","INACTIVE"]}},"required":["id","name"],"additionalProperties":true,"$defs":{"Addressaf30":{"type":"object","title":"Addressaf30","description":"Represents an address.","properties":{"city":{"type":"string","title":"city","description":"The city for the address."},"country":{"type":"string","title":"country","description":"The country."},"encodedKey":{"type":"string","title":"encodedKey","description":"The address encoded key, which is unique and generated."},"indexInList":{"type":"integer","title":"indexInList","description":"The index of this address in the list of addresses."},"latitude":{"type":"number","title":"latitude","description":"The GPS latitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -90 to +90."},"line1":{"type":"string","title":"line1","description":"The first line of the address."},"line2":{"type":"string","title":"line2","description":"The second line of the address."},"longitude":{"type":"number","title":"longitude","description":"The GPS longitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -180 to +180."},"parentKey":{"type":"string","title":"parentKey","description":"The address parent key indicating the object owning this address. For example: client, centre, or branch."},"postcode":{"type":"string","title":"postcode","description":"The post code."},"region":{"type":"string","title":"region","description":"The region for the address."}},"additionalProperties":true},"Holidayaf30":{"type":"object","title":"Holidayaf30","description":"Represents the holiday.","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The date when the holiday was created.","format":"date-time"},"date":{"type":"string","title":"date","description":"The date the holiday takes place.","format":"date"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"id":{"type":"integer","title":"id","description":"The ID of the holiday."},"isAnnuallyRecurring":{"type":"boolean","title":"isAnnuallyRecurring","description":"`TRUE` if a holiday is annually recurring, `FALSE` otherwise."},"name":{"type":"string","title":"name","description":"The name of the holiday."}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"Addressaf30","description":"Represents an address.","properties":{"city":{"type":"string","title":"city","description":"The city for the address."},"country":{"type":"string","title":"country","description":"The country."},"encodedKey":{"type":"string","title":"encodedKey","description":"The address encoded key, which is unique and generated."},"indexInList":{"type":"integer","title":"indexInList","description":"The index of this address in the list of addresses."},"latitude":{"type":"number","title":"latitude","description":"The GPS latitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -90 to +90."},"line1":{"type":"string","title":"line1","description":"The first line of the address."},"line2":{"type":"string","title":"line2","description":"The second line of the address."},"longitude":{"type":"number","title":"longitude","description":"The GPS longitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -180 to +180."},"parentKey":{"type":"string","title":"parentKey","description":"The address parent key indicating the object owning this address. For example: client, centre, or branch."},"postcode":{"type":"string","title":"postcode","description":"The post code."},"region":{"type":"string","title":"region","description":"The region for the address."}},"additionalProperties":true};const schema13 = {"type":"object","title":"Holidayaf30","description":"Represents the holiday.","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The date when the holiday was created.","format":"date-time"},"date":{"type":"string","title":"date","description":"The date the holiday takes place.","format":"date"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"id":{"type":"integer","title":"id","description":"The ID of the holiday."},"isAnnuallyRecurring":{"type":"boolean","title":"isAnnuallyRecurring","description":"`TRUE` if a holiday is annually recurring, `FALSE` otherwise."},"name":{"type":"string","title":"name","description":"The name of the holiday."}},"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.id === undefined) && (missing0 = "id")) || ((data.name === undefined) && (missing0 = "name"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.addresses !== undefined){let data0 = data.addresses;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`bulks/${path.bulkProcessKey}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -63,40 +75,48 @@ export class MambuBulks { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -123,24 +143,52 @@ export class MambuBulks { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/bulks/rest.type.ts b/src/bulks/rest.type.ts index 62fcf05..e65aeef 100644 --- a/src/bulks/rest.type.ts +++ b/src/bulks/rest.type.ts @@ -3,8 +3,11 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as BulkProcessStatusValidator } from './schemas/bulk-process-status.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' /** * Holds information about the error encountered processing an item in bulk @@ -13,23 +16,23 @@ export interface BulkProcessingError { /** * Numeric value associated to the error reason */ - errorCode?: number + errorCode?: number | undefined /** * Error reason */ - errorReason?: string + errorReason?: string | undefined /** * Details about the error */ - errorSource?: string + errorSource?: string | undefined /** * Optional field populated only when request payload contains an externalId */ - externalId?: string + externalId?: string | undefined /** * The index of the entity/item from bulk request that failed on processing */ - indexInRequest?: number + indexInRequest?: number | undefined } /** @@ -39,15 +42,15 @@ export interface BulkProcessingSuccess { /** * Optional field populated only when request payload contains an externalId */ - externalId?: string + externalId?: string | undefined /** * Unique identifier for the newly created resource */ - id?: string + id?: string | undefined /** * The index of the entity/item from bulk request that failed on processing */ - indexInRequest?: number + indexInRequest?: number | undefined } /** @@ -57,11 +60,11 @@ export interface BulkProcessStatus { /** * List of errors */ - errors?: BulkProcessingError[] + errors?: BulkProcessingError[] | undefined /** * List of successful processed items */ - processedItems?: BulkProcessingSuccess[] + processedItems?: BulkProcessingSuccess[] | undefined /** * Bulk process status */ @@ -77,10 +80,11 @@ export interface BulkProcessStatus { | 'TRANSIENT_ERROR' | 'OVERRIDDEN' | 'RECOVERABLE_ERROR' + | undefined } export const BulkProcessStatus = { - validate: (await import('./schemas/bulk-process-status.schema.js')).validate as ValidateFunction, + validate: BulkProcessStatusValidator as ValidateFunction, get schema() { return BulkProcessStatus.validate.schema }, @@ -88,14 +92,20 @@ export const BulkProcessStatus = { return BulkProcessStatus.validate.errors ?? undefined }, is: (o: unknown): o is BulkProcessStatus => BulkProcessStatus.validate(o) === true, + parse: (o: unknown): { right: BulkProcessStatus } | { left: DefinedError[] } => { + if (BulkProcessStatus.is(o)) { + return { right: o } + } + return { left: (BulkProcessStatus.errors ?? []) as DefinedError[] } + }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -103,15 +113,16 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/bulks/schemas/bulk-process-status.schema.js b/src/bulks/schemas/bulk-process-status.schema.js index 5ee74a8..0b925d2 100644 --- a/src/bulks/schemas/bulk-process-status.schema.js +++ b/src/bulks/schemas/bulk-process-status.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"BulkProcessStatus","type":"object","description":"Holds information about the status of a bulk process","properties":{"errors":{"type":"array","title":"errors","description":"List of errors","items":{"$ref":"#/$defs/BulkProcessingErroraf30"}},"processedItems":{"type":"array","title":"processedItems","description":"List of successful processed items","items":{"$ref":"#/$defs/BulkProcessingSuccessaf30"}},"status":{"title":"status","description":"Bulk process status","enum":["QUEUED","IN_PROGRESS","COMPLETE","NOT_FOUND","CANCEL","TO_BE_CANCELED","TIMED_OUT","ERROR","TRANSIENT_ERROR","OVERRIDDEN","RECOVERABLE_ERROR"]}},"additionalProperties":true,"$defs":{"BulkProcessingErroraf30":{"type":"object","title":"BulkProcessingErroraf30","description":"Holds information about the error encountered processing an item in bulk","properties":{"errorCode":{"type":"integer","title":"errorCode","description":"Numeric value associated to the error reason"},"errorReason":{"type":"string","title":"errorReason","description":"Error reason"},"errorSource":{"type":"string","title":"errorSource","description":"Details about the error"},"externalId":{"type":"string","title":"externalId","description":"Optional field populated only when request payload contains an externalId"},"indexInRequest":{"type":"integer","title":"indexInRequest","description":"The index of the entity/item from bulk request that failed on processing"}},"additionalProperties":true},"BulkProcessingSuccessaf30":{"type":"object","title":"BulkProcessingSuccessaf30","description":"Holds details about successful processed item","properties":{"externalId":{"type":"string","title":"externalId","description":"Optional field populated only when request payload contains an externalId"},"id":{"type":"string","title":"id","description":"Unique identifier for the newly created resource"},"indexInRequest":{"type":"integer","title":"indexInRequest","description":"The index of the entity/item from bulk request that failed on processing"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"BulkProcessingErroraf30","description":"Holds information about the error encountered processing an item in bulk","properties":{"errorCode":{"type":"integer","title":"errorCode","description":"Numeric value associated to the error reason"},"errorReason":{"type":"string","title":"errorReason","description":"Error reason"},"errorSource":{"type":"string","title":"errorSource","description":"Details about the error"},"externalId":{"type":"string","title":"externalId","description":"Optional field populated only when request payload contains an externalId"},"indexInRequest":{"type":"integer","title":"indexInRequest","description":"The index of the entity/item from bulk request that failed on processing"}},"additionalProperties":true};const schema13 = {"type":"object","title":"BulkProcessingSuccessaf30","description":"Holds details about successful processed item","properties":{"externalId":{"type":"string","title":"externalId","description":"Optional field populated only when request payload contains an externalId"},"id":{"type":"string","title":"id","description":"Unique identifier for the newly created resource"},"indexInRequest":{"type":"integer","title":"indexInRequest","description":"The index of the entity/item from bulk request that failed on processing"}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'201', AuthorizationHold> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(AuthorizationHold, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`cards/${path.cardReferenceToken}/authorizationholds`, { @@ -77,21 +99,21 @@ export class MambuCards { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: AuthorizationHold, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create a financial transaction corresponding to a given card */ - public async createCardTransaction({ + public createCardTransaction({ body, path, headers, @@ -99,10 +121,29 @@ export class MambuCards { }: { body: CardTransactionInput path: { cardReferenceToken: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(CardTransactionInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', CardTransactionOutput> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CardTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`cards/${path.cardReferenceToken}/financialtransactions`, { @@ -111,21 +152,21 @@ export class MambuCards { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: CardTransactionOutput, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * 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 async decreaseAuthorizationHold({ + public decreaseAuthorizationHold({ body, path, headers, @@ -133,42 +174,70 @@ export class MambuCards { }: { body: AuthorizationHoldAmountAdjustmentRequest path: { cardReferenceToken: string; authorizationHoldExternalReferenceId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(AuthorizationHoldAmountAdjustmentRequest, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(AuthorizationHoldAmountAdjustmentRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post( `cards/${path.cardReferenceToken}/authorizationholds/${path.authorizationHoldExternalReferenceId}:decrease`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - } + headers: headers ?? {}, + responseType: 'text', + }, ), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get account balances using card tokens */ - public async getAccountBalances({ + public getAccountBalances({ path, auth = [['apiKey'], ['basic']], - }: { - path: { cardReferenceToken: string } - auth?: string[][] | string[] - }) { + }: { path: { cardReferenceToken: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', AccountBalances> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`cards/${path.cardReferenceToken}/balanceInquiry`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -179,27 +248,40 @@ export class MambuCards { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get card authorization hold */ - public async getAuthorizationHoldById({ + public getAuthorizationHoldById({ path, auth = [['apiKey'], ['basic']], }: { path: { cardReferenceToken: string; authorizationHoldExternalReferenceId: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetAuthorizationHold> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get( `cards/${path.cardReferenceToken}/authorizationholds/${path.authorizationHoldExternalReferenceId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', - } + }, ), { 200: GetAuthorizationHold, @@ -207,14 +289,14 @@ export class MambuCards { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get card transaction */ - public async getCardTransaction({ + public getCardTransaction({ path, query, auth = [['apiKey'], ['basic']], @@ -222,7 +304,20 @@ export class MambuCards { path: { cardReferenceToken: string; cardTransactionExternalReferenceId: string } query?: { detailsLevel?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetCardTransaction> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get( `cards/${path.cardReferenceToken}/financialtransactions/${path.cardTransactionExternalReferenceId}`, @@ -230,7 +325,7 @@ export class MambuCards { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', - } + }, ), { 200: GetCardTransaction, @@ -238,14 +333,14 @@ export class MambuCards { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Increase authorization hold amount */ - public async increaseAuthorizationHold({ + public increaseAuthorizationHold({ body, path, headers, @@ -253,36 +348,55 @@ export class MambuCards { }: { body: AuthorizationHoldAmountAdjustmentRequest path: { cardReferenceToken: string; authorizationHoldExternalReferenceId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(AuthorizationHoldAmountAdjustmentRequest, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(AuthorizationHoldAmountAdjustmentRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post( `cards/${path.cardReferenceToken}/authorizationholds/${path.authorizationHoldExternalReferenceId}:increase`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - } + headers: headers ?? {}, + responseType: 'text', + }, ), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update an authorization hold */ - public async patchAuthorizationHold({ + public patchAuthorizationHold({ body, path, headers, @@ -290,64 +404,95 @@ export class MambuCards { }: { body: PatchAuthorizationHoldRequest path: { cardReferenceToken: string; authorizationHoldExternalReferenceId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchAuthorizationHoldRequest, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchAuthorizationHoldRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch( `cards/${path.cardReferenceToken}/authorizationholds/${path.authorizationHoldExternalReferenceId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - } + headers: headers ?? {}, + responseType: 'text', + }, ), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Reverse a card authorization hold. */ - public async reverseAuthorizationHold({ + public reverseAuthorizationHold({ path, auth = [['apiKey'], ['basic']], }: { path: { cardReferenceToken: string; authorizationHoldExternalReferenceId: string } auth?: string[][] | string[] - }) { + }): Promise< + | 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, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete( `cards/${path.cardReferenceToken}/authorizationholds/${path.authorizationHoldExternalReferenceId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', - } + responseType: 'text', + }, ), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Reverse card transaction */ - public async reverseCardTransaction({ + public reverseCardTransaction({ body, path, headers, @@ -355,67 +500,107 @@ export class MambuCards { }: { body: CardTransactionReversal path: { cardReferenceToken: string; cardTransactionExternalReferenceId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(CardTransactionReversal, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CardTransactionReversal, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post( `cards/${path.cardReferenceToken}/financialtransactions/${path.cardTransactionExternalReferenceId}:decrease`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - } + headers: headers ?? {}, + responseType: 'text', + }, ), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -442,24 +627,52 @@ export class MambuCards { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/cards/rest.type.ts b/src/cards/rest.type.ts index b61481b..b16f083 100644 --- a/src/cards/rest.type.ts +++ b/src/cards/rest.type.ts @@ -3,8 +3,19 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as AccountBalancesValidator } from './schemas/account-balances.schema.js' +import { validate as AuthorizationHoldAmountAdjustmentRequestValidator } from './schemas/authorization-hold-amount-adjustment-request.schema.js' +import { validate as AuthorizationHoldValidator } from './schemas/authorization-hold.schema.js' +import { validate as CardTransactionInputValidator } from './schemas/card-transaction-input.schema.js' +import { validate as CardTransactionOutputValidator } from './schemas/card-transaction-output.schema.js' +import { validate as CardTransactionReversalValidator } from './schemas/card-transaction-reversal.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAuthorizationHoldValidator } from './schemas/get-authorization-hold.schema.js' +import { validate as GetCardTransactionValidator } from './schemas/get-card-transaction.schema.js' +import { validate as PatchAuthorizationHoldRequestValidator } from './schemas/patch-authorization-hold-request.schema.js' /** * Account balances presented to inquirer such as card processor @@ -13,31 +24,31 @@ export interface AccountBalances { /** * The unique account identifier */ - accountId?: string + accountId?: string | undefined /** * The available balance of a deposit or credit account */ - availableBalance?: number + availableBalance?: number | undefined /** * The card type either DEBIT or CREDIT */ - cardType?: 'DEBIT' | 'CREDIT' + cardType?: 'DEBIT' | 'CREDIT' | undefined /** * The overdraft limit of a deposit account or the loan amount in case of a credit account */ - creditLimit?: number + creditLimit?: number | undefined /** * Currency code used for the account */ - currencyCode?: string + currencyCode?: string | undefined /** * The current balance of a deposit account or principal balance of a revolving credit */ - totalBalance?: number + totalBalance?: number | undefined } export const AccountBalances = { - validate: (await import('./schemas/account-balances.schema.js')).validate as ValidateFunction, + validate: AccountBalancesValidator as ValidateFunction, get schema() { return AccountBalances.validate.schema }, @@ -45,6 +56,12 @@ export const AccountBalances = { return AccountBalances.validate.errors ?? undefined }, is: (o: unknown): o is AccountBalances => AccountBalances.validate(o) === true, + parse: (o: unknown): { right: AccountBalances } | { left: DefinedError[] } => { + if (AccountBalances.is(o)) { + return { right: o } + } + return { left: (AccountBalances.errors ?? []) as DefinedError[] } + }, } as const /** @@ -54,8 +71,8 @@ export interface AccountDetails { /** * The currency of the account */ - currency?: string - identification?: AccountIdentification + currency?: string | undefined + identification?: AccountIdentification | undefined } /** @@ -65,15 +82,15 @@ export interface AccountIdentification { /** * The account unique identifier */ - iban?: string - other?: OtherAccountIdentification + iban?: string | undefined + other?: OtherAccountIdentification | undefined } /** * The agent details for a party */ export interface Agent { - financialInstitutionIdentification?: FinancialInstitutionIdentification + financialInstitutionIdentification?: FinancialInstitutionIdentification | undefined } /** @@ -83,7 +100,7 @@ export interface AuthorizationHold { /** * The key of the account linked with the authorization hold. */ - accountKey?: string + accountKey?: string | undefined /** * Whether the given request should be accepted without balance validations. */ @@ -92,32 +109,32 @@ export interface AuthorizationHold { * The amount of money to be held as a result of the authorization hold request. */ amount: number - balances?: AccountBalances - cardAcceptor?: CardAcceptor + balances?: AccountBalances | undefined + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * The organization time when the authorization hold was created */ - creationDate?: string + creationDate?: string | undefined /** * Indicates whether the authorization hold amount is credited or debited.If not provided, the default values is DBIT. */ - creditDebitIndicator?: 'DBIT' | 'CRDT' + creditDebitIndicator?: 'DBIT' | 'CRDT' | undefined /** * The ISO currency code in which the hold was created. The amounts are stored in the base currency, but the user could have enter it in a foreign currency. */ - currencyCode?: string + currencyCode?: string | undefined /** * The custom expiration period for the hold which overwrites mcc and default expiration periods */ - customExpirationPeriod?: number + customExpirationPeriod?: number | undefined /** * The exchange rate for the original currency. */ - exchangeRate?: number + exchangeRate?: number | undefined /** * The external reference ID to be used to reference the account hold in subsequent requests. */ @@ -125,35 +142,35 @@ export interface AuthorizationHold { /** * The original amount of money to be held as a result of the authorization hold request. */ - originalAmount?: number + originalAmount?: number | undefined /** * The original currency in which the hold was created. */ - originalCurrency?: string + originalCurrency?: string | undefined /** * Indicates whether the authorization is partial or not */ - partial?: boolean + partial?: boolean | undefined /** * The date to consider as start date when calculating the number of days passed until expiration */ - referenceDateForExpiration?: string + referenceDateForExpiration?: string | undefined /** * Indicates the source of the authorization hold, the default values is CARD. */ - source?: 'CARD' | 'ACCOUNT' + source?: 'CARD' | 'ACCOUNT' | undefined /** * The authorization hold status. */ - status?: 'PENDING' | 'REVERSED' | 'SETTLED' | 'EXPIRED' + status?: 'PENDING' | 'REVERSED' | 'SETTLED' | 'EXPIRED' | undefined /** * The formatted time at which the user made this authorization hold. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } export const AuthorizationHold = { - validate: (await import('./schemas/authorization-hold.schema.js')).validate as ValidateFunction, + validate: AuthorizationHoldValidator as ValidateFunction, get schema() { return AuthorizationHold.validate.schema }, @@ -161,10 +178,11 @@ export const AuthorizationHold = { return AuthorizationHold.validate.errors ?? undefined }, is: (o: unknown): o is AuthorizationHold => AuthorizationHold.validate(o) === true, - assert: (o: unknown) => { - if (!AuthorizationHold.validate(o)) { - throw new ValidationError(AuthorizationHold.errors ?? []) + parse: (o: unknown): { right: AuthorizationHold } | { left: DefinedError[] } => { + if (AuthorizationHold.is(o)) { + return { right: o } } + return { left: (AuthorizationHold.errors ?? []) as DefinedError[] } }, } as const @@ -175,7 +193,7 @@ export interface AuthorizationHoldAmountAdjustmentRequest { /** * Whether the given request should be accepted without balance validations. */ - advice?: boolean + advice?: boolean | undefined /** * The amount of money to be subtracted/added to the authorization hold amount. For the decrease: if the amount is greater or equal to the authorization hold amount, then the authorization hold is reversed. */ @@ -183,20 +201,19 @@ export interface AuthorizationHoldAmountAdjustmentRequest { /** * The ISO currency code in which the hold was created. */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external reference ID of the decrease/increase request (not of the authorization hold). */ - externalReferenceId?: string + externalReferenceId?: string | undefined } export const AuthorizationHoldAmountAdjustmentRequest = { - validate: (await import('./schemas/authorization-hold-amount-adjustment-request.schema.js')) - .validate as ValidateFunction, + validate: AuthorizationHoldAmountAdjustmentRequestValidator as ValidateFunction, get schema() { return AuthorizationHoldAmountAdjustmentRequest.validate.schema }, @@ -205,10 +222,11 @@ export const AuthorizationHoldAmountAdjustmentRequest = { }, is: (o: unknown): o is AuthorizationHoldAmountAdjustmentRequest => AuthorizationHoldAmountAdjustmentRequest.validate(o) === true, - assert: (o: unknown) => { - if (!AuthorizationHoldAmountAdjustmentRequest.validate(o)) { - throw new ValidationError(AuthorizationHoldAmountAdjustmentRequest.errors ?? []) + parse: (o: unknown): { right: AuthorizationHoldAmountAdjustmentRequest } | { left: DefinedError[] } => { + if (AuthorizationHoldAmountAdjustmentRequest.is(o)) { + return { right: o } } + return { left: (AuthorizationHoldAmountAdjustmentRequest.errors ?? []) as DefinedError[] } }, } as const @@ -219,31 +237,31 @@ export interface CardAcceptor { /** * The city in which the card acceptor has the business. */ - city?: string + city?: string | undefined /** * The country in which the card acceptor has the business. */ - country?: string + country?: string | undefined /** * The Merchant Category Code of the card acceptor. */ - mcc?: number + mcc?: number | undefined /** * The name of the card acceptor. */ - name?: string + name?: string | undefined /** * The state in which the card acceptor has the business. */ - state?: string + state?: string | undefined /** * The street in which the card acceptor has the business. */ - street?: string + street?: string | undefined /** * The ZIP code of the location in which the card acceptor has the business. */ - zip?: string + zip?: string | undefined } /** @@ -258,23 +276,23 @@ export interface CardTransaction { * The amount of money to be withdrawn in the financial transaction. */ amount: number - cardAcceptor?: CardAcceptor + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * 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. */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external authorization hold reference ID, which relates this card transaction to a previous authorization hold. */ - externalAuthorizationReferenceId?: string + externalAuthorizationReferenceId?: string | undefined /** * The external reference ID to be used to reference the card transaction in subsequent requests. */ @@ -282,7 +300,7 @@ export interface CardTransaction { /** * The formatted time at which the user made this card transaction. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } /** @@ -297,27 +315,27 @@ export interface CardTransactionInput { * The amount of money to be withdrawn in the financial transaction. */ amount: number - cardAcceptor?: CardAcceptor + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * If present, indicates that the card transaction is a refund, and whether is credited or debited */ - creditDebitIndicator?: 'DBIT' | 'CRDT' + creditDebitIndicator?: 'DBIT' | 'CRDT' | undefined /** * 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. */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external authorization hold reference ID, which relates this card transaction to a previous authorization hold. */ - externalAuthorizationReferenceId?: string + externalAuthorizationReferenceId?: string | undefined /** * The external reference ID to be used to reference the card transaction in subsequent requests. */ @@ -325,15 +343,15 @@ export interface CardTransactionInput { /** * The date of the first repayment for the loan account (as Organization Time) */ - firstRepaymentDate?: string + firstRepaymentDate?: string | undefined /** * Increase available amount if needed */ - increaseAmountIfNeeded?: boolean + increaseAmountIfNeeded?: boolean | undefined /** * Whether the given request should be a partial clearing or not. */ - partial?: boolean + partial?: boolean | undefined /** * The ID of the channel through which the payment is done. */ @@ -341,11 +359,11 @@ export interface CardTransactionInput { /** * The formatted time at which the user made this card transaction. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } export const CardTransactionInput = { - validate: (await import('./schemas/card-transaction-input.schema.js')).validate as ValidateFunction, + validate: CardTransactionInputValidator as ValidateFunction, get schema() { return CardTransactionInput.validate.schema }, @@ -353,10 +371,11 @@ export const CardTransactionInput = { return CardTransactionInput.validate.errors ?? undefined }, is: (o: unknown): o is CardTransactionInput => CardTransactionInput.validate(o) === true, - assert: (o: unknown) => { - if (!CardTransactionInput.validate(o)) { - throw new ValidationError(CardTransactionInput.errors ?? []) + parse: (o: unknown): { right: CardTransactionInput } | { left: DefinedError[] } => { + if (CardTransactionInput.is(o)) { + return { right: o } } + return { left: (CardTransactionInput.errors ?? []) as DefinedError[] } }, } as const @@ -372,28 +391,28 @@ export interface CardTransactionOutput { * The amount of money to be withdrawn in the financial transaction. */ amount: number - balances?: AccountBalances - cardAcceptor?: CardAcceptor + balances?: AccountBalances | undefined + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * If present, indicates that the card transaction is a refund, and whether is credited or debited */ - creditDebitIndicator?: 'DBIT' | 'CRDT' + creditDebitIndicator?: 'DBIT' | 'CRDT' | undefined /** * 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. */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external authorization hold reference ID, which relates this card transaction to a previous authorization hold. */ - externalAuthorizationReferenceId?: string + externalAuthorizationReferenceId?: string | undefined /** * The external reference ID to be used to reference the card transaction in subsequent requests. */ @@ -401,16 +420,16 @@ export interface CardTransactionOutput { /** * The date of the first repayment for the loan account (as Organization Time) */ - firstRepaymentDate?: string + firstRepaymentDate?: string | undefined /** * Increase available amount if needed */ - increaseAmountIfNeeded?: boolean - linkedTransaction?: LinkedTransaction + increaseAmountIfNeeded?: boolean | undefined + linkedTransaction?: LinkedTransaction | undefined /** * Whether the given request should be a partial clearing or not. */ - partial?: boolean + partial?: boolean | undefined /** * The ID of the channel through which the payment is done. */ @@ -418,11 +437,11 @@ export interface CardTransactionOutput { /** * The formatted time at which the user made this card transaction. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } export const CardTransactionOutput = { - validate: (await import('./schemas/card-transaction-output.schema.js')).validate as ValidateFunction, + validate: CardTransactionOutputValidator as ValidateFunction, get schema() { return CardTransactionOutput.validate.schema }, @@ -430,6 +449,12 @@ export const CardTransactionOutput = { return CardTransactionOutput.validate.errors ?? undefined }, is: (o: unknown): o is CardTransactionOutput => CardTransactionOutput.validate(o) === true, + parse: (o: unknown): { right: CardTransactionOutput } | { left: DefinedError[] } => { + if (CardTransactionOutput.is(o)) { + return { right: o } + } + return { left: (CardTransactionOutput.errors ?? []) as DefinedError[] } + }, } as const /** @@ -443,11 +468,11 @@ export interface CardTransactionReversal { /** * 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. */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external reference ID to be used to reference the card reversal transaction in subsequent requests. */ @@ -455,16 +480,15 @@ export interface CardTransactionReversal { /** * The id of the Deposit Transaction */ - id?: number + id?: number | undefined /** * 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. */ - transactionChannelId?: string + transactionChannelId?: string | undefined } export const CardTransactionReversal = { - validate: (await import('./schemas/card-transaction-reversal.schema.js')) - .validate as ValidateFunction, + validate: CardTransactionReversalValidator as ValidateFunction, get schema() { return CardTransactionReversal.validate.schema }, @@ -472,10 +496,11 @@ export const CardTransactionReversal = { return CardTransactionReversal.validate.errors ?? undefined }, is: (o: unknown): o is CardTransactionReversal => CardTransactionReversal.validate(o) === true, - assert: (o: unknown) => { - if (!CardTransactionReversal.validate(o)) { - throw new ValidationError(CardTransactionReversal.errors ?? []) + parse: (o: unknown): { right: CardTransactionReversal } | { left: DefinedError[] } => { + if (CardTransactionReversal.is(o)) { + return { right: o } } + return { left: (CardTransactionReversal.errors ?? []) as DefinedError[] } }, } as const @@ -486,15 +511,15 @@ export interface CreditorReferenceInformation { /** * The reference information of the creditor's underlying documents */ - reference?: string + reference?: string | undefined /** * The entity that assigns the reference type */ - referenceIssuer?: string + referenceIssuer?: string | undefined /** * The type of creditor reference */ - referenceType?: string + referenceType?: string | undefined } /** @@ -504,39 +529,39 @@ export interface DepositAffectedAmounts { /** * Amount of fees involved in a transaction that affects an account with positive balance */ - feesAmount?: number + feesAmount?: number | undefined /** * In the case of an LOAN_FRACTION_BOUGHT this represent the fraction amount which was bought from another investor */ - fractionAmount?: number + fractionAmount?: number | undefined /** * Balance change amount involved in a transaction that affects an account with positive balance */ - fundsAmount?: number + fundsAmount?: number | undefined /** * Amount of interest involved in a transaction that affects an account with positive balance */ - interestAmount?: number + interestAmount?: number | undefined /** * The amount of money that was added/subtracted from the account by this transaction as overdraft */ - overdraftAmount?: number + overdraftAmount?: number | undefined /** * Fees amount involved in a transaction that affects an overdraft */ - overdraftFeesAmount?: number + overdraftFeesAmount?: number | undefined /** * Interest amount involved in a transaction that affects an overdraft */ - overdraftInterestAmount?: number + overdraftInterestAmount?: number | undefined /** * The amount of money that was added/subtracted from the account by this transaction as technical overdraft */ - technicalOverdraftAmount?: number + technicalOverdraftAmount?: number | undefined /** * The amount of money that was added/subtracted from the account by this transaction as technical overdraft interest */ - technicalOverdraftInterestAmount?: number + technicalOverdraftInterestAmount?: number | undefined } /** @@ -546,11 +571,11 @@ export interface DepositFee { /** * The amount of the fee that was applied/paid in the transaction for the given predefined fee. */ - amount?: number + amount?: number | undefined /** * The name of the predefined fee */ - name?: string + name?: string | undefined /** * The encoded key of the predefined fee, auto generated, unique */ @@ -558,11 +583,11 @@ export interface DepositFee { /** * The amount of the taxes on fee that was applied/paid in the transaction. */ - taxAmount?: number + taxAmount?: number | undefined /** * Shows the event that will trigger a fee */ - trigger?: 'MANUAL' | 'MONTHLY_FEE' | 'ARBITRARY' + trigger?: 'MANUAL' | 'MONTHLY_FEE' | 'ARBITRARY' | undefined } /** @@ -572,19 +597,19 @@ export interface DepositInterestAccruedAmounts { /** * The amount of positive interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - interestAccrued?: number + interestAccrued?: number | undefined /** * The amount of negative interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - negativeInterestAccrued?: number + negativeInterestAccrued?: number | undefined /** * The amount of overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - overdraftInterestAccrued?: number + overdraftInterestAccrued?: number | undefined /** * The amount of technical overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - technicalOverdraftInterestAccrued?: number + technicalOverdraftInterestAccrued?: number | undefined } /** @@ -594,11 +619,11 @@ export interface DepositOverdraftInterestSettings { /** * The value of the index interest rate set or changed in this transaction */ - indexInterestRate?: number + indexInterestRate?: number | undefined /** * The interest rate that was set or changed in this transaction. Used on product interest rate changes or interest tier switches */ - interestRate?: number + interestRate?: number | undefined } /** @@ -608,7 +633,7 @@ export interface DepositOverdraftSettings { /** * The overdraft limit that was set or changed in this transaction */ - overdraftLimit?: number + overdraftLimit?: number | undefined } /** @@ -618,16 +643,16 @@ export interface DepositTaxes { /** * The tax rate that was set or changed in this transaction */ - taxRate?: number + taxRate?: number | undefined } /** * The deposit transaction terms */ export interface DepositTerms { - interestSettings?: DepositTransactionInterestSettings - overdraftInterestSettings?: DepositOverdraftInterestSettings - overdraftSettings?: DepositOverdraftSettings + interestSettings?: DepositTransactionInterestSettings | undefined + overdraftInterestSettings?: DepositOverdraftInterestSettings | undefined + overdraftSettings?: DepositOverdraftSettings | undefined } /** @@ -637,7 +662,7 @@ export interface DepositTransactionBalances { /** * The running balance owed by deposit */ - totalBalance?: number + totalBalance?: number | undefined } /** @@ -647,19 +672,19 @@ export interface DepositTransactionInterestSettings { /** * The value of the index interest rate set or changed in this transaction */ - indexInterestRate?: number + indexInterestRate?: number | undefined /** * The interest rate for the deposit account */ - interestRate?: number + interestRate?: number | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -667,10 +692,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -681,7 +707,7 @@ export interface FinancialInstitutionIdentification { /** * Business identifier code */ - bic?: string + bic?: string | undefined } /** @@ -691,7 +717,7 @@ export interface GetAuthorizationHold { /** * The key of the account linked with the authorization hold. */ - accountKey?: string + accountKey?: string | undefined /** * Whether the given request should be accepted without balance validations. */ @@ -700,36 +726,36 @@ export interface GetAuthorizationHold { * The amount of money to be held as a result of the authorization hold request. */ amount: number - balances?: AccountBalances - cardAcceptor?: CardAcceptor + balances?: AccountBalances | undefined + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * The organization time when the authorization hold was created */ - creationDate?: string + creationDate?: string | undefined /** * Indicates whether the authorization hold amount is credited or debited.If not provided, the default values is DBIT. */ - creditDebitIndicator?: 'DBIT' | 'CRDT' + creditDebitIndicator?: 'DBIT' | 'CRDT' | undefined /** * The ISO currency code in which the hold was created. The amounts are stored in the base currency, but the user could have enter it in a foreign currency. */ - currencyCode?: string + currencyCode?: string | undefined /** * The custom expiration period for the hold which overwrites mcc and default expiration periods */ - customExpirationPeriod?: number + customExpirationPeriod?: number | undefined /** * The internal ID of the authorization hold, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The exchange rate for the original currency. */ - exchangeRate?: number + exchangeRate?: number | undefined /** * The external reference ID to be used to reference the account hold in subsequent requests. */ @@ -737,35 +763,35 @@ export interface GetAuthorizationHold { /** * The original amount of money to be held as a result of the authorization hold request. */ - originalAmount?: number + originalAmount?: number | undefined /** * The original currency in which the hold was created. */ - originalCurrency?: string + originalCurrency?: string | undefined /** * Indicates whether the authorization is partial or not */ - partial?: boolean + partial?: boolean | undefined /** * The date to consider as start date when calculating the number of days passed until expiration */ - referenceDateForExpiration?: string + referenceDateForExpiration?: string | undefined /** * Indicates the source of the authorization hold, the default values is CARD. */ - source?: 'CARD' | 'ACCOUNT' + source?: 'CARD' | 'ACCOUNT' | undefined /** * The authorization hold status. */ - status?: 'PENDING' | 'REVERSED' | 'SETTLED' | 'EXPIRED' + status?: 'PENDING' | 'REVERSED' | 'SETTLED' | 'EXPIRED' | undefined /** * The formatted time at which the user made this authorization hold. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } export const GetAuthorizationHold = { - validate: (await import('./schemas/get-authorization-hold.schema.js')).validate as ValidateFunction, + validate: GetAuthorizationHoldValidator as ValidateFunction, get schema() { return GetAuthorizationHold.validate.schema }, @@ -773,101 +799,107 @@ export const GetAuthorizationHold = { return GetAuthorizationHold.validate.errors ?? undefined }, is: (o: unknown): o is GetAuthorizationHold => GetAuthorizationHold.validate(o) === true, + parse: (o: unknown): { right: GetAuthorizationHold } | { left: DefinedError[] } => { + if (GetAuthorizationHold.is(o)) { + return { right: o } + } + return { left: (GetAuthorizationHold.errors ?? []) as DefinedError[] } + }, } as const /** * Details for retrieving a card financial transaction. */ export interface GetCardTransaction { - accountBalances?: DepositTransactionBalances + accountBalances?: DepositTransactionBalances | undefined /** * The key of the deposit transaction where the adjustment for this transaction was made (if any adjustment was involved) */ - adjustmentTransactionKey?: string - affectedAmounts?: DepositAffectedAmounts + adjustmentTransactionKey?: string | undefined + affectedAmounts?: DepositAffectedAmounts | undefined /** * How much was added/removed in account */ - amount?: number + amount?: number | undefined /** * The block fund id associated with the transaction */ - blockId?: string + blockId?: string | undefined /** * The date when corresponding JE is booked (as Organization Time) */ - bookingDate?: string + bookingDate?: string | undefined /** * The branch where the transaction was performed */ - branchKey?: string - cardTransaction?: CardTransaction + branchKey?: string | undefined + cardTransaction?: CardTransaction | undefined /** * Object containing all the associated reversal transactions. */ - cardTransactionReversals?: CardTransactionReversal[] + cardTransactionReversals?: CardTransactionReversal[] | undefined /** * The center where the transaction was performed */ - centreKey?: string + centreKey?: string | undefined /** * The date when this deposit transaction was created */ - creationDate?: string + creationDate?: string | undefined /** * The currency in which this transaction was posted */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the deposit transaction, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external id of the deposit transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * All the amounts that have been applied or paid within this transaction and involved predefined fees */ - fees?: DepositFee[] + fees?: DepositFee[] | undefined /** * The external id of an account authorization hold */ - holdExternalReferenceId?: string + holdExternalReferenceId?: string | undefined /** * The id of the deposit transaction, auto generated, unique */ - id?: string - interestAccruedAmounts?: DepositInterestAccruedAmounts + id?: string | undefined + interestAccruedAmounts?: DepositInterestAccruedAmounts | undefined /** * The migration event encoded key associated with this deposit account. If this account was imported, track which 'migration event' they came from */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * Extra notes about this deposit transaction */ - notes?: string + notes?: string | undefined /** * The encodedKey of the transaction that was adjusted as part of this one. Available only for adjustment transactions */ - originalTransactionKey?: string + originalTransactionKey?: string | undefined /** * The key of the parent deposit account */ - parentAccountKey?: string - paymentDetails?: PaymentDetails + parentAccountKey?: string | undefined + paymentDetails?: PaymentDetails | undefined /** * The payment order id of the deposit transaction, customizable */ - paymentOrderId?: string - taxes?: DepositTaxes - terms?: DepositTerms + paymentOrderId?: string | undefined + taxes?: DepositTaxes | undefined + terms?: DepositTerms | undefined /** * The till key associated with this transaction */ - tillKey?: string - transactionDetails?: TransactionDetails - transferDetails?: TransferDetails + tillKey?: string | undefined + transactionDetails?: TransactionDetails | undefined + transferDetails?: TransferDetails | undefined /** * The type of the deposit transaction */ @@ -905,18 +937,19 @@ export interface GetCardTransaction { | 'LOAN_FRACTION_SOLD' | 'LOAN_FRACTION_SOLD_ADJUSTMENT' | 'SEIZED_AMOUNT' + | undefined /** * The person that performed the transaction */ - userKey?: string + userKey?: string | undefined /** * Date of the entry (eg date of repayment or disbursal, etc.) (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } export const GetCardTransaction = { - validate: (await import('./schemas/get-card-transaction.schema.js')).validate as ValidateFunction, + validate: GetCardTransactionValidator as ValidateFunction, get schema() { return GetCardTransaction.validate.schema }, @@ -924,6 +957,12 @@ export const GetCardTransaction = { return GetCardTransaction.validate.errors ?? undefined }, is: (o: unknown): o is GetCardTransaction => GetCardTransaction.validate(o) === true, + parse: (o: unknown): { right: GetCardTransaction } | { left: DefinedError[] } => { + if (GetCardTransaction.is(o)) { + return { right: o } + } + return { left: (GetCardTransaction.errors ?? []) as DefinedError[] } + }, } as const /** @@ -933,11 +972,11 @@ export interface LinkedTransaction { /** * The encodedKey of the linked financial transaction. */ - linkedTransactionKey?: string + linkedTransactionKey?: string | undefined /** * The type of the linked transaction (Deposit / Loan). */ - linkedTransactionType?: 'LOAN' | 'DEPOSIT' + linkedTransactionType?: 'LOAN' | 'DEPOSIT' | undefined } /** @@ -947,11 +986,11 @@ export interface OtherAccountIdentification { /** * The identification of the payer/payee */ - identification?: string + identification?: string | undefined /** * The identification scheme */ - scheme?: string + scheme?: string | undefined } /** @@ -961,14 +1000,13 @@ export interface Party { /** * The name of the party */ - name?: string + name?: string | undefined } export type PatchAuthorizationHoldRequest = PatchOperation[] export const PatchAuthorizationHoldRequest = { - validate: (await import('./schemas/patch-authorization-hold-request.schema.js')) - .validate as ValidateFunction, + validate: PatchAuthorizationHoldRequestValidator as ValidateFunction, get schema() { return PatchAuthorizationHoldRequest.validate.schema }, @@ -976,10 +1014,11 @@ export const PatchAuthorizationHoldRequest = { return PatchAuthorizationHoldRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchAuthorizationHoldRequest => PatchAuthorizationHoldRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchAuthorizationHoldRequest.validate(o)) { - throw new ValidationError(PatchAuthorizationHoldRequest.errors ?? []) + parse: (o: unknown): { right: PatchAuthorizationHoldRequest } | { left: DefinedError[] } => { + if (PatchAuthorizationHoldRequest.is(o)) { + return { right: o } } + return { left: (PatchAuthorizationHoldRequest.errors ?? []) as DefinedError[] } }, } as const @@ -990,7 +1029,7 @@ export interface PatchOperation { /** * The field from where a value should be moved, when using move */ - from?: string + from?: string | undefined /** * The change to perform */ @@ -1002,24 +1041,22 @@ export interface PatchOperation { /** * The value of the field, can be null */ - value?: { - [k: string]: unknown | undefined - } + value?: unknown } /** * The payment information including account identification details */ export interface PaymentDetails { - creditor?: Party - creditorAccount?: AccountDetails - creditorAgent?: Agent - debtor?: Party - debtorAccount?: AccountDetails - debtorAgent?: Agent - paymentIdentification?: PaymentIdentification - paymentTypeInformation?: PaymentTypeInformation - remittanceInformation?: RemittanceInformation + creditor?: Party | undefined + creditorAccount?: AccountDetails | undefined + creditorAgent?: Agent | undefined + debtor?: Party | undefined + debtorAccount?: AccountDetails | undefined + debtorAgent?: Agent | undefined + paymentIdentification?: PaymentIdentification | undefined + paymentTypeInformation?: PaymentTypeInformation | undefined + remittanceInformation?: RemittanceInformation | undefined } /** @@ -1029,39 +1066,39 @@ export interface PaymentIdentification { /** * Identifier assigned by the initiating party to the transaction */ - endToEndIdentification?: string + endToEndIdentification?: string | undefined /** * Identifier of a payment instruction */ - instructionIdentification?: string + instructionIdentification?: string | undefined /** * Identifier unique for a period assigned by the first initiating party to the transaction */ - transactionIdentification?: string + transactionIdentification?: string | undefined } /** * The information specifying the type of transaction */ export interface PaymentTypeInformation { - serviceLevel?: ServiceLevel + serviceLevel?: ServiceLevel | undefined } /** * The information specifying the payment items that are intended to settle */ export interface RemittanceInformation { - structured?: Structured + structured?: Structured | undefined /** * Information supplied to match the items of the payment in an unstructured form */ - unstructured?: string + unstructured?: string | undefined } export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -1071,14 +1108,14 @@ export interface ServiceLevel { /** * The code for a pre-agreed service or level of service between the parties */ - code?: string + code?: string | undefined } /** * The information specifying the payment items that are intended to settle */ export interface Structured { - creditorReferenceInformation?: CreditorReferenceInformation + creditorReferenceInformation?: CreditorReferenceInformation | undefined } /** @@ -1088,11 +1125,11 @@ export interface TransactionDetails { /** * The id of the transaction channel associated with the transaction details. */ - transactionChannelId?: string + transactionChannelId?: string | undefined /** * The encoded key of the transaction channel associated with the transaction details. */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } /** @@ -1102,9 +1139,9 @@ export interface TransferDetails { /** * The key of the related deposit transaction */ - linkedDepositTransactionKey?: string + linkedDepositTransactionKey?: string | undefined /** * The key of the related loan transaction */ - linkedLoanTransactionKey?: string + linkedLoanTransactionKey?: string | undefined } diff --git a/src/cards/schemas/account-balances.schema.js b/src/cards/schemas/account-balances.schema.js index cbbcd54..bb6d95c 100644 --- a/src/cards/schemas/account-balances.schema.js +++ b/src/cards/schemas/account-balances.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AccountBalances","type":"object","description":"Account balances presented to inquirer such as card processor","properties":{"accountId":{"type":"string","title":"accountId","description":"The unique account identifier"},"availableBalance":{"type":"number","title":"availableBalance","description":"The available balance of a deposit or credit account"},"cardType":{"title":"cardType","description":"The card type either DEBIT or CREDIT","enum":["DEBIT","CREDIT"]},"creditLimit":{"type":"number","title":"creditLimit","description":"The overdraft limit of a deposit account or the loan amount in case of a credit account"},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code used for the account"},"totalBalance":{"type":"number","title":"totalBalance","description":"The current balance of a deposit account or principal balance of a revolving credit"}},"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.accountId !== undefined){const _errs2 = errors;if(typeof data.accountId !== "string"){validate10.errors = [{instancePath:instancePath+"/accountId",schemaPath:"#/properties/accountId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.availableBalance !== undefined){let data1 = data.availableBalance;const _errs4 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate10.errors = [{instancePath:instancePath+"/availableBalance",schemaPath:"#/properties/availableBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.cardType !== undefined){let data2 = data.cardType;const _errs6 = errors;if(!((data2 === "DEBIT") || (data2 === "CREDIT"))){validate10.errors = [{instancePath:instancePath+"/cardType",schemaPath:"#/properties/cardType/enum",keyword:"enum",params:{allowedValues: schema11.properties.cardType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.creditLimit !== undefined){let data3 = data.creditLimit;const _errs7 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate10.errors = [{instancePath:instancePath+"/creditLimit",schemaPath:"#/properties/creditLimit/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs7 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs9 = 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 = _errs9 === errors;}else {var valid0 = true;}if(valid0){if(data.totalBalance !== undefined){let data5 = data.totalBalance;const _errs11 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate10.errors = [{instancePath:instancePath+"/totalBalance",schemaPath:"#/properties/totalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs11 === 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 +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AccountBalances","type":"object","description":"Account balances presented to inquirer such as card processor","properties":{"accountId":{"type":"string","description":"The unique account identifier"},"availableBalance":{"type":"number","description":"The available balance of a deposit or credit account"},"cardType":{"description":"The card type either DEBIT or CREDIT","enum":["DEBIT","CREDIT"]},"creditLimit":{"type":"number","description":"The overdraft limit of a deposit account or the loan amount in case of a credit account"},"currencyCode":{"type":"string","description":"Currency code used for the account"},"totalBalance":{"type":"number","description":"The current balance of a deposit account or principal balance of a revolving credit"}},"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.accountId !== undefined){const _errs2 = errors;if(typeof data.accountId !== "string"){validate10.errors = [{instancePath:instancePath+"/accountId",schemaPath:"#/properties/accountId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.availableBalance !== undefined){let data1 = data.availableBalance;const _errs4 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate10.errors = [{instancePath:instancePath+"/availableBalance",schemaPath:"#/properties/availableBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.cardType !== undefined){let data2 = data.cardType;const _errs6 = errors;if(!((data2 === "DEBIT") || (data2 === "CREDIT"))){validate10.errors = [{instancePath:instancePath+"/cardType",schemaPath:"#/properties/cardType/enum",keyword:"enum",params:{allowedValues: schema11.properties.cardType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.creditLimit !== undefined){let data3 = data.creditLimit;const _errs7 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate10.errors = [{instancePath:instancePath+"/creditLimit",schemaPath:"#/properties/creditLimit/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs7 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs9 = 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 = _errs9 === errors;}else {var valid0 = true;}if(valid0){if(data.totalBalance !== undefined){let data5 = data.totalBalance;const _errs11 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate10.errors = [{instancePath:instancePath+"/totalBalance",schemaPath:"#/properties/totalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs11 === 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/cards/schemas/authorization-hold-amount-adjustment-request.schema.js b/src/cards/schemas/authorization-hold-amount-adjustment-request.schema.js index 730fcb5..40fd2d7 100644 --- a/src/cards/schemas/authorization-hold-amount-adjustment-request.schema.js +++ b/src/cards/schemas/authorization-hold-amount-adjustment-request.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AuthorizationHoldAmountAdjustmentRequest","type":"object","description":"A request to decrease/increase the amount of an authorization hold.","properties":{"advice":{"type":"boolean","title":"advice","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","title":"amount","description":"The amount of money to be subtracted/added to the authorization hold amount. For the decrease: if the amount is greater or equal to the authorization hold amount, then the authorization hold is reversed."},"currencyCode":{"type":"string","title":"currencyCode","description":"The ISO currency code in which the hold was created."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"externalReferenceId":{"type":"string","title":"externalReferenceId","description":"The external reference ID of the decrease/increase request (not of the authorization hold)."}},"required":["amount"],"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.amount === undefined) && (missing0 = "amount")){validate10.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"){validate10.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)))){validate10.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.currencyCode !== undefined){const _errs6 = 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 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = 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 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs10 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];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 +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AuthorizationHoldAmountAdjustmentRequest","type":"object","description":"A request to decrease/increase the amount of an authorization hold.","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 subtracted/added to the authorization hold amount. For the decrease: if the amount is greater or equal to the authorization hold amount, then the authorization hold is reversed."},"currencyCode":{"type":"string","description":"The ISO currency code in which the hold was created."},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"externalReferenceId":{"type":"string","description":"The external reference ID of the decrease/increase request (not of the authorization hold)."}},"required":["amount"],"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.amount === undefined) && (missing0 = "amount")){validate10.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"){validate10.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)))){validate10.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.currencyCode !== undefined){const _errs6 = 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 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs8 = 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 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs10 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];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/cards/schemas/authorization-hold.schema.js b/src/cards/schemas/authorization-hold.schema.js index f49e2bd..1ca893c 100644 --- a/src/cards/schemas/authorization-hold.schema.js +++ b/src/cards/schemas/authorization-hold.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AuthorizationHold","type":"object","description":"The authorization hold corresponding to a card token","properties":{"accountKey":{"type":"string","title":"accountKey","description":"The key of the account linked with the authorization hold."},"advice":{"type":"boolean","title":"advice","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","title":"amount","description":"The amount of money to be held as a result of the authorization hold request."},"balances":{"title":"balances","$ref":"#/$defs/AccountBalances"},"cardAcceptor":{"title":"cardAcceptor","$ref":"#/$defs/CardAcceptoraf30"},"cardToken":{"type":"string","title":"cardToken","description":"The reference token of the card."},"creationDate":{"type":"string","title":"creationDate","description":"The organization time when the authorization hold was created","format":"date-time"},"creditDebitIndicator":{"title":"creditDebitIndicator","description":"Indicates whether the authorization hold amount is credited or debited.If not provided, the default values is DBIT.","enum":["DBIT","CRDT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"The ISO currency code in which the hold was created. The amounts are stored in the base currency, but the user could have enter it in a foreign currency."},"customExpirationPeriod":{"type":"integer","title":"customExpirationPeriod","description":"The custom expiration period for the hold which overwrites mcc and default expiration periods"},"exchangeRate":{"type":"number","title":"exchangeRate","description":"The exchange rate for the original currency."},"externalReferenceId":{"type":"string","title":"externalReferenceId","description":"The external reference ID to be used to reference the account hold in subsequent requests."},"originalAmount":{"type":"number","title":"originalAmount","description":"The original amount of money to be held as a result of the authorization hold request."},"originalCurrency":{"type":"string","title":"originalCurrency","description":"The original currency in which the hold was created."},"partial":{"type":"boolean","title":"partial","description":"Indicates whether the authorization is partial or not"},"referenceDateForExpiration":{"type":"string","title":"referenceDateForExpiration","description":"The date to consider as start date when calculating the number of days passed until expiration","format":"date-time"},"source":{"title":"source","description":"Indicates the source of the authorization hold, the default values is CARD.","enum":["CARD","ACCOUNT"]},"status":{"title":"status","description":"The authorization hold status.","enum":["PENDING","REVERSED","SETTLED","EXPIRED"]},"userTransactionTime":{"type":"string","title":"userTransactionTime","description":"The formatted time at which the user made this authorization hold."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true,"$defs":{"AccountBalances":{"type":"object","title":"AccountBalances","description":"Account balances presented to inquirer such as card processor","properties":{"accountId":{"type":"string","title":"accountId","description":"The unique account identifier"},"availableBalance":{"type":"number","title":"availableBalance","description":"The available balance of a deposit or credit account"},"cardType":{"title":"cardType","description":"The card type either DEBIT or CREDIT","enum":["DEBIT","CREDIT"]},"creditLimit":{"type":"number","title":"creditLimit","description":"The overdraft limit of a deposit account or the loan amount in case of a credit account"},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code used for the account"},"totalBalance":{"type":"number","title":"totalBalance","description":"The current balance of a deposit account or principal balance of a revolving credit"}},"additionalProperties":true},"CardAcceptoraf30":{"type":"object","title":"CardAcceptoraf30","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","title":"city","description":"The city in which the card acceptor has the business."},"country":{"type":"string","title":"country","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","title":"mcc","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","title":"name","description":"The name of the card acceptor."},"state":{"type":"string","title":"state","description":"The state in which the card acceptor has the business."},"street":{"type":"string","title":"street","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","title":"zip","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"AccountBalances","description":"Account balances presented to inquirer such as card processor","properties":{"accountId":{"type":"string","title":"accountId","description":"The unique account identifier"},"availableBalance":{"type":"number","title":"availableBalance","description":"The available balance of a deposit or credit account"},"cardType":{"title":"cardType","description":"The card type either DEBIT or CREDIT","enum":["DEBIT","CREDIT"]},"creditLimit":{"type":"number","title":"creditLimit","description":"The overdraft limit of a deposit account or the loan amount in case of a credit account"},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code used for the account"},"totalBalance":{"type":"number","title":"totalBalance","description":"The current balance of a deposit account or principal balance of a revolving credit"}},"additionalProperties":true};const schema13 = {"type":"object","title":"CardAcceptoraf30","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","title":"city","description":"The city in which the card acceptor has the business."},"country":{"type":"string","title":"country","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","title":"mcc","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","title":"name","description":"The name of the card acceptor."},"state":{"type":"string","title":"state","description":"The state in which the card acceptor has the business."},"street":{"type":"string","title":"street","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","title":"zip","description":"The ZIP code of the location in which the card acceptor has the business."}},"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.advice === undefined) && (missing0 = "advice")) || ((data.amount === undefined) && (missing0 = "amount"))) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountKey !== undefined){const _errs2 = errors;if(typeof data.accountKey !== "string"){validate10.errors = [{instancePath:instancePath+"/accountKey",schemaPath:"#/properties/accountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.advice !== undefined){const _errs4 = errors;if(typeof data.advice !== "boolean"){validate10.errors = [{instancePath:instancePath+"/advice",schemaPath:"#/properties/advice/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data2 = data.amount;const _errs6 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate10.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.balances !== undefined){let data3 = data.balances;const _errs8 = errors;const _errs9 = errors;if(errors === _errs9){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){if(data3.accountId !== undefined){const _errs12 = errors;if(typeof data3.accountId !== "string"){validate10.errors = [{instancePath:instancePath+"/balances/accountId",schemaPath:"#/$defs/AccountBalances/properties/accountId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data3.availableBalance !== undefined){let data5 = data3.availableBalance;const _errs14 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate10.errors = [{instancePath:instancePath+"/balances/availableBalance",schemaPath:"#/$defs/AccountBalances/properties/availableBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data3.cardType !== undefined){let data6 = data3.cardType;const _errs16 = errors;if(!((data6 === "DEBIT") || (data6 === "CREDIT"))){validate10.errors = [{instancePath:instancePath+"/balances/cardType",schemaPath:"#/$defs/AccountBalances/properties/cardType/enum",keyword:"enum",params:{allowedValues: schema12.properties.cardType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}if(valid2){if(data3.creditLimit !== undefined){let data7 = data3.creditLimit;const _errs17 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate10.errors = [{instancePath:instancePath+"/balances/creditLimit",schemaPath:"#/$defs/AccountBalances/properties/creditLimit/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs17 === errors;}else {var valid2 = true;}if(valid2){if(data3.currencyCode !== undefined){const _errs19 = errors;if(typeof data3.currencyCode !== "string"){validate10.errors = [{instancePath:instancePath+"/balances/currencyCode",schemaPath:"#/$defs/AccountBalances/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data3.totalBalance !== undefined){let data9 = data3.totalBalance;const _errs21 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate10.errors = [{instancePath:instancePath+"/balances/totalBalance",schemaPath:"#/$defs/AccountBalances/properties/totalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs21 === errors;}else {var valid2 = true;}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/balances",schemaPath:"#/$defs/AccountBalances/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.cardAcceptor !== undefined){let data10 = data.cardAcceptor;const _errs23 = errors;const _errs24 = errors;if(errors === _errs24){if(data10 && typeof data10 == "object" && !Array.isArray(data10)){if(data10.city !== undefined){const _errs27 = errors;if(typeof data10.city !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptoraf30/properties/city/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs27 === errors;}else {var valid4 = true;}if(valid4){if(data10.country !== undefined){const _errs29 = errors;if(typeof data10.country !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptoraf30/properties/country/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs29 === errors;}else {var valid4 = true;}if(valid4){if(data10.mcc !== undefined){let data13 = data10.mcc;const _errs31 = errors;if(!(((typeof data13 == "number") && (!(data13 % 1) && !isNaN(data13))) && (isFinite(data13)))){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptoraf30/properties/mcc/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid4 = _errs31 === errors;}else {var valid4 = true;}if(valid4){if(data10.name !== undefined){const _errs33 = errors;if(typeof data10.name !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptoraf30/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs33 === errors;}else {var valid4 = true;}if(valid4){if(data10.state !== undefined){const _errs35 = errors;if(typeof data10.state !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptoraf30/properties/state/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs35 === errors;}else {var valid4 = true;}if(valid4){if(data10.street !== undefined){const _errs37 = errors;if(typeof data10.street !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptoraf30/properties/street/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs37 === errors;}else {var valid4 = true;}if(valid4){if(data10.zip !== undefined){const _errs39 = errors;if(typeof data10.zip !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptoraf30/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs39 === errors;}else {var valid4 = true;}}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptoraf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs23 === errors;}else {var valid0 = true;}if(valid0){if(data.cardToken !== undefined){const _errs41 = errors;if(typeof data.cardToken !== "string"){validate10.errors = [{instancePath:instancePath+"/cardToken",schemaPath:"#/properties/cardToken/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.creditDebitIndicator !== undefined){let data20 = data.creditDebitIndicator;const _errs45 = errors;if(!((data20 === "DBIT") || (data20 === "CRDT"))){validate10.errors = [{instancePath:instancePath+"/creditDebitIndicator",schemaPath:"#/properties/creditDebitIndicator/enum",keyword:"enum",params:{allowedValues: schema11.properties.creditDebitIndicator.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs45 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs46 = 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 = _errs46 === errors;}else {var valid0 = true;}if(valid0){if(data.customExpirationPeriod !== undefined){let data22 = data.customExpirationPeriod;const _errs48 = errors;if(!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))){validate10.errors = [{instancePath:instancePath+"/customExpirationPeriod",schemaPath:"#/properties/customExpirationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs48 === errors;}else {var valid0 = true;}if(valid0){if(data.exchangeRate !== undefined){let data23 = data.exchangeRate;const _errs50 = errors;if(!((typeof data23 == "number") && (isFinite(data23)))){validate10.errors = [{instancePath:instancePath+"/exchangeRate",schemaPath:"#/properties/exchangeRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs50 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs52 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs52 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data25 = data.originalAmount;const _errs54 = errors;if(!((typeof data25 == "number") && (isFinite(data25)))){validate10.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs54 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){const _errs56 = errors;if(typeof data.originalCurrency !== "string"){validate10.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/properties/originalCurrency/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs56 === errors;}else {var valid0 = true;}if(valid0){if(data.partial !== undefined){const _errs58 = errors;if(typeof data.partial !== "boolean"){validate10.errors = [{instancePath:instancePath+"/partial",schemaPath:"#/properties/partial/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs58 === errors;}else {var valid0 = true;}if(valid0){if(data.referenceDateForExpiration !== undefined){const _errs60 = errors;if(errors === _errs60){if(errors === _errs60){if(!(typeof data.referenceDateForExpiration === "string")){validate10.errors = [{instancePath:instancePath+"/referenceDateForExpiration",schemaPath:"#/properties/referenceDateForExpiration/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs60 === errors;}else {var valid0 = true;}if(valid0){if(data.source !== undefined){let data29 = data.source;const _errs62 = errors;if(!((data29 === "CARD") || (data29 === "ACCOUNT"))){validate10.errors = [{instancePath:instancePath+"/source",schemaPath:"#/properties/source/enum",keyword:"enum",params:{allowedValues: schema11.properties.source.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs62 === errors;}else {var valid0 = true;}if(valid0){if(data.status !== undefined){let data30 = data.status;const _errs63 = errors;if(!((((data30 === "PENDING") || (data30 === "REVERSED")) || (data30 === "SETTLED")) || (data30 === "EXPIRED"))){validate10.errors = [{instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema11.properties.status.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs63 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs64 = errors;if(typeof data.userTransactionTime !== "string"){validate10.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs64 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AuthorizationHold","type":"object","description":"The authorization hold corresponding to a card token","properties":{"accountKey":{"type":"string","description":"The key of the account linked with the authorization hold."},"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be held as a result of the authorization hold request."},"balances":{"$ref":"#/$defs/AccountBalances"},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"creationDate":{"type":"string","description":"The organization time when the authorization hold was created","format":"date-time"},"creditDebitIndicator":{"description":"Indicates whether the authorization hold amount is credited or debited.If not provided, the default values is DBIT.","enum":["DBIT","CRDT"]},"currencyCode":{"type":"string","description":"The ISO currency code in which the hold was created. The amounts are stored in the base currency, but the user could have enter it in a foreign currency."},"customExpirationPeriod":{"type":"integer","description":"The custom expiration period for the hold which overwrites mcc and default expiration periods"},"exchangeRate":{"type":"number","description":"The exchange rate for the original currency."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the account hold in subsequent requests."},"originalAmount":{"type":"number","description":"The original amount of money to be held as a result of the authorization hold request."},"originalCurrency":{"type":"string","description":"The original currency in which the hold was created."},"partial":{"type":"boolean","description":"Indicates whether the authorization is partial or not"},"referenceDateForExpiration":{"type":"string","description":"The date to consider as start date when calculating the number of days passed until expiration","format":"date-time"},"source":{"description":"Indicates the source of the authorization hold, the default values is CARD.","enum":["CARD","ACCOUNT"]},"status":{"description":"The authorization hold status.","enum":["PENDING","REVERSED","SETTLED","EXPIRED"]},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this authorization hold."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true,"$defs":{"AccountBalances":{"type":"object","description":"Account balances presented to inquirer such as card processor","properties":{"accountId":{"type":"string","description":"The unique account identifier"},"availableBalance":{"type":"number","description":"The available balance of a deposit or credit account"},"cardType":{"description":"The card type either DEBIT or CREDIT","enum":["DEBIT","CREDIT"]},"creditLimit":{"type":"number","description":"The overdraft limit of a deposit account or the loan amount in case of a credit account"},"currencyCode":{"type":"string","description":"Currency code used for the account"},"totalBalance":{"type":"number","description":"The current balance of a deposit account or principal balance of a revolving credit"}},"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}}};const schema12 = {"type":"object","description":"Account balances presented to inquirer such as card processor","properties":{"accountId":{"type":"string","description":"The unique account identifier"},"availableBalance":{"type":"number","description":"The available balance of a deposit or credit account"},"cardType":{"description":"The card type either DEBIT or CREDIT","enum":["DEBIT","CREDIT"]},"creditLimit":{"type":"number","description":"The overdraft limit of a deposit account or the loan amount in case of a credit account"},"currencyCode":{"type":"string","description":"Currency code used for the account"},"totalBalance":{"type":"number","description":"The current balance of a deposit account or principal balance of a revolving credit"}},"additionalProperties":true};const schema13 = {"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};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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.advice === undefined) && (missing0 = "advice")) || ((data.amount === undefined) && (missing0 = "amount"))) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountKey !== undefined){const _errs2 = errors;if(typeof data.accountKey !== "string"){validate10.errors = [{instancePath:instancePath+"/accountKey",schemaPath:"#/properties/accountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.advice !== undefined){const _errs4 = errors;if(typeof data.advice !== "boolean"){validate10.errors = [{instancePath:instancePath+"/advice",schemaPath:"#/properties/advice/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data2 = data.amount;const _errs6 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate10.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.balances !== undefined){let data3 = data.balances;const _errs8 = errors;const _errs9 = errors;if(errors === _errs9){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){if(data3.accountId !== undefined){const _errs12 = errors;if(typeof data3.accountId !== "string"){validate10.errors = [{instancePath:instancePath+"/balances/accountId",schemaPath:"#/$defs/AccountBalances/properties/accountId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data3.availableBalance !== undefined){let data5 = data3.availableBalance;const _errs14 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate10.errors = [{instancePath:instancePath+"/balances/availableBalance",schemaPath:"#/$defs/AccountBalances/properties/availableBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data3.cardType !== undefined){let data6 = data3.cardType;const _errs16 = errors;if(!((data6 === "DEBIT") || (data6 === "CREDIT"))){validate10.errors = [{instancePath:instancePath+"/balances/cardType",schemaPath:"#/$defs/AccountBalances/properties/cardType/enum",keyword:"enum",params:{allowedValues: schema12.properties.cardType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}if(valid2){if(data3.creditLimit !== undefined){let data7 = data3.creditLimit;const _errs17 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate10.errors = [{instancePath:instancePath+"/balances/creditLimit",schemaPath:"#/$defs/AccountBalances/properties/creditLimit/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs17 === errors;}else {var valid2 = true;}if(valid2){if(data3.currencyCode !== undefined){const _errs19 = errors;if(typeof data3.currencyCode !== "string"){validate10.errors = [{instancePath:instancePath+"/balances/currencyCode",schemaPath:"#/$defs/AccountBalances/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}if(valid2){if(data3.totalBalance !== undefined){let data9 = data3.totalBalance;const _errs21 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate10.errors = [{instancePath:instancePath+"/balances/totalBalance",schemaPath:"#/$defs/AccountBalances/properties/totalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs21 === errors;}else {var valid2 = true;}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/balances",schemaPath:"#/$defs/AccountBalances/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.cardAcceptor !== undefined){let data10 = data.cardAcceptor;const _errs23 = errors;const _errs24 = errors;if(errors === _errs24){if(data10 && typeof data10 == "object" && !Array.isArray(data10)){if(data10.city !== undefined){const _errs27 = errors;if(typeof data10.city !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptor/properties/city/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs27 === errors;}else {var valid4 = true;}if(valid4){if(data10.country !== undefined){const _errs29 = errors;if(typeof data10.country !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptor/properties/country/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs29 === errors;}else {var valid4 = true;}if(valid4){if(data10.mcc !== undefined){let data13 = data10.mcc;const _errs31 = errors;if(!(((typeof data13 == "number") && (!(data13 % 1) && !isNaN(data13))) && (isFinite(data13)))){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptor/properties/mcc/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid4 = _errs31 === errors;}else {var valid4 = true;}if(valid4){if(data10.name !== undefined){const _errs33 = errors;if(typeof data10.name !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptor/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs33 === errors;}else {var valid4 = true;}if(valid4){if(data10.state !== undefined){const _errs35 = errors;if(typeof data10.state !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptor/properties/state/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs35 === errors;}else {var valid4 = true;}if(valid4){if(data10.street !== undefined){const _errs37 = errors;if(typeof data10.street !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptor/properties/street/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs37 === errors;}else {var valid4 = true;}if(valid4){if(data10.zip !== undefined){const _errs39 = errors;if(typeof data10.zip !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptor/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs39 === errors;}else {var valid4 = true;}}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptor/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs23 === errors;}else {var valid0 = true;}if(valid0){if(data.cardToken !== undefined){const _errs41 = errors;if(typeof data.cardToken !== "string"){validate10.errors = [{instancePath:instancePath+"/cardToken",schemaPath:"#/properties/cardToken/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){let data19 = data.creationDate;const _errs43 = errors;if(errors === _errs43){if(errors === _errs43){if(typeof data19 === "string"){if(!(formats0.validate(data19))){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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.creditDebitIndicator !== undefined){let data20 = data.creditDebitIndicator;const _errs45 = errors;if(!((data20 === "DBIT") || (data20 === "CRDT"))){validate10.errors = [{instancePath:instancePath+"/creditDebitIndicator",schemaPath:"#/properties/creditDebitIndicator/enum",keyword:"enum",params:{allowedValues: schema11.properties.creditDebitIndicator.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs45 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs46 = 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 = _errs46 === errors;}else {var valid0 = true;}if(valid0){if(data.customExpirationPeriod !== undefined){let data22 = data.customExpirationPeriod;const _errs48 = errors;if(!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))){validate10.errors = [{instancePath:instancePath+"/customExpirationPeriod",schemaPath:"#/properties/customExpirationPeriod/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs48 === errors;}else {var valid0 = true;}if(valid0){if(data.exchangeRate !== undefined){let data23 = data.exchangeRate;const _errs50 = errors;if(!((typeof data23 == "number") && (isFinite(data23)))){validate10.errors = [{instancePath:instancePath+"/exchangeRate",schemaPath:"#/properties/exchangeRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs50 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs52 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs52 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data25 = data.originalAmount;const _errs54 = errors;if(!((typeof data25 == "number") && (isFinite(data25)))){validate10.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs54 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){const _errs56 = errors;if(typeof data.originalCurrency !== "string"){validate10.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/properties/originalCurrency/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs56 === errors;}else {var valid0 = true;}if(valid0){if(data.partial !== undefined){const _errs58 = errors;if(typeof data.partial !== "boolean"){validate10.errors = [{instancePath:instancePath+"/partial",schemaPath:"#/properties/partial/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs58 === errors;}else {var valid0 = true;}if(valid0){if(data.referenceDateForExpiration !== undefined){let data28 = data.referenceDateForExpiration;const _errs60 = errors;if(errors === _errs60){if(errors === _errs60){if(typeof data28 === "string"){if(!(formats0.validate(data28))){validate10.errors = [{instancePath:instancePath+"/referenceDateForExpiration",schemaPath:"#/properties/referenceDateForExpiration/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/referenceDateForExpiration",schemaPath:"#/properties/referenceDateForExpiration/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs60 === errors;}else {var valid0 = true;}if(valid0){if(data.source !== undefined){let data29 = data.source;const _errs62 = errors;if(!((data29 === "CARD") || (data29 === "ACCOUNT"))){validate10.errors = [{instancePath:instancePath+"/source",schemaPath:"#/properties/source/enum",keyword:"enum",params:{allowedValues: schema11.properties.source.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs62 === errors;}else {var valid0 = true;}if(valid0){if(data.status !== undefined){let data30 = data.status;const _errs63 = errors;if(!((((data30 === "PENDING") || (data30 === "REVERSED")) || (data30 === "SETTLED")) || (data30 === "EXPIRED"))){validate10.errors = [{instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema11.properties.status.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs63 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs64 = errors;if(typeof data.userTransactionTime !== "string"){validate10.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs64 === 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/cards/schemas/card-transaction-input.schema.js b/src/cards/schemas/card-transaction-input.schema.js index 4283ce1..a53f405 100644 --- a/src/cards/schemas/card-transaction-input.schema.js +++ b/src/cards/schemas/card-transaction-input.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CardTransactionInput","type":"object","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","title":"advice","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","title":"amount","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"title":"cardAcceptor","$ref":"#/$defs/CardAcceptoraf30"},"cardToken":{"type":"string","title":"cardToken","description":"The reference token of the card."},"creditDebitIndicator":{"title":"creditDebitIndicator","description":"If present, indicates that the card transaction is a refund, and whether is credited or debited","enum":["DBIT","CRDT"]},"currencyCode":{"type":"string","title":"currencyCode","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","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","title":"externalAuthorizationReferenceId","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","title":"externalReferenceId","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"firstRepaymentDate":{"type":"string","title":"firstRepaymentDate","description":"The date of the first repayment for the loan account (as Organization Time)","format":"date-time"},"increaseAmountIfNeeded":{"type":"boolean","title":"increaseAmountIfNeeded","description":"Increase available amount if needed"},"partial":{"type":"boolean","title":"partial","description":"Whether the given request should be a partial clearing or not."},"transactionChannelId":{"type":"string","title":"transactionChannelId","description":"The ID of the channel through which the payment is done."},"userTransactionTime":{"type":"string","title":"userTransactionTime","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId","transactionChannelId"],"additionalProperties":true,"$defs":{"CardAcceptoraf30":{"type":"object","title":"CardAcceptoraf30","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","title":"city","description":"The city in which the card acceptor has the business."},"country":{"type":"string","title":"country","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","title":"mcc","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","title":"name","description":"The name of the card acceptor."},"state":{"type":"string","title":"state","description":"The state in which the card acceptor has the business."},"street":{"type":"string","title":"street","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","title":"zip","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"CardAcceptoraf30","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","title":"city","description":"The city in which the card acceptor has the business."},"country":{"type":"string","title":"country","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","title":"mcc","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","title":"name","description":"The name of the card acceptor."},"state":{"type":"string","title":"state","description":"The state in which the card acceptor has the business."},"street":{"type":"string","title":"street","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","title":"zip","description":"The ZIP code of the location in which the card acceptor has the business."}},"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.advice === undefined) && (missing0 = "advice")) || ((data.amount === undefined) && (missing0 = "amount"))) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))) || ((data.transactionChannelId === undefined) && (missing0 = "transactionChannelId"))){validate10.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"){validate10.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)))){validate10.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"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptoraf30/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"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptoraf30/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)))){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptoraf30/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"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptoraf30/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"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptoraf30/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"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptoraf30/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"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptoraf30/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs22 === errors;}else {var valid2 = true;}}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptoraf30/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"){validate10.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.creditDebitIndicator !== undefined){let data11 = data.creditDebitIndicator;const _errs26 = errors;if(!((data11 === "DBIT") || (data11 === "CRDT"))){validate10.errors = [{instancePath:instancePath+"/creditDebitIndicator",schemaPath:"#/properties/creditDebitIndicator/enum",keyword:"enum",params:{allowedValues: schema11.properties.creditDebitIndicator.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs27 = 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 = _errs27 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs29 = 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 = _errs29 === errors;}else {var valid0 = true;}if(valid0){if(data.externalAuthorizationReferenceId !== undefined){const _errs31 = errors;if(typeof data.externalAuthorizationReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalAuthorizationReferenceId",schemaPath:"#/properties/externalAuthorizationReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs33 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs33 === errors;}else {var valid0 = true;}if(valid0){if(data.firstRepaymentDate !== undefined){const _errs35 = errors;if(errors === _errs35){if(errors === _errs35){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 = _errs35 === errors;}else {var valid0 = true;}if(valid0){if(data.increaseAmountIfNeeded !== undefined){const _errs37 = errors;if(typeof data.increaseAmountIfNeeded !== "boolean"){validate10.errors = [{instancePath:instancePath+"/increaseAmountIfNeeded",schemaPath:"#/properties/increaseAmountIfNeeded/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs37 === errors;}else {var valid0 = true;}if(valid0){if(data.partial !== undefined){const _errs39 = errors;if(typeof data.partial !== "boolean"){validate10.errors = [{instancePath:instancePath+"/partial",schemaPath:"#/properties/partial/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs39 === errors;}else {var valid0 = true;}if(valid0){if(data.transactionChannelId !== undefined){const _errs41 = errors;if(typeof data.transactionChannelId !== "string"){validate10.errors = [{instancePath:instancePath+"/transactionChannelId",schemaPath:"#/properties/transactionChannelId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs43 = errors;if(typeof data.userTransactionTime !== "string"){validate10.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs43 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CardTransactionInput","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."},"creditDebitIndicator":{"description":"If present, indicates that the card transaction is a refund, and whether is credited or debited","enum":["DBIT","CRDT"]},"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."},"firstRepaymentDate":{"type":"string","description":"The date of the first repayment for the loan account (as Organization Time)","format":"date-time"},"increaseAmountIfNeeded":{"type":"boolean","description":"Increase available amount if needed"},"partial":{"type":"boolean","description":"Whether the given request should be a partial clearing or not."},"transactionChannelId":{"type":"string","description":"The ID of the channel through which the payment is done."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId","transactionChannelId"],"additionalProperties":true,"$defs":{"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}}};const schema12 = {"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};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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.advice === undefined) && (missing0 = "advice")) || ((data.amount === undefined) && (missing0 = "amount"))) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))) || ((data.transactionChannelId === undefined) && (missing0 = "transactionChannelId"))){validate10.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"){validate10.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)))){validate10.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"){validate10.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"){validate10.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)))){validate10.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"){validate10.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"){validate10.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"){validate10.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"){validate10.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 {validate10.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"){validate10.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.creditDebitIndicator !== undefined){let data11 = data.creditDebitIndicator;const _errs26 = errors;if(!((data11 === "DBIT") || (data11 === "CRDT"))){validate10.errors = [{instancePath:instancePath+"/creditDebitIndicator",schemaPath:"#/properties/creditDebitIndicator/enum",keyword:"enum",params:{allowedValues: schema11.properties.creditDebitIndicator.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs27 = 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 = _errs27 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs29 = 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 = _errs29 === errors;}else {var valid0 = true;}if(valid0){if(data.externalAuthorizationReferenceId !== undefined){const _errs31 = errors;if(typeof data.externalAuthorizationReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalAuthorizationReferenceId",schemaPath:"#/properties/externalAuthorizationReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs33 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs33 === errors;}else {var valid0 = true;}if(valid0){if(data.firstRepaymentDate !== undefined){let data16 = data.firstRepaymentDate;const _errs35 = errors;if(errors === _errs35){if(errors === _errs35){if(typeof data16 === "string"){if(!(formats0.validate(data16))){validate10.errors = [{instancePath:instancePath+"/firstRepaymentDate",schemaPath:"#/properties/firstRepaymentDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/firstRepaymentDate",schemaPath:"#/properties/firstRepaymentDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs35 === errors;}else {var valid0 = true;}if(valid0){if(data.increaseAmountIfNeeded !== undefined){const _errs37 = errors;if(typeof data.increaseAmountIfNeeded !== "boolean"){validate10.errors = [{instancePath:instancePath+"/increaseAmountIfNeeded",schemaPath:"#/properties/increaseAmountIfNeeded/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs37 === errors;}else {var valid0 = true;}if(valid0){if(data.partial !== undefined){const _errs39 = errors;if(typeof data.partial !== "boolean"){validate10.errors = [{instancePath:instancePath+"/partial",schemaPath:"#/properties/partial/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs39 === errors;}else {var valid0 = true;}if(valid0){if(data.transactionChannelId !== undefined){const _errs41 = errors;if(typeof data.transactionChannelId !== "string"){validate10.errors = [{instancePath:instancePath+"/transactionChannelId",schemaPath:"#/properties/transactionChannelId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs43 = errors;if(typeof data.userTransactionTime !== "string"){validate10.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs43 === 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/cards/schemas/card-transaction-output.schema.js b/src/cards/schemas/card-transaction-output.schema.js index 7e90ec9..83ae297 100644 --- a/src/cards/schemas/card-transaction-output.schema.js +++ b/src/cards/schemas/card-transaction-output.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CardTransactionOutput","type":"object","description":"A card transaction output after a financial transaction was performed.","properties":{"advice":{"type":"boolean","title":"advice","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","title":"amount","description":"The amount of money to be withdrawn in the financial transaction."},"balances":{"title":"balances","$ref":"#/$defs/AccountBalances"},"cardAcceptor":{"title":"cardAcceptor","$ref":"#/$defs/CardAcceptoraf30"},"cardToken":{"type":"string","title":"cardToken","description":"The reference token of the card."},"creditDebitIndicator":{"title":"creditDebitIndicator","description":"If present, indicates that the card transaction is a refund, and whether is credited or debited","enum":["DBIT","CRDT"]},"currencyCode":{"type":"string","title":"currencyCode","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","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","title":"externalAuthorizationReferenceId","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","title":"externalReferenceId","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"firstRepaymentDate":{"type":"string","title":"firstRepaymentDate","description":"The date of the first repayment for the loan account (as Organization Time)","format":"date-time"},"increaseAmountIfNeeded":{"type":"boolean","title":"increaseAmountIfNeeded","description":"Increase available amount if needed"},"linkedTransaction":{"title":"linkedTransaction","$ref":"#/$defs/LinkedTransactionaf30"},"partial":{"type":"boolean","title":"partial","description":"Whether the given request should be a partial clearing or not."},"transactionChannelId":{"type":"string","title":"transactionChannelId","description":"The ID of the channel through which the payment is done."},"userTransactionTime":{"type":"string","title":"userTransactionTime","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId","transactionChannelId"],"additionalProperties":true,"$defs":{"AccountBalances":{"type":"object","title":"AccountBalances","description":"Account balances presented to inquirer such as card processor","properties":{"accountId":{"type":"string","title":"accountId","description":"The unique account identifier"},"availableBalance":{"type":"number","title":"availableBalance","description":"The available balance of a deposit or credit account"},"cardType":{"title":"cardType","description":"The card type either DEBIT or CREDIT","enum":["DEBIT","CREDIT"]},"creditLimit":{"type":"number","title":"creditLimit","description":"The overdraft limit of a deposit account or the loan amount in case of a credit account"},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code used for the account"},"totalBalance":{"type":"number","title":"totalBalance","description":"The current balance of a deposit account or principal balance of a revolving credit"}},"additionalProperties":true},"CardAcceptoraf30":{"type":"object","title":"CardAcceptoraf30","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","title":"city","description":"The city in which the card acceptor has the business."},"country":{"type":"string","title":"country","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","title":"mcc","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","title":"name","description":"The name of the card acceptor."},"state":{"type":"string","title":"state","description":"The state in which the card acceptor has the business."},"street":{"type":"string","title":"street","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","title":"zip","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true},"LinkedTransactionaf30":{"type":"object","title":"LinkedTransactionaf30","description":"The details of the linked financial transaction triggered by the card transaction.","properties":{"linkedTransactionKey":{"type":"string","title":"linkedTransactionKey","description":"The encodedKey of the linked financial transaction."},"linkedTransactionType":{"title":"linkedTransactionType","description":"The type of the linked transaction (Deposit / Loan).","enum":["LOAN","DEPOSIT"]}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"AccountBalances","description":"Account balances presented to inquirer such as card processor","properties":{"accountId":{"type":"string","title":"accountId","description":"The unique account identifier"},"availableBalance":{"type":"number","title":"availableBalance","description":"The available balance of a deposit or credit account"},"cardType":{"title":"cardType","description":"The card type either DEBIT or CREDIT","enum":["DEBIT","CREDIT"]},"creditLimit":{"type":"number","title":"creditLimit","description":"The overdraft limit of a deposit account or the loan amount in case of a credit account"},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code used for the account"},"totalBalance":{"type":"number","title":"totalBalance","description":"The current balance of a deposit account or principal balance of a revolving credit"}},"additionalProperties":true};const schema13 = {"type":"object","title":"CardAcceptoraf30","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","title":"city","description":"The city in which the card acceptor has the business."},"country":{"type":"string","title":"country","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","title":"mcc","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","title":"name","description":"The name of the card acceptor."},"state":{"type":"string","title":"state","description":"The state in which the card acceptor has the business."},"street":{"type":"string","title":"street","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","title":"zip","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true};const schema14 = {"type":"object","title":"LinkedTransactionaf30","description":"The details of the linked financial transaction triggered by the card transaction.","properties":{"linkedTransactionKey":{"type":"string","title":"linkedTransactionKey","description":"The encodedKey of the linked financial transaction."},"linkedTransactionType":{"title":"linkedTransactionType","description":"The type of the linked transaction (Deposit / Loan).","enum":["LOAN","DEPOSIT"]}},"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.advice === undefined) && (missing0 = "advice")) || ((data.amount === undefined) && (missing0 = "amount"))) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))) || ((data.transactionChannelId === undefined) && (missing0 = "transactionChannelId"))){validate10.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"){validate10.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)))){validate10.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.balances !== undefined){let data2 = data.balances;const _errs6 = errors;const _errs7 = errors;if(errors === _errs7){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.accountId !== undefined){const _errs10 = errors;if(typeof data2.accountId !== "string"){validate10.errors = [{instancePath:instancePath+"/balances/accountId",schemaPath:"#/$defs/AccountBalances/properties/accountId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data2.availableBalance !== undefined){let data4 = data2.availableBalance;const _errs12 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/balances/availableBalance",schemaPath:"#/$defs/AccountBalances/properties/availableBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data2.cardType !== undefined){let data5 = data2.cardType;const _errs14 = errors;if(!((data5 === "DEBIT") || (data5 === "CREDIT"))){validate10.errors = [{instancePath:instancePath+"/balances/cardType",schemaPath:"#/$defs/AccountBalances/properties/cardType/enum",keyword:"enum",params:{allowedValues: schema12.properties.cardType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data2.creditLimit !== undefined){let data6 = data2.creditLimit;const _errs15 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate10.errors = [{instancePath:instancePath+"/balances/creditLimit",schemaPath:"#/$defs/AccountBalances/properties/creditLimit/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs15 === errors;}else {var valid2 = true;}if(valid2){if(data2.currencyCode !== undefined){const _errs17 = errors;if(typeof data2.currencyCode !== "string"){validate10.errors = [{instancePath:instancePath+"/balances/currencyCode",schemaPath:"#/$defs/AccountBalances/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs17 === errors;}else {var valid2 = true;}if(valid2){if(data2.totalBalance !== undefined){let data8 = data2.totalBalance;const _errs19 = errors;if(!((typeof data8 == "number") && (isFinite(data8)))){validate10.errors = [{instancePath:instancePath+"/balances/totalBalance",schemaPath:"#/$defs/AccountBalances/properties/totalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/balances",schemaPath:"#/$defs/AccountBalances/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.cardAcceptor !== undefined){let data9 = data.cardAcceptor;const _errs21 = errors;const _errs22 = errors;if(errors === _errs22){if(data9 && typeof data9 == "object" && !Array.isArray(data9)){if(data9.city !== undefined){const _errs25 = errors;if(typeof data9.city !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptoraf30/properties/city/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs25 === errors;}else {var valid4 = true;}if(valid4){if(data9.country !== undefined){const _errs27 = errors;if(typeof data9.country !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptoraf30/properties/country/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs27 === errors;}else {var valid4 = true;}if(valid4){if(data9.mcc !== undefined){let data12 = data9.mcc;const _errs29 = errors;if(!(((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12))) && (isFinite(data12)))){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptoraf30/properties/mcc/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid4 = _errs29 === errors;}else {var valid4 = true;}if(valid4){if(data9.name !== undefined){const _errs31 = errors;if(typeof data9.name !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptoraf30/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs31 === errors;}else {var valid4 = true;}if(valid4){if(data9.state !== undefined){const _errs33 = errors;if(typeof data9.state !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptoraf30/properties/state/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs33 === errors;}else {var valid4 = true;}if(valid4){if(data9.street !== undefined){const _errs35 = errors;if(typeof data9.street !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptoraf30/properties/street/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs35 === errors;}else {var valid4 = true;}if(valid4){if(data9.zip !== undefined){const _errs37 = errors;if(typeof data9.zip !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptoraf30/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs37 === errors;}else {var valid4 = true;}}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptoraf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs21 === errors;}else {var valid0 = true;}if(valid0){if(data.cardToken !== undefined){const _errs39 = errors;if(typeof data.cardToken !== "string"){validate10.errors = [{instancePath:instancePath+"/cardToken",schemaPath:"#/properties/cardToken/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs39 === errors;}else {var valid0 = true;}if(valid0){if(data.creditDebitIndicator !== undefined){let data18 = data.creditDebitIndicator;const _errs41 = errors;if(!((data18 === "DBIT") || (data18 === "CRDT"))){validate10.errors = [{instancePath:instancePath+"/creditDebitIndicator",schemaPath:"#/properties/creditDebitIndicator/enum",keyword:"enum",params:{allowedValues: schema11.properties.creditDebitIndicator.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs42 = 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 = _errs42 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs44 = 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 = _errs44 === errors;}else {var valid0 = true;}if(valid0){if(data.externalAuthorizationReferenceId !== undefined){const _errs46 = errors;if(typeof data.externalAuthorizationReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalAuthorizationReferenceId",schemaPath:"#/properties/externalAuthorizationReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs46 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs48 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs48 === errors;}else {var valid0 = true;}if(valid0){if(data.firstRepaymentDate !== undefined){const _errs50 = errors;if(errors === _errs50){if(errors === _errs50){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 = _errs50 === errors;}else {var valid0 = true;}if(valid0){if(data.increaseAmountIfNeeded !== undefined){const _errs52 = errors;if(typeof data.increaseAmountIfNeeded !== "boolean"){validate10.errors = [{instancePath:instancePath+"/increaseAmountIfNeeded",schemaPath:"#/properties/increaseAmountIfNeeded/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs52 === errors;}else {var valid0 = true;}if(valid0){if(data.linkedTransaction !== undefined){let data25 = data.linkedTransaction;const _errs54 = errors;const _errs55 = errors;if(errors === _errs55){if(data25 && typeof data25 == "object" && !Array.isArray(data25)){if(data25.linkedTransactionKey !== undefined){const _errs58 = errors;if(typeof data25.linkedTransactionKey !== "string"){validate10.errors = [{instancePath:instancePath+"/linkedTransaction/linkedTransactionKey",schemaPath:"#/$defs/LinkedTransactionaf30/properties/linkedTransactionKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs58 === errors;}else {var valid6 = true;}if(valid6){if(data25.linkedTransactionType !== undefined){let data27 = data25.linkedTransactionType;const _errs60 = errors;if(!((data27 === "LOAN") || (data27 === "DEPOSIT"))){validate10.errors = [{instancePath:instancePath+"/linkedTransaction/linkedTransactionType",schemaPath:"#/$defs/LinkedTransactionaf30/properties/linkedTransactionType/enum",keyword:"enum",params:{allowedValues: schema14.properties.linkedTransactionType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid6 = _errs60 === errors;}else {var valid6 = true;}}}else {validate10.errors = [{instancePath:instancePath+"/linkedTransaction",schemaPath:"#/$defs/LinkedTransactionaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs54 === errors;}else {var valid0 = true;}if(valid0){if(data.partial !== undefined){const _errs61 = errors;if(typeof data.partial !== "boolean"){validate10.errors = [{instancePath:instancePath+"/partial",schemaPath:"#/properties/partial/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs61 === errors;}else {var valid0 = true;}if(valid0){if(data.transactionChannelId !== undefined){const _errs63 = errors;if(typeof data.transactionChannelId !== "string"){validate10.errors = [{instancePath:instancePath+"/transactionChannelId",schemaPath:"#/properties/transactionChannelId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs63 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs65 = errors;if(typeof data.userTransactionTime !== "string"){validate10.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs65 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CardTransactionOutput","type":"object","description":"A card transaction output after a financial transaction was 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."},"balances":{"$ref":"#/$defs/AccountBalances"},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"creditDebitIndicator":{"description":"If present, indicates that the card transaction is a refund, and whether is credited or debited","enum":["DBIT","CRDT"]},"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."},"firstRepaymentDate":{"type":"string","description":"The date of the first repayment for the loan account (as Organization Time)","format":"date-time"},"increaseAmountIfNeeded":{"type":"boolean","description":"Increase available amount if needed"},"linkedTransaction":{"$ref":"#/$defs/LinkedTransaction"},"partial":{"type":"boolean","description":"Whether the given request should be a partial clearing or not."},"transactionChannelId":{"type":"string","description":"The ID of the channel through which the payment is done."},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId","transactionChannelId"],"additionalProperties":true,"$defs":{"AccountBalances":{"type":"object","description":"Account balances presented to inquirer such as card processor","properties":{"accountId":{"type":"string","description":"The unique account identifier"},"availableBalance":{"type":"number","description":"The available balance of a deposit or credit account"},"cardType":{"description":"The card type either DEBIT or CREDIT","enum":["DEBIT","CREDIT"]},"creditLimit":{"type":"number","description":"The overdraft limit of a deposit account or the loan amount in case of a credit account"},"currencyCode":{"type":"string","description":"Currency code used for the account"},"totalBalance":{"type":"number","description":"The current balance of a deposit account or principal balance of a revolving credit"}},"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},"LinkedTransaction":{"type":"object","description":"The details of the linked financial transaction triggered by the card transaction.","properties":{"linkedTransactionKey":{"type":"string","description":"The encodedKey of the linked financial transaction."},"linkedTransactionType":{"description":"The type of the linked transaction (Deposit / Loan).","enum":["LOAN","DEPOSIT"]}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Account balances presented to inquirer such as card processor","properties":{"accountId":{"type":"string","description":"The unique account identifier"},"availableBalance":{"type":"number","description":"The available balance of a deposit or credit account"},"cardType":{"description":"The card type either DEBIT or CREDIT","enum":["DEBIT","CREDIT"]},"creditLimit":{"type":"number","description":"The overdraft limit of a deposit account or the loan amount in case of a credit account"},"currencyCode":{"type":"string","description":"Currency code used for the account"},"totalBalance":{"type":"number","description":"The current balance of a deposit account or principal balance of a revolving credit"}},"additionalProperties":true};const schema13 = {"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};const schema14 = {"type":"object","description":"The details of the linked financial transaction triggered by the card transaction.","properties":{"linkedTransactionKey":{"type":"string","description":"The encodedKey of the linked financial transaction."},"linkedTransactionType":{"description":"The type of the linked transaction (Deposit / Loan).","enum":["LOAN","DEPOSIT"]}},"additionalProperties":true};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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.advice === undefined) && (missing0 = "advice")) || ((data.amount === undefined) && (missing0 = "amount"))) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))) || ((data.transactionChannelId === undefined) && (missing0 = "transactionChannelId"))){validate10.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"){validate10.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)))){validate10.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.balances !== undefined){let data2 = data.balances;const _errs6 = errors;const _errs7 = errors;if(errors === _errs7){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.accountId !== undefined){const _errs10 = errors;if(typeof data2.accountId !== "string"){validate10.errors = [{instancePath:instancePath+"/balances/accountId",schemaPath:"#/$defs/AccountBalances/properties/accountId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data2.availableBalance !== undefined){let data4 = data2.availableBalance;const _errs12 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/balances/availableBalance",schemaPath:"#/$defs/AccountBalances/properties/availableBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data2.cardType !== undefined){let data5 = data2.cardType;const _errs14 = errors;if(!((data5 === "DEBIT") || (data5 === "CREDIT"))){validate10.errors = [{instancePath:instancePath+"/balances/cardType",schemaPath:"#/$defs/AccountBalances/properties/cardType/enum",keyword:"enum",params:{allowedValues: schema12.properties.cardType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data2.creditLimit !== undefined){let data6 = data2.creditLimit;const _errs15 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate10.errors = [{instancePath:instancePath+"/balances/creditLimit",schemaPath:"#/$defs/AccountBalances/properties/creditLimit/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs15 === errors;}else {var valid2 = true;}if(valid2){if(data2.currencyCode !== undefined){const _errs17 = errors;if(typeof data2.currencyCode !== "string"){validate10.errors = [{instancePath:instancePath+"/balances/currencyCode",schemaPath:"#/$defs/AccountBalances/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs17 === errors;}else {var valid2 = true;}if(valid2){if(data2.totalBalance !== undefined){let data8 = data2.totalBalance;const _errs19 = errors;if(!((typeof data8 == "number") && (isFinite(data8)))){validate10.errors = [{instancePath:instancePath+"/balances/totalBalance",schemaPath:"#/$defs/AccountBalances/properties/totalBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs19 === errors;}else {var valid2 = true;}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/balances",schemaPath:"#/$defs/AccountBalances/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.cardAcceptor !== undefined){let data9 = data.cardAcceptor;const _errs21 = errors;const _errs22 = errors;if(errors === _errs22){if(data9 && typeof data9 == "object" && !Array.isArray(data9)){if(data9.city !== undefined){const _errs25 = errors;if(typeof data9.city !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptor/properties/city/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs25 === errors;}else {var valid4 = true;}if(valid4){if(data9.country !== undefined){const _errs27 = errors;if(typeof data9.country !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptor/properties/country/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs27 === errors;}else {var valid4 = true;}if(valid4){if(data9.mcc !== undefined){let data12 = data9.mcc;const _errs29 = errors;if(!(((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12))) && (isFinite(data12)))){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptor/properties/mcc/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid4 = _errs29 === errors;}else {var valid4 = true;}if(valid4){if(data9.name !== undefined){const _errs31 = errors;if(typeof data9.name !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptor/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs31 === errors;}else {var valid4 = true;}if(valid4){if(data9.state !== undefined){const _errs33 = errors;if(typeof data9.state !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptor/properties/state/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs33 === errors;}else {var valid4 = true;}if(valid4){if(data9.street !== undefined){const _errs35 = errors;if(typeof data9.street !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptor/properties/street/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs35 === errors;}else {var valid4 = true;}if(valid4){if(data9.zip !== undefined){const _errs37 = errors;if(typeof data9.zip !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptor/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs37 === errors;}else {var valid4 = true;}}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptor/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs21 === errors;}else {var valid0 = true;}if(valid0){if(data.cardToken !== undefined){const _errs39 = errors;if(typeof data.cardToken !== "string"){validate10.errors = [{instancePath:instancePath+"/cardToken",schemaPath:"#/properties/cardToken/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs39 === errors;}else {var valid0 = true;}if(valid0){if(data.creditDebitIndicator !== undefined){let data18 = data.creditDebitIndicator;const _errs41 = errors;if(!((data18 === "DBIT") || (data18 === "CRDT"))){validate10.errors = [{instancePath:instancePath+"/creditDebitIndicator",schemaPath:"#/properties/creditDebitIndicator/enum",keyword:"enum",params:{allowedValues: schema11.properties.creditDebitIndicator.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.currencyCode !== undefined){const _errs42 = 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 = _errs42 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs44 = 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 = _errs44 === errors;}else {var valid0 = true;}if(valid0){if(data.externalAuthorizationReferenceId !== undefined){const _errs46 = errors;if(typeof data.externalAuthorizationReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalAuthorizationReferenceId",schemaPath:"#/properties/externalAuthorizationReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs46 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs48 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs48 === errors;}else {var valid0 = true;}if(valid0){if(data.firstRepaymentDate !== undefined){let data23 = data.firstRepaymentDate;const _errs50 = errors;if(errors === _errs50){if(errors === _errs50){if(typeof data23 === "string"){if(!(formats0.validate(data23))){validate10.errors = [{instancePath:instancePath+"/firstRepaymentDate",schemaPath:"#/properties/firstRepaymentDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/firstRepaymentDate",schemaPath:"#/properties/firstRepaymentDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs50 === errors;}else {var valid0 = true;}if(valid0){if(data.increaseAmountIfNeeded !== undefined){const _errs52 = errors;if(typeof data.increaseAmountIfNeeded !== "boolean"){validate10.errors = [{instancePath:instancePath+"/increaseAmountIfNeeded",schemaPath:"#/properties/increaseAmountIfNeeded/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs52 === errors;}else {var valid0 = true;}if(valid0){if(data.linkedTransaction !== undefined){let data25 = data.linkedTransaction;const _errs54 = errors;const _errs55 = errors;if(errors === _errs55){if(data25 && typeof data25 == "object" && !Array.isArray(data25)){if(data25.linkedTransactionKey !== undefined){const _errs58 = errors;if(typeof data25.linkedTransactionKey !== "string"){validate10.errors = [{instancePath:instancePath+"/linkedTransaction/linkedTransactionKey",schemaPath:"#/$defs/LinkedTransaction/properties/linkedTransactionKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs58 === errors;}else {var valid6 = true;}if(valid6){if(data25.linkedTransactionType !== undefined){let data27 = data25.linkedTransactionType;const _errs60 = errors;if(!((data27 === "LOAN") || (data27 === "DEPOSIT"))){validate10.errors = [{instancePath:instancePath+"/linkedTransaction/linkedTransactionType",schemaPath:"#/$defs/LinkedTransaction/properties/linkedTransactionType/enum",keyword:"enum",params:{allowedValues: schema14.properties.linkedTransactionType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid6 = _errs60 === errors;}else {var valid6 = true;}}}else {validate10.errors = [{instancePath:instancePath+"/linkedTransaction",schemaPath:"#/$defs/LinkedTransaction/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs54 === errors;}else {var valid0 = true;}if(valid0){if(data.partial !== undefined){const _errs61 = errors;if(typeof data.partial !== "boolean"){validate10.errors = [{instancePath:instancePath+"/partial",schemaPath:"#/properties/partial/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs61 === errors;}else {var valid0 = true;}if(valid0){if(data.transactionChannelId !== undefined){const _errs63 = errors;if(typeof data.transactionChannelId !== "string"){validate10.errors = [{instancePath:instancePath+"/transactionChannelId",schemaPath:"#/properties/transactionChannelId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs63 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs65 = errors;if(typeof data.userTransactionTime !== "string"){validate10.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs65 === 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/cards/schemas/card-transaction-reversal.schema.js b/src/cards/schemas/card-transaction-reversal.schema.js index 994c1ba..6933e99 100644 --- a/src/cards/schemas/card-transaction-reversal.schema.js +++ b/src/cards/schemas/card-transaction-reversal.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CardTransactionReversal","type":"object","description":"A full or partial reversal of a card transaction.","properties":{"amount":{"type":"number","title":"amount","description":"The amount of money to be credited in the client's account from the original card transaction."},"currencyCode":{"type":"string","title":"currencyCode","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","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"externalReferenceId":{"type":"string","title":"externalReferenceId","description":"The external reference ID to be used to reference the card reversal transaction in subsequent requests."},"id":{"type":"integer","title":"id","description":"The id of the Deposit Transaction"},"transactionChannelId":{"type":"string","title":"transactionChannelId","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};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.amount === undefined) && (missing0 = "amount")) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate10.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)))){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.currencyCode !== undefined){const _errs4 = 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 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs6 = 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 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs8 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){let data4 = data.id;const _errs10 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.transactionChannelId !== undefined){const _errs12 = errors;if(typeof data.transactionChannelId !== "string"){validate10.errors = [{instancePath:instancePath+"/transactionChannelId",schemaPath:"#/properties/transactionChannelId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs12 === 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 +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"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};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.amount === undefined) && (missing0 = "amount")) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate10.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)))){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.currencyCode !== undefined){const _errs4 = 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 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs6 = 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 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs8 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){let data4 = data.id;const _errs10 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.transactionChannelId !== undefined){const _errs12 = errors;if(typeof data.transactionChannelId !== "string"){validate10.errors = [{instancePath:instancePath+"/transactionChannelId",schemaPath:"#/properties/transactionChannelId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs12 === 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/cards/schemas/error-response.schema.js b/src/cards/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/cards/schemas/error-response.schema.js +++ b/src/cards/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/centres.yaml`, { + this.buildClient(auth).get('configuration/centres.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update centres configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/centres.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/centres.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +166,52 @@ export class MambuCentresConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/centres/index.ts b/src/centres/index.ts index acfbc81..ae9a62d 100644 --- a/src/centres/index.ts +++ b/src/centres/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuCentres } from './rest.client.js' export * as centres from './rest.type.js' diff --git a/src/centres/rest.client.ts b/src/centres/rest.client.ts index 4abb2c0..67a7bb4 100644 --- a/src/centres/rest.client.ts +++ b/src/centres/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { Centre, ErrorResponse, GetAllResponse } from './rest.type.js' /** @@ -46,7 +49,7 @@ export class MambuCentres { /** * Get centres */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { @@ -59,9 +62,21 @@ export class MambuCentres { sortBy?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`centres`, { + this.buildClient(auth).get('centres', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -71,22 +86,31 @@ export class MambuCentres { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get centre */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { centreId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { centreId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Centre> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`centres/${path.centreId}`, { searchParams: query ?? {}, @@ -99,40 +123,48 @@ export class MambuCentres { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -159,24 +191,52 @@ export class MambuCentres { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/centres/rest.type.ts b/src/centres/rest.type.ts index e095737..d9386aa 100644 --- a/src/centres/rest.type.ts +++ b/src/centres/rest.type.ts @@ -3,8 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as CentreValidator } from './schemas/centre.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' /** * Represents an address. @@ -13,47 +17,47 @@ export interface Address { /** * The city for the address. */ - city?: string + city?: string | undefined /** * The country. */ - country?: string + country?: string | undefined /** * The address encoded key, which is unique and generated. */ - encodedKey?: string + encodedKey?: string | undefined /** * The index of this address in the list of addresses. */ - indexInList?: number + indexInList?: number | undefined /** * The GPS latitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -90 to +90. */ - latitude?: number + latitude?: number | undefined /** * The first line of the address. */ - line1?: string + line1?: string | undefined /** * The second line of the address. */ - line2?: string + line2?: string | undefined /** * The GPS longitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -180 to +180. */ - longitude?: number + longitude?: number | undefined /** * The address parent key indicating the object owning this address. For example: client, centre, or branch. */ - parentKey?: string + parentKey?: string | undefined /** * The post code. */ - postcode?: string + postcode?: string | undefined /** * The region for the address. */ - region?: string + region?: string | undefined } /** @@ -63,47 +67,47 @@ export interface Centre { /** * The addresses of this centre. */ - addresses?: Address[] + addresses?: Address[] | undefined /** * The encoded key of the branch this centre is assigned to. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * The date the centre was created. */ - creationDate?: string + creationDate?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the centre, which must be unique, and can be generated and customized. */ - id?: string + id?: string | undefined /** * The last time the centre was modified. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The day of the week when repayments are collected. This influences the repayments schedule, upon update all repayments are updated to this day of the week. */ - meetingDay?: string + meetingDay?: string | undefined /** * The name of the centre. */ - name?: string + name?: string | undefined /** * The notes or description attached to this object. */ - notes?: string + notes?: string | undefined /** * The state of the centre. */ - state?: 'ACTIVE' | 'INACTIVE' + state?: 'ACTIVE' | 'INACTIVE' | undefined } export const Centre = { - validate: (await import('./schemas/centre.schema.js')).validate as ValidateFunction, + validate: CentreValidator as ValidateFunction, get schema() { return Centre.validate.schema }, @@ -111,14 +115,20 @@ export const Centre = { return Centre.validate.errors ?? undefined }, is: (o: unknown): o is Centre => Centre.validate(o) === true, + parse: (o: unknown): { right: Centre } | { left: DefinedError[] } => { + if (Centre.is(o)) { + return { right: o } + } + return { left: (Centre.errors ?? []) as DefinedError[] } + }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -126,17 +136,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = Centre[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -144,10 +155,16 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/centres/schemas/centre.schema.js b/src/centres/schemas/centre.schema.js index b2cebc0..3e762b2 100644 --- a/src/centres/schemas/centre.schema.js +++ b/src/centres/schemas/centre.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"Centre","type":"object","description":"Represents a centre. A centre is a common meeting area that credit officers and the individual and group clients go to. Each centre is assigned to a branch (a branch can have multiple centres) and might have a specific meeting day and location.","properties":{"addresses":{"type":"array","title":"addresses","description":"The addresses of this centre.","items":{"$ref":"#/$defs/Addressaf30"}},"assignedBranchKey":{"type":"string","title":"assignedBranchKey","description":"The encoded key of the branch this centre is assigned to."},"creationDate":{"type":"string","title":"creationDate","description":"The date the centre was created.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"id":{"type":"string","title":"id","description":"The ID of the centre, which must be unique, and can be generated and customized."},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last time the centre was modified.","format":"date-time"},"meetingDay":{"type":"string","title":"meetingDay","description":"The day of the week when repayments are collected. This influences the repayments schedule, upon update all repayments are updated to this day of the week."},"name":{"type":"string","title":"name","description":"The name of the centre."},"notes":{"type":"string","title":"notes","description":"The notes or description attached to this object."},"state":{"title":"state","description":"The state of the centre.","enum":["ACTIVE","INACTIVE"]}},"additionalProperties":true,"$defs":{"Addressaf30":{"type":"object","title":"Addressaf30","description":"Represents an address.","properties":{"city":{"type":"string","title":"city","description":"The city for the address."},"country":{"type":"string","title":"country","description":"The country."},"encodedKey":{"type":"string","title":"encodedKey","description":"The address encoded key, which is unique and generated."},"indexInList":{"type":"integer","title":"indexInList","description":"The index of this address in the list of addresses."},"latitude":{"type":"number","title":"latitude","description":"The GPS latitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -90 to +90."},"line1":{"type":"string","title":"line1","description":"The first line of the address."},"line2":{"type":"string","title":"line2","description":"The second line of the address."},"longitude":{"type":"number","title":"longitude","description":"The GPS longitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -180 to +180."},"parentKey":{"type":"string","title":"parentKey","description":"The address parent key indicating the object owning this address. For example: client, centre, or branch."},"postcode":{"type":"string","title":"postcode","description":"The post code."},"region":{"type":"string","title":"region","description":"The region for the address."}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"Addressaf30","description":"Represents an address.","properties":{"city":{"type":"string","title":"city","description":"The city for the address."},"country":{"type":"string","title":"country","description":"The country."},"encodedKey":{"type":"string","title":"encodedKey","description":"The address encoded key, which is unique and generated."},"indexInList":{"type":"integer","title":"indexInList","description":"The index of this address in the list of addresses."},"latitude":{"type":"number","title":"latitude","description":"The GPS latitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -90 to +90."},"line1":{"type":"string","title":"line1","description":"The first line of the address."},"line2":{"type":"string","title":"line2","description":"The second line of the address."},"longitude":{"type":"number","title":"longitude","description":"The GPS longitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -180 to +180."},"parentKey":{"type":"string","title":"parentKey","description":"The address parent key indicating the object owning this address. For example: client, centre, or branch."},"postcode":{"type":"string","title":"postcode","description":"The post code."},"region":{"type":"string","title":"region","description":"The region for the address."}},"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.addresses !== undefined){let data0 = data.addresses;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).post(`clients/${path.clientId}/documents`, { headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, @@ -66,20 +78,30 @@ export class MambuClientDocuments { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get client document */ - public async getClientDocumentById({ + public getClientDocumentById({ path, auth = [['apiKey'], ['basic']], - }: { - path: { documentId: string } - auth?: string[][] | string[] - }) { + }: { path: { documentId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Document> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`clients/documents/${path.documentId}/metadata`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -91,33 +113,48 @@ export class MambuClientDocuments { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Download client document */ - public async getClientDocumentFileById({ + public getClientDocumentFileById({ path, auth = [['apiKey'], ['basic']], - }: { - path: { documentId: string } - auth?: string[][] | string[] - }) { - return this.awaitResponse(this.buildClient(auth).get(`clients/documents/${path.documentId}`, {}), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - }) + }: { path: { documentId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + return this.awaitResponse( + this.buildClient(auth).get(`clients/documents/${path.documentId}`, { + responseType: 'text', + }), + { + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Get all client documents */ - public async getDocumentsByClientId({ + public getDocumentsByClientId({ path, query, auth = [['apiKey'], ['basic']], @@ -125,7 +162,20 @@ export class MambuClientDocuments { path: { clientId: string } query?: { offset?: string; limit?: string; paginationDetails?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetDocumentsByClientIdResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`clients/${path.clientId}/documentsMetadata`, { searchParams: query ?? {}, @@ -138,40 +188,48 @@ export class MambuClientDocuments { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -198,24 +256,52 @@ export class MambuClientDocuments { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/client-documents/rest.type.ts b/src/client-documents/rest.type.ts index 1958634..8dd3f8c 100644 --- a/src/client-documents/rest.type.ts +++ b/src/client-documents/rest.type.ts @@ -3,8 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +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' /** * Holds information regarding the documents uploaded as attachments @@ -13,19 +17,19 @@ export interface Document { /** * The creation date of the document, stored as UTC */ - creationDate?: string + creationDate?: string | undefined /** * The document encodedKey */ - encodedKey?: string + encodedKey?: string | undefined /** * The original file name of the document */ - fileName?: string + fileName?: string | undefined /** * The file size of the document */ - fileSize?: number + fileSize?: number | undefined /** * The document id */ @@ -33,11 +37,11 @@ export interface Document { /** * The last modified date of the document, stored as UTC */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * Location where the document can be found, eg /myfiles/mypicture.jpeg */ - location?: string + location?: string | undefined /** * The name of the document */ @@ -45,11 +49,11 @@ export interface Document { /** * Detailed notes about the document */ - notes?: string + notes?: string | undefined /** * Represents the holder of this document. If null, means nobody is the owner of this document */ - ownerKey?: string + ownerKey?: string | undefined /** * Determines the owner type of the document */ @@ -66,6 +70,7 @@ export interface Document { | 'ID_DOCUMENT' | 'LINE_OF_CREDIT' | 'GL_JOURNAL_ENTRY' + | undefined /** * The extension of the document */ @@ -73,7 +78,7 @@ export interface Document { } export const Document = { - validate: (await import('./schemas/document.schema.js')).validate as ValidateFunction, + validate: DocumentValidator as ValidateFunction, get schema() { return Document.validate.schema }, @@ -81,19 +86,20 @@ export const Document = { return Document.validate.errors ?? undefined }, is: (o: unknown): o is Document => Document.validate(o) === true, - assert: (o: unknown) => { - if (!Document.validate(o)) { - throw new ValidationError(Document.errors ?? []) + parse: (o: unknown): { right: Document } | { left: DefinedError[] } => { + if (Document.is(o)) { + return { right: o } } + return { left: (Document.errors ?? []) as DefinedError[] } }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -101,18 +107,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetDocumentsByClientIdResponse = Document[] export const GetDocumentsByClientIdResponse = { - validate: (await import('./schemas/get-documents-by-client-id-response.schema.js')) - .validate as ValidateFunction, + validate: GetDocumentsByClientIdResponseValidator as ValidateFunction, get schema() { return GetDocumentsByClientIdResponse.validate.schema }, @@ -120,10 +126,16 @@ export const GetDocumentsByClientIdResponse = { return GetDocumentsByClientIdResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetDocumentsByClientIdResponse => GetDocumentsByClientIdResponse.validate(o) === true, + parse: (o: unknown): { right: GetDocumentsByClientIdResponse } | { left: DefinedError[] } => { + if (GetDocumentsByClientIdResponse.is(o)) { + return { right: o } + } + return { left: (GetDocumentsByClientIdResponse.errors ?? []) as DefinedError[] } + }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/client-documents/schemas/document.schema.js b/src/client-documents/schemas/document.schema.js index de15b34..9503090 100644 --- a/src/client-documents/schemas/document.schema.js +++ b/src/client-documents/schemas/document.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"Document","type":"object","description":"Holds information regarding the documents uploaded as attachments","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the document, stored as UTC","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The document encodedKey"},"fileName":{"type":"string","title":"fileName","description":"The original file name of the document"},"fileSize":{"type":"integer","title":"fileSize","description":"The file size of the document"},"id":{"type":"integer","title":"id","description":"The document id"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last modified date of the document, stored as UTC","format":"date-time"},"location":{"type":"string","title":"location","description":"Location where the document can be found, eg /myfiles/mypicture.jpeg"},"name":{"type":"string","title":"name","description":"The name of the document"},"notes":{"type":"string","title":"notes","description":"Detailed notes about the document"},"ownerKey":{"type":"string","title":"ownerKey","description":"Represents the holder of this document. If null, means nobody is the owner of this document"},"ownerType":{"title":"ownerType","description":"Determines the owner type 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"]},"type":{"type":"string","title":"type","description":"The extension of the document"}},"required":["id","name","type"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.id === undefined) && (missing0 = "id")) || ((data.name === undefined) && (missing0 = "name"))) || ((data.type === undefined) && (missing0 = "type"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.creationDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){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 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = 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 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.fileName !== undefined){const _errs6 = errors;if(typeof data.fileName !== "string"){validate10.errors = [{instancePath:instancePath+"/fileName",schemaPath:"#/properties/fileName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fileSize !== undefined){let data3 = data.fileSize;const _errs8 = errors;if(!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))){validate10.errors = [{instancePath:instancePath+"/fileSize",schemaPath:"#/properties/fileSize/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){let data4 = data.id;const _errs10 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){const _errs12 = errors;if(errors === _errs12){if(errors === _errs12){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 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.location !== undefined){const _errs14 = errors;if(typeof data.location !== "string"){validate10.errors = [{instancePath:instancePath+"/location",schemaPath:"#/properties/location/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs16 = 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 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs18 = 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 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.ownerKey !== undefined){const _errs20 = errors;if(typeof data.ownerKey !== "string"){validate10.errors = [{instancePath:instancePath+"/ownerKey",schemaPath:"#/properties/ownerKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.ownerType !== undefined){const _errs22 = 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 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.type !== undefined){const _errs23 = errors;if(typeof data.type !== "string"){validate10.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs23 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"Document","type":"object","description":"Holds information regarding the documents uploaded as attachments","properties":{"creationDate":{"type":"string","description":"The creation date of the document, stored as UTC","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"fileName":{"type":"string","description":"The original file name of the document"},"fileSize":{"type":"integer","description":"The file size of the document"},"id":{"type":"integer","description":"The document id"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document, stored as UTC","format":"date-time"},"location":{"type":"string","description":"Location where the document can be found, eg /myfiles/mypicture.jpeg"},"name":{"type":"string","description":"The name of the document"},"notes":{"type":"string","description":"Detailed notes about the document"},"ownerKey":{"type":"string","description":"Represents the holder of this document. If null, means nobody is the owner of this document"},"ownerType":{"description":"Determines the owner type 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"]},"type":{"type":"string","description":"The extension of the document"}},"required":["id","name","type"],"additionalProperties":true};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];const func0 = require("ajv/dist/runtime/equal").default;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.id === undefined) && (missing0 = "id")) || ((data.name === undefined) && (missing0 = "name"))) || ((data.type === undefined) && (missing0 = "type"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.creationDate !== undefined){let data0 = data.creationDate;const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(typeof data0 === "string"){if(!(formats0.validate(data0))){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/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"){validate10.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.fileName !== undefined){const _errs6 = errors;if(typeof data.fileName !== "string"){validate10.errors = [{instancePath:instancePath+"/fileName",schemaPath:"#/properties/fileName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fileSize !== undefined){let data3 = data.fileSize;const _errs8 = errors;if(!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))){validate10.errors = [{instancePath:instancePath+"/fileSize",schemaPath:"#/properties/fileSize/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){let data4 = data.id;const _errs10 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){let data5 = data.lastModifiedDate;const _errs12 = errors;if(errors === _errs12){if(errors === _errs12){if(typeof data5 === "string"){if(!(formats0.validate(data5))){validate10.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.location !== undefined){const _errs14 = errors;if(typeof data.location !== "string"){validate10.errors = [{instancePath:instancePath+"/location",schemaPath:"#/properties/location/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs16 = 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 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs18 = 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 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.ownerKey !== undefined){const _errs20 = errors;if(typeof data.ownerKey !== "string"){validate10.errors = [{instancePath:instancePath+"/ownerKey",schemaPath:"#/properties/ownerKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.ownerType !== undefined){const _errs22 = 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 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.type !== undefined){const _errs23 = errors;if(typeof data.type !== "string"){validate10.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs23 === 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-documents/schemas/error-response.schema.js b/src/client-documents/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/client-documents/schemas/error-response.schema.js +++ b/src/client-documents/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/clientroles.yaml`, { + this.buildClient(auth).get('configuration/clientroles.yaml', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update client roles configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/clientroles.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/clientroles.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -139,24 +175,52 @@ export class MambuClientRolesConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/clients.schema.ts b/src/clients.schema.ts index 52a5ffa..9939172 100644 --- a/src/clients.schema.ts +++ b/src/clients.schema.ts @@ -1,7 +1,7 @@ import { groupBy, hasPropertiesDefined, pick, valuesOf } from '@skyleague/axioms' import type { OpenapiV3 } from '@skyleague/therefore' import { $restclient } from '@skyleague/therefore' -import type { PathItem } from '@skyleague/therefore/src/lib/primitives/restclient/openapi.type.js' +import type { PathItem } from '@skyleague/therefore/src/types/openapi.type.js' import camelCase from 'camelcase' import got from 'got' @@ -46,7 +46,12 @@ const exports: Record = {} for (const item of clientList) { const openapi = await client.get(item.jsonPath).json() - const node = await $restclient(openapi, { + let clientName = item.label.replace(/[_\s]/g, '-').toLowerCase() + clientName = clientName.includes('a-p-i') ? clientName.replace('a-p-i', 'api') : clientName + clientName = clientName.includes('i-d-') ? clientName.replace('i-d-', 'id-') : clientName + + exports[camelCase(`mambu_${clientName}`)] = $restclient(openapi, { + filename: `${clientName}/rest.client.ts`, strict: false, transformOpenapi: (api: OpenapiV3) => { const securitySchemes = api.components?.securitySchemes @@ -64,21 +69,22 @@ for (const item of clientList) { for (const path of valuesOf(api.paths)) { const pathItem = path as PathItem for (const method of valuesOf( - pick(pathItem, ['get', 'delete', 'put', 'head', 'options', 'trace', 'patch', 'post']) + pick(pathItem, ['get', 'delete', 'put', 'head', 'options', 'trace', 'patch', 'post']), ).filter(hasPropertiesDefined('security'))) { method.security.unshift({ apiKey: [] }) } } } - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + // biome-ignore lint/suspicious/noExplicitAny: ignoe if ((api.components?.schemas?.RestError as any)?.properties?.errorReason?.enum !== undefined) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + // biome-ignore lint/performance/noDelete: This is necessary + // biome-ignore lint/suspicious/noExplicitAny: ignore delete (api.components?.schemas?.RestError as any)?.properties?.errorReason?.enum } for (const [name, definition] of Object.entries(api.components?.schemas ?? {})) { if (name.endsWith('FilterCriteria')) { - if ('properties' in definition && definition.properties.field !== undefined) { + if ('properties' in definition && definition.properties?.field !== undefined) { if ('type' in definition.properties.field && definition.properties.field.type === 'string') { definition.properties.field = { anyOf: [definition.properties.field, { type: 'string' }], @@ -86,18 +92,24 @@ for (const item of clientList) { } } } + if (name === 'PatchOperation') { + if ('properties' in definition && definition.properties?.value !== undefined) { + if ( + 'type' in definition.properties.value && + definition.properties.value.type === 'object' && + !('properties' in definition.properties.value) + ) { + // biome-ignore lint/performance/noDelete: This is necessary + delete definition.properties.value.type + } + } + } } return api }, explicitContentNegotiation: true, }) - let clientName = item.label.replace(/[_\s]/g, '-').toLowerCase() - clientName = clientName.includes('a-p-i') ? clientName.replace('a-p-i', 'api') : clientName - clientName = clientName.includes('i-d-') ? clientName.replace('i-d-', 'id-') : clientName - - node.value.filePath = `${clientName}/rest` - exports[camelCase(`mambu_${clientName}`)] = node } export default exports diff --git a/src/clients/index.ts b/src/clients/index.ts index 3653094..77e3c77 100644 --- a/src/clients/index.ts +++ b/src/clients/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuClients } from './rest.client.js' export * as clients from './rest.type.js' diff --git a/src/clients/rest.client.ts b/src/clients/rest.client.ts index 37b24db..c61c55c 100644 --- a/src/clients/rest.client.ts +++ b/src/clients/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { Client, ClientRole, @@ -55,56 +58,84 @@ export class MambuClients { /** * Create client */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: Client - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(Client, body) + }: { body: Client; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', Client> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Client, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`clients`, { + this.buildClient(auth).post('clients', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: Client, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete client */ - public async delete({ path, auth = [['apiKey'], ['basic']] }: { path: { clientId: string }; auth?: string[][] | string[] }) { + public delete({ + path, + auth = [['apiKey'], ['basic']], + }: { path: { clientId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`clients/${path.clientId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get clients */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { @@ -124,9 +155,21 @@ export class MambuClients { sortBy?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`clients`, { + this.buildClient(auth).get('clients', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -136,22 +179,31 @@ export class MambuClients { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get client */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { clientId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { clientId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Client> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`clients/${path.clientId}`, { searchParams: query ?? {}, @@ -164,14 +216,14 @@ export class MambuClients { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Credit arrangements list returned. */ - public async getCreditArrangementsByClientIdOrKey({ + public getCreditArrangementsByClientIdOrKey({ path, query, auth = [['apiKey'], ['basic']], @@ -179,7 +231,20 @@ export class MambuClients { path: { clientId: string } query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetCreditArrangementsByClientIdOrKeyResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`clients/${path.clientId}/creditarrangements`, { searchParams: query ?? {}, @@ -192,20 +257,29 @@ export class MambuClients { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get client role for client */ - public async getRoleByClientId({ + public getRoleByClientId({ path, auth = [['apiKey'], ['basic']], - }: { - path: { clientId: string } - auth?: string[][] | string[] - }) { + }: { path: { clientId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', ClientRole> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`clients/${path.clientId}/role`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -216,44 +290,56 @@ export class MambuClients { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update client */ - public async patch({ + public patch({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: PatchRequest - path: { clientId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }: { body: PatchRequest; path: { clientId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`clients/${path.clientId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Search clients */ - public async search({ + public search({ body, query, auth = [['apiKey'], ['basic']], @@ -261,11 +347,27 @@ export class MambuClients { body: ClientSearchCriteria query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ClientSearchCriteria, body) + }): Promise< + | SuccessResponse<'200', SearchResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ClientSearchCriteria, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`clients:search`, { + this.buildClient(auth).post('clients:search', { json: body, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -276,23 +378,36 @@ export class MambuClients { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update client */ - public async update({ + public update({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: Client - path: { clientId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(Client, body) + }: { body: Client; path: { clientId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Client> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Client, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`clients/${path.clientId}`, { @@ -306,45 +421,66 @@ export class MambuClients { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -371,24 +507,52 @@ export class MambuClients { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/clients/rest.type.ts b/src/clients/rest.type.ts index ea4275d..6a9dca0 100644 --- a/src/clients/rest.type.ts +++ b/src/clients/rest.type.ts @@ -3,8 +3,17 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ClientRoleValidator } from './schemas/client-role.schema.js' +import { validate as ClientSearchCriteriaValidator } from './schemas/client-search-criteria.schema.js' +import { validate as ClientValidator } from './schemas/client.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' +import { validate as GetCreditArrangementsByClientIdOrKeyResponseValidator } from './schemas/get-credit-arrangements-by-client-id-or-key-response.schema.js' +import { validate as PatchRequestValidator } from './schemas/patch-request.schema.js' +import { validate as SearchResponseValidator } from './schemas/search-response.schema.js' /** * Represents an address. @@ -13,47 +22,47 @@ export interface Address { /** * The city for the address. */ - city?: string + city?: string | undefined /** * The country. */ - country?: string + country?: string | undefined /** * The address encoded key, which is unique and generated. */ - encodedKey?: string + encodedKey?: string | undefined /** * The index of this address in the list of addresses. */ - indexInList?: number + indexInList?: number | undefined /** * The GPS latitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -90 to +90. */ - latitude?: number + latitude?: number | undefined /** * The first line of the address. */ - line1?: string + line1?: string | undefined /** * The second line of the address. */ - line2?: string + line2?: string | undefined /** * The GPS longitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -180 to +180. */ - longitude?: number + longitude?: number | undefined /** * The address parent key indicating the object owning this address. For example: client, centre, or branch. */ - parentKey?: string + parentKey?: string | undefined /** * The post code. */ - postcode?: string + postcode?: string | undefined /** * The region for the address. */ - region?: string + region?: string | undefined } /** @@ -63,51 +72,51 @@ export interface Client { /** * The date when a client was set as active for the first time. */ - activationDate?: string + activationDate?: string | undefined /** * The addresses associated with this client. */ - addresses?: Address[] + addresses?: Address[] | undefined /** * The date when a client was approved. */ - approvedDate?: string + approvedDate?: string | undefined /** * The encoded key of the branch a client is assigned to. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * The encoded key of the centre a client is assigned to. */ - assignedCentreKey?: string + assignedCentreKey?: string | undefined /** * The encoded key of the user a client is assigned to. */ - assignedUserKey?: string + assignedUserKey?: string | undefined /** * The client's date of birth. */ - birthDate?: string + birthDate?: string | undefined /** * A role which describes the intended use of a client in the system. */ - clientRoleKey?: string + clientRoleKey?: string | undefined /** * The date when the client state was changed to closed. */ - closedDate?: string + closedDate?: string | undefined /** * The date a client was created. */ - creationDate?: string + creationDate?: string | undefined /** * The client's email address. */ - emailAddress?: string + emailAddress?: string | undefined /** * The encoded key of the client, which is unique and generated. */ - encodedKey?: string + encodedKey?: string | undefined /** * The first name, personal name, given name, or forename of the client. */ @@ -115,31 +124,31 @@ export interface Client { /** * The client's gender, the options are male or female. */ - gender?: 'MALE' | 'FEMALE' + gender?: 'MALE' | 'FEMALE' | undefined /** * The groups to which this client belongs. */ - groupKeys?: string[] + groupKeys?: string[] | undefined /** * Number of paid and closed (with 'obligations met') accounts for a client's group; when the closing operation is reverted, this is reduced. */ - groupLoanCycle?: number + groupLoanCycle?: number | undefined /** * The client's home phone number. */ - homePhone?: string + homePhone?: string | undefined /** * The ID of the client, which can be generated and customized - but must be unique. */ - id?: string + id?: string | undefined /** * The identification documents for this client. */ - idDocuments?: IdentificationDocument[] + idDocuments?: IdentificationDocument[] | undefined /** * The last date a client was modified. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The last name, surname, or family name of the client. */ @@ -147,28 +156,28 @@ export interface Client { /** * Number of paid and closed (with 'obligations met') accounts for a client; when the closing operation is reverted, this is reduced. */ - loanCycle?: number + loanCycle?: number | undefined /** * The middle name of the client. */ - middleName?: string + middleName?: string | undefined /** * The migration event encoded key associated with a client. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * The client's mobile phone number. */ - mobilePhone?: string + mobilePhone?: string | undefined /** * The client's second mobile phone number. */ - mobilePhone2?: string + mobilePhone2?: string | undefined /** * The additional notes about a client. */ - notes?: string - portalSettings?: PortalSettings + notes?: string | undefined + portalSettings?: PortalSettings | undefined /** * The client's preferred language. This will determine the language for the reports, schedules, and account statements you generate for the client. */ @@ -190,22 +199,23 @@ export interface Client { | 'THAI' | 'NORWEGIAN' | 'PHRASE' + | undefined /** * The encoded key of a client's profile picture. */ - profilePictureKey?: string + profilePictureKey?: string | undefined /** * The encoded key of the client's profile signature. */ - profileSignatureKey?: string + profileSignatureKey?: string | undefined /** * The state of a client. It shows where the client is in the client life cycle. */ - state?: 'PENDING_APPROVAL' | 'INACTIVE' | 'ACTIVE' | 'EXITED' | 'BLACKLISTED' | 'REJECTED' + state?: 'PENDING_APPROVAL' | 'INACTIVE' | 'ACTIVE' | 'EXITED' | 'BLACKLISTED' | 'REJECTED' | undefined } export const Client = { - validate: (await import('./schemas/client.schema.js')).validate as ValidateFunction, + validate: ClientValidator as ValidateFunction, get schema() { return Client.validate.schema }, @@ -213,10 +223,11 @@ export const Client = { return Client.validate.errors ?? undefined }, is: (o: unknown): o is Client => Client.validate(o) === true, - assert: (o: unknown) => { - if (!Client.validate(o)) { - throw new ValidationError(Client.errors ?? []) + parse: (o: unknown): { right: Client } | { left: DefinedError[] } => { + if (Client.is(o)) { + return { right: o } } + return { left: (Client.errors ?? []) as DefinedError[] } }, } as const @@ -306,15 +317,15 @@ export interface ClientFilterCriteria { /** * The second value to match the searching criteria, when the `BETWEEN` operator is used. */ - secondValue?: string + secondValue?: string | undefined /** * The value to match the searching criteria. */ - value?: string + value?: string | undefined /** * List of values when the `IN` operator is used. */ - values?: string[] + values?: string[] | undefined } /** @@ -324,51 +335,51 @@ export interface ClientRole { /** * `TRUE` if clients with this client role can be used as guarantors, `FALSE` otherwise. */ - canGuarantee?: boolean + canGuarantee?: boolean | undefined /** * `TRUE` if new accounts for this client type can be created, `FALSE` otherwise. */ - canOpenAccounts?: boolean + canOpenAccounts?: boolean | undefined /** * The type of the client for which this role was created. */ - clientType?: 'CLIENT' | 'GROUP' + clientType?: 'CLIENT' | 'GROUP' | undefined /** * The creation date of the client role. */ - creationDate?: string + creationDate?: string | undefined /** * The text description for this client role. */ - description?: string + description?: string | undefined /** * The encoded key of the client, which is unique and generated. */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the client role, which can be generated and customized - but must be unique. */ - id?: string + id?: string | undefined /** * The pattern used in generating the client ID. */ - idPattern?: string + idPattern?: string | undefined /** * The name of the client role. */ - name?: string + name?: string | undefined /** * `TRUE` if identification documents must be provided for the client to be created, `FALSE` otherwise. Does not apply for groups. */ - requireID?: boolean + requireID?: boolean | undefined /** * `TRUE` if the Mambu default address section is available, `FALSE` otherwise. */ - useDefaultAddress?: boolean + useDefaultAddress?: boolean | undefined } export const ClientRole = { - validate: (await import('./schemas/client-role.schema.js')).validate as ValidateFunction, + validate: ClientRoleValidator as ValidateFunction, get schema() { return ClientRole.validate.schema }, @@ -376,6 +387,12 @@ export const ClientRole = { return ClientRole.validate.errors ?? undefined }, is: (o: unknown): o is ClientRole => ClientRole.validate(o) === true, + parse: (o: unknown): { right: ClientRole } | { left: DefinedError[] } => { + if (ClientRole.is(o)) { + return { right: o } + } + return { left: (ClientRole.errors ?? []) as DefinedError[] } + }, } as const /** @@ -386,11 +403,11 @@ export interface ClientSearchCriteria { * The list of filtering criteria */ filterCriteria: ClientFilterCriteria[] - sortingCriteria?: ClientSortingCriteria + sortingCriteria?: ClientSortingCriteria | undefined } export const ClientSearchCriteria = { - validate: (await import('./schemas/client-search-criteria.schema.js')).validate as ValidateFunction, + validate: ClientSearchCriteriaValidator as ValidateFunction, get schema() { return ClientSearchCriteria.validate.schema }, @@ -398,10 +415,11 @@ export const ClientSearchCriteria = { return ClientSearchCriteria.validate.errors ?? undefined }, is: (o: unknown): o is ClientSearchCriteria => ClientSearchCriteria.validate(o) === true, - assert: (o: unknown) => { - if (!ClientSearchCriteria.validate(o)) { - throw new ValidationError(ClientSearchCriteria.errors ?? []) + parse: (o: unknown): { right: ClientSearchCriteria } | { left: DefinedError[] } => { + if (ClientSearchCriteria.is(o)) { + return { right: o } } + return { left: (ClientSearchCriteria.errors ?? []) as DefinedError[] } }, } as const @@ -438,7 +456,7 @@ export interface ClientSortingCriteria { /** * The sorting order: `ASC` or `DESC`. The default order is `DESC`. */ - order?: 'ASC' | 'DESC' + order?: 'ASC' | 'DESC' | undefined } /** @@ -452,28 +470,28 @@ export interface CreditArrangement { /** * The date when the credit arrangement was approved. */ - approvedDate?: string + approvedDate?: string | undefined /** * The available amount of the credit arrangement. */ - availableCreditAmount?: number + availableCreditAmount?: number | undefined /** * The date when the credit arrangement was closed. */ - closedDate?: string + closedDate?: string | undefined /** * The consumed amount of the credit arrangement, which is calculated as the difference between the amount and available amount. */ - consumedCreditAmount?: number + consumedCreditAmount?: number | undefined /** * The date when the credit arrangement was created. */ - creationDate?: string - currency?: Currency + creationDate?: string | undefined + currency?: Currency | undefined /** * The encoded key of the credit arrangement, it is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The date when the credit arrangement expires. */ @@ -481,11 +499,11 @@ export interface CreditArrangement { /** * The type of exposure limit calculation method used for the credit arrangement. */ - exposureLimitType?: 'APPROVED_AMOUNT' | 'OUTSTANDING_AMOUNT' + exposureLimitType?: 'APPROVED_AMOUNT' | 'OUTSTANDING_AMOUNT' | undefined /** * The encoded key of the credit arrangement holder (individual client or group). */ - holderKey?: string + holderKey?: string | undefined /** * The type of the credit arrangement holder (individual client or group). */ @@ -493,15 +511,15 @@ export interface CreditArrangement { /** * The ID of credit arrangement, can be generated and customized, and must be unique. */ - id?: string + id?: string | undefined /** * The last date when the credit arrangement was modified. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The notes or description of the credit arrangement. */ - notes?: string + notes?: string | undefined /** * The start date from which the credit arrangement became active. */ @@ -509,11 +527,11 @@ export interface CreditArrangement { /** * The state of the credit arrangement. */ - state?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' + state?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' | undefined /** * The substate of credit arrangement. */ - subState?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' + subState?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' | undefined } /** @@ -707,15 +725,17 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } /** @@ -725,19 +745,19 @@ export interface Document { /** * The creation date of the document, stored as UTC */ - creationDate?: string + creationDate?: string | undefined /** * The document encodedKey */ - encodedKey?: string + encodedKey?: string | undefined /** * The original file name of the document */ - fileName?: string + fileName?: string | undefined /** * The file size of the document */ - fileSize?: number + fileSize?: number | undefined /** * The document id */ @@ -745,11 +765,11 @@ export interface Document { /** * The last modified date of the document, stored as UTC */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * Location where the document can be found, eg /myfiles/mypicture.jpeg */ - location?: string + location?: string | undefined /** * The name of the document */ @@ -757,11 +777,11 @@ export interface Document { /** * Detailed notes about the document */ - notes?: string + notes?: string | undefined /** * Represents the holder of this document. If null, means nobody is the owner of this document */ - ownerKey?: string + ownerKey?: string | undefined /** * Determines the owner type of the document */ @@ -778,6 +798,7 @@ export interface Document { | 'ID_DOCUMENT' | 'LINE_OF_CREDIT' | 'GL_JOURNAL_ENTRY' + | undefined /** * The extension of the document */ @@ -785,11 +806,11 @@ export interface Document { } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -797,17 +818,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = Client[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -815,13 +837,19 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetCreditArrangementsByClientIdOrKeyResponse = CreditArrangement[] export const GetCreditArrangementsByClientIdOrKeyResponse = { - validate: (await import('./schemas/get-credit-arrangements-by-client-id-or-key-response.schema.js')) - .validate as ValidateFunction, + validate: + GetCreditArrangementsByClientIdOrKeyResponseValidator as ValidateFunction, get schema() { return GetCreditArrangementsByClientIdOrKeyResponse.validate.schema }, @@ -830,6 +858,12 @@ export const GetCreditArrangementsByClientIdOrKeyResponse = { }, is: (o: unknown): o is GetCreditArrangementsByClientIdOrKeyResponse => GetCreditArrangementsByClientIdOrKeyResponse.validate(o) === true, + parse: (o: unknown): { right: GetCreditArrangementsByClientIdOrKeyResponse } | { left: DefinedError[] } => { + if (GetCreditArrangementsByClientIdOrKeyResponse.is(o)) { + return { right: o } + } + return { left: (GetCreditArrangementsByClientIdOrKeyResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -839,11 +873,11 @@ export interface IdentificationDocument { /** * A list containing information about the attached files for this document */ - attachments?: Document[] + attachments?: Document[] | undefined /** * The encoded key of the client that owns this document */ - clientKey?: string + clientKey?: string | undefined /** * The id of the document */ @@ -855,23 +889,23 @@ export interface IdentificationDocument { /** * The encoded key of the document, generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Encoded key of the template used for this document */ - identificationDocumentTemplateKey?: string + identificationDocumentTemplateKey?: string | undefined /** * This document's index in the list of documents */ - indexInList?: number + indexInList?: number | undefined /** * Authority that issued the document, eg. Police */ - issuingAuthority?: string + issuingAuthority?: string | undefined /** * Date when the validity of the document ends */ - validUntil?: string + validUntil?: string | undefined } /** @@ -881,7 +915,7 @@ export interface PatchOperation { /** * The field from where a value should be moved, when using move */ - from?: string + from?: string | undefined /** * The change to perform */ @@ -893,15 +927,13 @@ export interface PatchOperation { /** * The value of the field, can be null */ - value?: { - [k: string]: unknown | undefined - } + value?: unknown } export type PatchRequest = PatchOperation[] export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, + validate: PatchRequestValidator as ValidateFunction, get schema() { return PatchRequest.validate.schema }, @@ -909,10 +941,11 @@ export const PatchRequest = { return PatchRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } }, } as const @@ -923,27 +956,27 @@ export interface PortalSettings { /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The last date the client logged in to the portal. */ - lastLoggedInDate?: string + lastLoggedInDate?: string | undefined /** * The state of the client's portal preferences. */ - portalState?: 'ENABLED' | 'DISABLED' + portalState?: 'ENABLED' | 'DISABLED' | undefined } export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } export type SearchResponse = Client[] export const SearchResponse = { - validate: (await import('./schemas/search-response.schema.js')).validate as ValidateFunction, + validate: SearchResponseValidator as ValidateFunction, get schema() { return SearchResponse.validate.schema }, @@ -951,4 +984,10 @@ export const SearchResponse = { return SearchResponse.validate.errors ?? undefined }, is: (o: unknown): o is SearchResponse => SearchResponse.validate(o) === true, + parse: (o: unknown): { right: SearchResponse } | { left: DefinedError[] } => { + if (SearchResponse.is(o)) { + return { right: o } + } + return { left: (SearchResponse.errors ?? []) as DefinedError[] } + }, } as const diff --git a/src/clients/schemas/client-role.schema.js b/src/clients/schemas/client-role.schema.js index 8845008..26b6946 100644 --- a/src/clients/schemas/client-role.schema.js +++ b/src/clients/schemas/client-role.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ClientRole","type":"object","description":"Represents a client or group role.","properties":{"canGuarantee":{"type":"boolean","title":"canGuarantee","description":"`TRUE` if clients with this client role can be used as guarantors, `FALSE` otherwise."},"canOpenAccounts":{"type":"boolean","title":"canOpenAccounts","description":"`TRUE` if new accounts for this client type can be created, `FALSE` otherwise."},"clientType":{"title":"clientType","description":"The type of the client for which this role was created.","enum":["CLIENT","GROUP"]},"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the client role.","format":"date-time"},"description":{"type":"string","title":"description","description":"The text description for this client role."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the client, which is unique and generated."},"id":{"type":"string","title":"id","description":"The ID of the client role, which can be generated and customized - but must be unique."},"idPattern":{"type":"string","title":"idPattern","description":"The pattern used in generating the client ID."},"name":{"type":"string","title":"name","description":"The name of the client role."},"requireID":{"type":"boolean","title":"requireID","description":"`TRUE` if identification documents must be provided for the client to be created, `FALSE` otherwise. Does not apply for groups."},"useDefaultAddress":{"type":"boolean","title":"useDefaultAddress","description":"`TRUE` if the Mambu default address section is available, `FALSE` otherwise."}},"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.canGuarantee !== undefined){const _errs2 = errors;if(typeof data.canGuarantee !== "boolean"){validate10.errors = [{instancePath:instancePath+"/canGuarantee",schemaPath:"#/properties/canGuarantee/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.canOpenAccounts !== undefined){const _errs4 = errors;if(typeof data.canOpenAccounts !== "boolean"){validate10.errors = [{instancePath:instancePath+"/canOpenAccounts",schemaPath:"#/properties/canOpenAccounts/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.clientType !== undefined){let data2 = data.clientType;const _errs6 = errors;if(!((data2 === "CLIENT") || (data2 === "GROUP"))){validate10.errors = [{instancePath:instancePath+"/clientType",schemaPath:"#/properties/clientType/enum",keyword:"enum",params:{allowedValues: schema11.properties.clientType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs7 = errors;if(errors === _errs7){if(errors === _errs7){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 = _errs7 === errors;}else {var valid0 = true;}if(valid0){if(data.description !== undefined){const _errs9 = errors;if(typeof data.description !== "string"){validate10.errors = [{instancePath:instancePath+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs9 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs11 = 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 = _errs11 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs13 = 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 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.idPattern !== undefined){const _errs15 = errors;if(typeof data.idPattern !== "string"){validate10.errors = [{instancePath:instancePath+"/idPattern",schemaPath:"#/properties/idPattern/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs15 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs17 = 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 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.requireID !== undefined){const _errs19 = errors;if(typeof data.requireID !== "boolean"){validate10.errors = [{instancePath:instancePath+"/requireID",schemaPath:"#/properties/requireID/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs19 === errors;}else {var valid0 = true;}if(valid0){if(data.useDefaultAddress !== undefined){const _errs21 = errors;if(typeof data.useDefaultAddress !== "boolean"){validate10.errors = [{instancePath:instancePath+"/useDefaultAddress",schemaPath:"#/properties/useDefaultAddress/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs21 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ClientRole","type":"object","description":"Represents a client or group role.","properties":{"canGuarantee":{"type":"boolean","description":"`TRUE` if clients with this client role can be used as guarantors, `FALSE` otherwise."},"canOpenAccounts":{"type":"boolean","description":"`TRUE` if new accounts for this client type can be created, `FALSE` otherwise."},"clientType":{"description":"The type of the client for which this role was created.","enum":["CLIENT","GROUP"]},"creationDate":{"type":"string","description":"The creation date of the client role.","format":"date-time"},"description":{"type":"string","description":"The text description for this client role."},"encodedKey":{"type":"string","description":"The encoded key of the client, which is unique and generated."},"id":{"type":"string","description":"The ID of the client role, which can be generated and customized - but must be unique."},"idPattern":{"type":"string","description":"The pattern used in generating the client ID."},"name":{"type":"string","description":"The name of the client role."},"requireID":{"type":"boolean","description":"`TRUE` if identification documents must be provided for the client to be created, `FALSE` otherwise. Does not apply for groups."},"useDefaultAddress":{"type":"boolean","description":"`TRUE` if the Mambu default address section is available, `FALSE` otherwise."}},"additionalProperties":true};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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.canGuarantee !== undefined){const _errs2 = errors;if(typeof data.canGuarantee !== "boolean"){validate10.errors = [{instancePath:instancePath+"/canGuarantee",schemaPath:"#/properties/canGuarantee/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.canOpenAccounts !== undefined){const _errs4 = errors;if(typeof data.canOpenAccounts !== "boolean"){validate10.errors = [{instancePath:instancePath+"/canOpenAccounts",schemaPath:"#/properties/canOpenAccounts/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.clientType !== undefined){let data2 = data.clientType;const _errs6 = errors;if(!((data2 === "CLIENT") || (data2 === "GROUP"))){validate10.errors = [{instancePath:instancePath+"/clientType",schemaPath:"#/properties/clientType/enum",keyword:"enum",params:{allowedValues: schema11.properties.clientType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){let data3 = data.creationDate;const _errs7 = errors;if(errors === _errs7){if(errors === _errs7){if(typeof data3 === "string"){if(!(formats0.validate(data3))){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs7 === errors;}else {var valid0 = true;}if(valid0){if(data.description !== undefined){const _errs9 = errors;if(typeof data.description !== "string"){validate10.errors = [{instancePath:instancePath+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs9 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs11 = 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 = _errs11 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs13 = 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 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.idPattern !== undefined){const _errs15 = errors;if(typeof data.idPattern !== "string"){validate10.errors = [{instancePath:instancePath+"/idPattern",schemaPath:"#/properties/idPattern/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs15 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs17 = 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 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.requireID !== undefined){const _errs19 = errors;if(typeof data.requireID !== "boolean"){validate10.errors = [{instancePath:instancePath+"/requireID",schemaPath:"#/properties/requireID/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs19 === errors;}else {var valid0 = true;}if(valid0){if(data.useDefaultAddress !== undefined){const _errs21 = errors;if(typeof data.useDefaultAddress !== "boolean"){validate10.errors = [{instancePath:instancePath+"/useDefaultAddress",schemaPath:"#/properties/useDefaultAddress/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs21 === 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/clients/schemas/client-search-criteria.schema.js b/src/clients/schemas/client-search-criteria.schema.js index 54e1ce2..28d48c0 100644 --- a/src/clients/schemas/client-search-criteria.schema.js +++ b/src/clients/schemas/client-search-criteria.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ClientSearchCriteria","type":"object","description":"Wrapper that holds a list of filtering criteria and a sorting criteria for clients","properties":{"filterCriteria":{"type":"array","title":"filterCriteria","description":"The list of filtering criteria","items":{"$ref":"#/$defs/ClientFilterCriteriaaf30"}},"sortingCriteria":{"title":"sortingCriteria","$ref":"#/$defs/ClientSortingCriteriaaf30"}},"required":["filterCriteria"],"additionalProperties":true,"$defs":{"ClientFilterCriteriaaf30":{"type":"object","title":"ClientFilterCriteriaaf30","description":"The unit that composes the list used for Clients searching","properties":{"field":{"title":"field","anyOf":[{"description":"The fields to perform the search. They can be native (one from the provided list) or otherwise can specify a custom field definition using the format [customFieldSetId].[customFieldId].\n","enum":["encodedKey","creditOfficerKey","clientRoleKey","branchKey","centreKey","groupKey","fullName","firstName","middleName","lastName","creationDate","lastModifiedDate","id","depositsBalance","loansBalance","pendingLoanAmount","approvedLoanAmount","totalBalance","totalDue","homePhoneNumber","mobilePhoneNumber","mobilePhoneNumber2","emailAddress","clientAddress","birthdate","gender","loanCycle","groupLoanCycle","clientState","portalState","preferredLanguage","groupId"]},{"type":"string"}]},"operator":{"title":"operator","description":"| **Operator** | **Affected values** | **Available for** |\n|--------------- |----------------------|----------------------------------------------------------------------|\n| EQUALS | ONE_VALUE | BIG_DECIMAL,BOOLEAN,LONG,MONEY,NUMBER,PERCENT,STRING,ENUM,KEY |\n| EQUALS_CASE_SENSITIVE | ONE_VALUE | BIG_DECIMAL,BOOLEAN,LONG,MONEY,NUMBER,PERCENT,STRING,ENUM,KEY \t\t |\n| MORE_THAN | ONE_VALUE | BIG_DECIMAL,NUMBER,MONEY |\n| LESS_THAN | ONE_VALUE | BIG_DECIMAL,NUMBER,MONEY |\n| BETWEEN | TWO_VALUES | BIG_DECIMAL,NUMBER,MONEY,DATE,DATE_TIME |\n| ON | ONE_VALUE | DATE,DATE_TIME |\n| AFTER | ONE_VALUE | DATE,DATE_TIME |\n| BEFORE | ONE_VALUE | DATE,DATE_TIME |\n| BEFORE_INCLUSIVE | ONE_VALUE | DATE,DATE_TIME |\n| STARTS_WITH | ONE_VALUE | STRING |\n| STARTS_WITH_CASE_SENSITIVE | ONE_VALUE | STRING |\n| IN | LIST | ENUM,KEY |\n| TODAY | NO_VALUE | DATE,DATE_TIME |\n| THIS_WEEK | NO_VALUE | DATE,DATE_TIME |\n| THIS_MONTH | NO_VALUE | DATE,DATE_TIME |\n| THIS_YEAR | NO_VALUE | DATE,DATE_TIME |\n| LAST_DAYS | ONE_VALUE | NUMBER |\n| EMPTY | NO_VALUE | BIG_DECIMAL,LONG,MONEY,NUMBER,PERCENT,STRING,ENUM,KEY,DATE,DATE_TIME |\n| NOT_EMPTY | NO_VALUE | BIG_DECIMAL,LONG,MONEY,NUMBER,PERCENT,STRING,ENUM,KEY,DATE,DATE_TIME |","enum":["EQUALS","EQUALS_CASE_SENSITIVE","DIFFERENT_THAN","MORE_THAN","LESS_THAN","BETWEEN","ON","AFTER","AFTER_INCLUSIVE","BEFORE","BEFORE_INCLUSIVE","STARTS_WITH","STARTS_WITH_CASE_SENSITIVE","IN","TODAY","THIS_WEEK","THIS_MONTH","THIS_YEAR","LAST_DAYS","EMPTY","NOT_EMPTY"]},"secondValue":{"type":"string","title":"secondValue","description":"The second value to match the searching criteria, when the `BETWEEN` operator is used."},"value":{"type":"string","title":"value","description":"The value to match the searching criteria."},"values":{"type":"array","title":"values","description":"List of values when the `IN` operator is used.","items":{"type":"string"}}},"required":["field","operator"],"additionalProperties":true},"ClientSortingCriteriaaf30":{"type":"object","title":"ClientSortingCriteriaaf30","description":"The sorting criteria used for Clients","properties":{"field":{"title":"field","description":"The field to sort by. It can be native (one from the provided list) or otherwise can specify a custom field definition using the format [customFieldSetId].[customFieldId].","enum":["encodedKey","id","fullName","firstName","middleName","lastName","creationDate","lastModifiedDate","depositsBalance","loansBalance","pendingLoanAmount","approvedLoanAmount","totalBalance","totalDue","homePhoneNumber","mobilePhoneNumber","mobilePhoneNumber2","emailAddress","birthdate","loanCycle","groupLoanCycle","portalState"]},"order":{"title":"order","description":"The sorting order: `ASC` or `DESC`. The default order is `DESC`.","enum":["ASC","DESC"]}},"required":["field"],"additionalProperties":true}}};const schema12 = {"type":"object","title":"ClientFilterCriteriaaf30","description":"The unit that composes the list used for Clients searching","properties":{"field":{"title":"field","anyOf":[{"description":"The fields to perform the search. They can be native (one from the provided list) or otherwise can specify a custom field definition using the format [customFieldSetId].[customFieldId].\n","enum":["encodedKey","creditOfficerKey","clientRoleKey","branchKey","centreKey","groupKey","fullName","firstName","middleName","lastName","creationDate","lastModifiedDate","id","depositsBalance","loansBalance","pendingLoanAmount","approvedLoanAmount","totalBalance","totalDue","homePhoneNumber","mobilePhoneNumber","mobilePhoneNumber2","emailAddress","clientAddress","birthdate","gender","loanCycle","groupLoanCycle","clientState","portalState","preferredLanguage","groupId"]},{"type":"string"}]},"operator":{"title":"operator","description":"| **Operator** | **Affected values** | **Available for** |\n|--------------- |----------------------|----------------------------------------------------------------------|\n| EQUALS | ONE_VALUE | BIG_DECIMAL,BOOLEAN,LONG,MONEY,NUMBER,PERCENT,STRING,ENUM,KEY |\n| EQUALS_CASE_SENSITIVE | ONE_VALUE | BIG_DECIMAL,BOOLEAN,LONG,MONEY,NUMBER,PERCENT,STRING,ENUM,KEY \t\t |\n| MORE_THAN | ONE_VALUE | BIG_DECIMAL,NUMBER,MONEY |\n| LESS_THAN | ONE_VALUE | BIG_DECIMAL,NUMBER,MONEY |\n| BETWEEN | TWO_VALUES | BIG_DECIMAL,NUMBER,MONEY,DATE,DATE_TIME |\n| ON | ONE_VALUE | DATE,DATE_TIME |\n| AFTER | ONE_VALUE | DATE,DATE_TIME |\n| BEFORE | ONE_VALUE | DATE,DATE_TIME |\n| BEFORE_INCLUSIVE | ONE_VALUE | DATE,DATE_TIME |\n| STARTS_WITH | ONE_VALUE | STRING |\n| STARTS_WITH_CASE_SENSITIVE | ONE_VALUE | STRING |\n| IN | LIST | ENUM,KEY |\n| TODAY | NO_VALUE | DATE,DATE_TIME |\n| THIS_WEEK | NO_VALUE | DATE,DATE_TIME |\n| THIS_MONTH | NO_VALUE | DATE,DATE_TIME |\n| THIS_YEAR | NO_VALUE | DATE,DATE_TIME |\n| LAST_DAYS | ONE_VALUE | NUMBER |\n| EMPTY | NO_VALUE | BIG_DECIMAL,LONG,MONEY,NUMBER,PERCENT,STRING,ENUM,KEY,DATE,DATE_TIME |\n| NOT_EMPTY | NO_VALUE | BIG_DECIMAL,LONG,MONEY,NUMBER,PERCENT,STRING,ENUM,KEY,DATE,DATE_TIME |","enum":["EQUALS","EQUALS_CASE_SENSITIVE","DIFFERENT_THAN","MORE_THAN","LESS_THAN","BETWEEN","ON","AFTER","AFTER_INCLUSIVE","BEFORE","BEFORE_INCLUSIVE","STARTS_WITH","STARTS_WITH_CASE_SENSITIVE","IN","TODAY","THIS_WEEK","THIS_MONTH","THIS_YEAR","LAST_DAYS","EMPTY","NOT_EMPTY"]},"secondValue":{"type":"string","title":"secondValue","description":"The second value to match the searching criteria, when the `BETWEEN` operator is used."},"value":{"type":"string","title":"value","description":"The value to match the searching criteria."},"values":{"type":"array","title":"values","description":"List of values when the `IN` operator is used.","items":{"type":"string"}}},"required":["field","operator"],"additionalProperties":true};const schema13 = {"type":"object","title":"ClientSortingCriteriaaf30","description":"The sorting criteria used for Clients","properties":{"field":{"title":"field","description":"The field to sort by. It can be native (one from the provided list) or otherwise can specify a custom field definition using the format [customFieldSetId].[customFieldId].","enum":["encodedKey","id","fullName","firstName","middleName","lastName","creationDate","lastModifiedDate","depositsBalance","loansBalance","pendingLoanAmount","approvedLoanAmount","totalBalance","totalDue","homePhoneNumber","mobilePhoneNumber","mobilePhoneNumber2","emailAddress","birthdate","loanCycle","groupLoanCycle","portalState"]},"order":{"title":"order","description":"The sorting order: `ASC` or `DESC`. The default order is `DESC`.","enum":["ASC","DESC"]}},"required":["field"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.filterCriteria === undefined) && (missing0 = "filterCriteria")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.filterCriteria !== undefined){let data0 = data.filterCriteria;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'201', Comment> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Comment, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`comments`, { + this.buildClient(auth).post('comments', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: Comment, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get comments for an entity */ - public async getComments({ + public getComments({ query, auth = [['apiKey'], ['basic']], }: { query?: { offset?: string; limit?: string; paginationDetails?: string; ownerType: string; ownerKey: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetCommentsResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`comments`, { + this.buildClient(auth).get('comments', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -95,45 +124,66 @@ export class MambuComments { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -160,24 +210,52 @@ export class MambuComments { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/comments/rest.type.ts b/src/comments/rest.type.ts index ce263b2..c3b134c 100644 --- a/src/comments/rest.type.ts +++ b/src/comments/rest.type.ts @@ -3,8 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as CommentValidator } from './schemas/comment.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetCommentsResponseValidator } from './schemas/get-comments-response.schema.js' /** * Represents information about the comment data transfer object. @@ -13,19 +17,19 @@ export interface Comment { /** * The creation date of the comment. */ - creationDate?: string + creationDate?: string | undefined /** * The comments's encoded key, which is auto-generated and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The last date when this comment was modified. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The encoded key of the entity that owns this comment. */ - ownerKey?: string + ownerKey?: string | undefined /** * The type of the entity that owns this comment. */ @@ -42,18 +46,19 @@ export interface Comment { | 'ID_DOCUMENT' | 'LINE_OF_CREDIT' | 'GL_JOURNAL_ENTRY' + | undefined /** * The message in the comment. */ - text?: string + text?: string | undefined /** * The user's key. */ - userKey?: string + userKey?: string | undefined } export const Comment = { - validate: (await import('./schemas/comment.schema.js')).validate as ValidateFunction, + validate: CommentValidator as ValidateFunction, get schema() { return Comment.validate.schema }, @@ -61,19 +66,20 @@ export const Comment = { return Comment.validate.errors ?? undefined }, is: (o: unknown): o is Comment => Comment.validate(o) === true, - assert: (o: unknown) => { - if (!Comment.validate(o)) { - throw new ValidationError(Comment.errors ?? []) + parse: (o: unknown): { right: Comment } | { left: DefinedError[] } => { + if (Comment.is(o)) { + return { right: o } } + return { left: (Comment.errors ?? []) as DefinedError[] } }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -81,17 +87,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetCommentsResponse = Comment[] export const GetCommentsResponse = { - validate: (await import('./schemas/get-comments-response.schema.js')).validate as ValidateFunction, + validate: GetCommentsResponseValidator as ValidateFunction, get schema() { return GetCommentsResponse.validate.schema }, @@ -99,10 +106,16 @@ export const GetCommentsResponse = { return GetCommentsResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetCommentsResponse => GetCommentsResponse.validate(o) === true, + parse: (o: unknown): { right: GetCommentsResponse } | { left: DefinedError[] } => { + if (GetCommentsResponse.is(o)) { + return { right: o } + } + return { left: (GetCommentsResponse.errors ?? []) as DefinedError[] } + }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/comments/schemas/comment.schema.js b/src/comments/schemas/comment.schema.js index 3de9d7e..4a62af2 100644 --- a/src/comments/schemas/comment.schema.js +++ b/src/comments/schemas/comment.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"Comment","type":"object","description":"Represents information about the comment data transfer object.","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the comment.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The comments's encoded key, which is auto-generated and unique."},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last date when this comment was modified.","format":"date-time"},"ownerKey":{"type":"string","title":"ownerKey","description":"The encoded key of the entity that owns this comment."},"ownerType":{"title":"ownerType","description":"The type of the entity that owns this comment.","enum":["CLIENT","GROUP","LOAN_PRODUCT","SAVINGS_PRODUCT","CENTRE","BRANCH","USER","LOAN_ACCOUNT","DEPOSIT_ACCOUNT","ID_DOCUMENT","LINE_OF_CREDIT","GL_JOURNAL_ENTRY"]},"text":{"type":"string","title":"text","description":"The message in the comment."},"userKey":{"type":"string","title":"userKey","description":"The user's key."}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.creationDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){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 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = 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 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){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 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.ownerKey !== undefined){const _errs8 = errors;if(typeof data.ownerKey !== "string"){validate10.errors = [{instancePath:instancePath+"/ownerKey",schemaPath:"#/properties/ownerKey/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;}if(valid0){if(data.text !== undefined){const _errs11 = errors;if(typeof data.text !== "string"){validate10.errors = [{instancePath:instancePath+"/text",schemaPath:"#/properties/text/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs11 === errors;}else {var valid0 = true;}if(valid0){if(data.userKey !== undefined){const _errs13 = errors;if(typeof data.userKey !== "string"){validate10.errors = [{instancePath:instancePath+"/userKey",schemaPath:"#/properties/userKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs13 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"Comment","type":"object","description":"Represents information about the comment data transfer object.","properties":{"creationDate":{"type":"string","description":"The creation date of the comment.","format":"date-time"},"encodedKey":{"type":"string","description":"The comments's encoded key, which is auto-generated and unique."},"lastModifiedDate":{"type":"string","description":"The last date when this comment was modified.","format":"date-time"},"ownerKey":{"type":"string","description":"The encoded key of the entity that owns this comment."},"ownerType":{"description":"The type of the entity that owns this comment.","enum":["CLIENT","GROUP","LOAN_PRODUCT","SAVINGS_PRODUCT","CENTRE","BRANCH","USER","LOAN_ACCOUNT","DEPOSIT_ACCOUNT","ID_DOCUMENT","LINE_OF_CREDIT","GL_JOURNAL_ENTRY"]},"text":{"type":"string","description":"The message in the comment."},"userKey":{"type":"string","description":"The user's key."}},"additionalProperties":true};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];const func0 = require("ajv/dist/runtime/equal").default;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.creationDate !== undefined){let data0 = data.creationDate;const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(typeof data0 === "string"){if(!(formats0.validate(data0))){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/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"){validate10.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.lastModifiedDate !== undefined){let data2 = data.lastModifiedDate;const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(typeof data2 === "string"){if(!(formats0.validate(data2))){validate10.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.ownerKey !== undefined){const _errs8 = errors;if(typeof data.ownerKey !== "string"){validate10.errors = [{instancePath:instancePath+"/ownerKey",schemaPath:"#/properties/ownerKey/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;}if(valid0){if(data.text !== undefined){const _errs11 = errors;if(typeof data.text !== "string"){validate10.errors = [{instancePath:instancePath+"/text",schemaPath:"#/properties/text/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs11 === errors;}else {var valid0 = true;}if(valid0){if(data.userKey !== undefined){const _errs13 = errors;if(typeof data.userKey !== "string"){validate10.errors = [{instancePath:instancePath+"/userKey",schemaPath:"#/properties/userKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs13 === 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/comments/schemas/error-response.schema.js b/src/comments/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/comments/schemas/error-response.schema.js +++ b/src/comments/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'200', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CommunicationMessageEnqueueAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`communications/messages:resendAsyncByDate`, { + this.buildClient(auth).post('communications/messages:resendAsyncByDate', { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 200: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 200: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Resend failed communication message(s) asynchronously using keys */ - public async enqueueByKeys({ + public enqueueByKeys({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: CommunicationMessageAction - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(CommunicationMessageAction, body) + }: { body: CommunicationMessageAction; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CommunicationMessageAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`communications/messages:resendAsyncByKeys`, { + this.buildClient(auth).post('communications/messages:resendAsyncByKeys', { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 200: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 200: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get communication message */ - public async getByEncodedKey({ + public getByEncodedKey({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { encodedKey: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { encodedKey: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', CommunicationMessage> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`communications/messages/${path.encodedKey}`, { searchParams: query ?? {}, @@ -138,45 +182,59 @@ export class MambuCommunications { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Resend failed communication message(s) */ - public async resend({ + public resend({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: CommunicationMessageAction - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(CommunicationMessageAction, body) + }: { body: CommunicationMessageAction; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'202', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CommunicationMessageAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`communications/messages:resend`, { + this.buildClient(auth).post('communications/messages:resend', { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 202: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 202: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Searching communication messages */ - public async search({ + public search({ body, query, auth = [['apiKey'], ['basic']], @@ -184,11 +242,27 @@ export class MambuCommunications { body: SearchRequest query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(SearchRequest, body) + }): Promise< + | SuccessResponse<'200', SearchResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(SearchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`communications/messages:search`, { + this.buildClient(auth).post('communications/messages:search', { json: body, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -199,14 +273,14 @@ export class MambuCommunications { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Searching sorted communication messages */ - public async search1({ + public search1({ body, query, auth = [['apiKey'], ['basic']], @@ -214,11 +288,27 @@ export class MambuCommunications { body: CommunicationMessagesSearchSortCriteria query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(CommunicationMessagesSearchSortCriteria, body) + }): Promise< + | SuccessResponse<'200', Search1Response> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CommunicationMessagesSearchSortCriteria, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`communications/messages:searchSorted`, { + this.buildClient(auth).post('communications/messages:searchSorted', { json: body, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -229,75 +319,109 @@ export class MambuCommunications { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Send communication message */ - public async send({ + public send({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: CommunicationMessage - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(CommunicationMessage, body) + }: { body: CommunicationMessage; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', CommunicationMessage> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CommunicationMessage, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`communications/messages`, { + this.buildClient(auth).post('communications/messages', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: CommunicationMessage, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -324,24 +448,52 @@ export class MambuCommunications { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/communications/rest.type.ts b/src/communications/rest.type.ts index 2f69897..84a3c88 100644 --- a/src/communications/rest.type.ts +++ b/src/communications/rest.type.ts @@ -3,8 +3,17 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as CommunicationMessageActionValidator } from './schemas/communication-message-action.schema.js' +import { validate as CommunicationMessageEnqueueActionValidator } from './schemas/communication-message-enqueue-action.schema.js' +import { validate as CommunicationMessageValidator } from './schemas/communication-message.schema.js' +import { validate as CommunicationMessagesSearchSortCriteriaValidator } from './schemas/communication-messages-search-sort-criteria.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as SearchRequestValidator } from './schemas/search-request.schema.js' +import { validate as SearchResponseValidator } from './schemas/search-response.schema.js' +import { validate as Search1ResponseValidator } from './schemas/search1-response.schema.js' /** * Represents a communication message. @@ -13,27 +22,27 @@ export interface CommunicationMessage { /** * The contents of the message. */ - body?: string + body?: string | undefined /** * The client the message was sent to. */ - clientKey?: string + clientKey?: string | undefined /** * The date the communication message was created in UTC. */ - creationDate?: string + creationDate?: string | undefined /** * The deposit account that triggered this message. */ - depositAccountKey?: string + depositAccountKey?: string | undefined /** * The destination (phone number or email address) this message was sent to. */ - destination?: string + destination?: string | undefined /** * The encoded key of the communication message, which is generated automatically, and must be unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The event that triggered this message. */ @@ -72,12 +81,14 @@ export interface CommunicationMessage { | 'SAVINGS_CREATED' | 'SAVINGS_DEPOSIT' | 'SAVINGS_DEPOSIT_REVERSAL' + | 'REAPPLIED_SAVINGS_DEPOSIT' | 'SAVINGS_APPROVAL' | 'SAVINGS_ACCOUNT_ACTIVATED' | 'SAVINGS_ACCOUNT_CLOSURE' | 'SAVINGS_ACCOUNT_REJECTION' | 'SAVINGS_WITHDRAWAL' | 'SAVINGS_WITHDRAWAL_REVERSAL' + | 'REAPPLIED_SAVINGS_WITHDRAWAL' | 'SAVINGS_ACCOUNT_ACTIVITY' | 'DEPOSIT_INTEREST_APPLIED' | 'DEPOSIT_INTEREST_APPLIED_ADJUSTMENT' @@ -108,10 +119,13 @@ export interface CommunicationMessage { | 'JOURNAL_ENTRY_ADDED' | 'JOURNAL_ENTRY_ADJUSTED' | 'SAVINGS_TRANSACTION_EDITED' + | 'CARD_WITHDRAWAL_REVERSAL' + | 'CARD_DEPOSIT_REVERSAL' + | undefined /** * The failure code if the message failed to send. */ - failureCause?: string + failureCause?: string | undefined /** * The reason for the communication message failure. */ @@ -139,58 +153,59 @@ export interface CommunicationMessage { | 'SMS_GATEWAY_ERROR' | 'MISSING_EMAIL_RECIPIENT_ADDRESS' | 'OTHER' + | undefined /** * The group the message was sent to. */ - groupKey?: string + groupKey?: string | undefined /** * The loan account that triggered this message. */ - loanAccountKey?: string + loanAccountKey?: string | undefined /** * The number of retries to send the message. */ - numRetries?: number + numRetries?: number | undefined /** * The reference ID of the communication message, generated by the SMS dispatcher. */ - referenceId?: string + referenceId?: string | undefined /** * The repayment that triggered this message. */ - repaymentKey?: string + repaymentKey?: string | undefined /** * The date the communication message was sent in UTC. */ - sendDate?: string + sendDate?: string | undefined /** * The encoded key of the sender. If specified, it should be the encoded key of the current user. */ - senderKey?: string + senderKey?: string | undefined /** * The state of the message. */ - state?: 'SENT' | 'QUEUED' | 'QUEUED_FOR_STREAM' | 'WAITING' | 'SENDING_ASYNC' | 'FAILED' + state?: 'SENT' | 'QUEUED' | 'QUEUED_FOR_STREAM' | 'WAITING' | 'SENDING_ASYNC' | 'FAILED' | undefined /** * The subject of the message. */ - subject?: string + subject?: string | undefined /** * The communication message template key. */ - templateKey?: string + templateKey?: string | undefined /** * The type of communication message. */ - type?: 'EMAIL' | 'SMS' | 'WEB_HOOK' | 'EVENT_STREAM' | 'TASK' + type?: 'EMAIL' | 'SMS' | 'WEB_HOOK' | 'EVENT_STREAM' | 'TASK' | undefined /** * The user the message was sent to. */ - userKey?: string + userKey?: string | undefined } export const CommunicationMessage = { - validate: (await import('./schemas/communication-message.schema.js')).validate as ValidateFunction, + validate: CommunicationMessageValidator as ValidateFunction, get schema() { return CommunicationMessage.validate.schema }, @@ -198,10 +213,11 @@ export const CommunicationMessage = { return CommunicationMessage.validate.errors ?? undefined }, is: (o: unknown): o is CommunicationMessage => CommunicationMessage.validate(o) === true, - assert: (o: unknown) => { - if (!CommunicationMessage.validate(o)) { - throw new ValidationError(CommunicationMessage.errors ?? []) + parse: (o: unknown): { right: CommunicationMessage } | { left: DefinedError[] } => { + if (CommunicationMessage.is(o)) { + return { right: o } } + return { left: (CommunicationMessage.errors ?? []) as DefinedError[] } }, } as const @@ -216,8 +232,7 @@ export interface CommunicationMessageAction { } export const CommunicationMessageAction = { - validate: (await import('./schemas/communication-message-action.schema.js')) - .validate as ValidateFunction, + validate: CommunicationMessageActionValidator as ValidateFunction, get schema() { return CommunicationMessageAction.validate.schema }, @@ -225,10 +240,11 @@ export const CommunicationMessageAction = { return CommunicationMessageAction.validate.errors ?? undefined }, is: (o: unknown): o is CommunicationMessageAction => CommunicationMessageAction.validate(o) === true, - assert: (o: unknown) => { - if (!CommunicationMessageAction.validate(o)) { - throw new ValidationError(CommunicationMessageAction.errors ?? []) + parse: (o: unknown): { right: CommunicationMessageAction } | { left: DefinedError[] } => { + if (CommunicationMessageAction.is(o)) { + return { right: o } } + return { left: (CommunicationMessageAction.errors ?? []) as DefinedError[] } }, } as const @@ -247,12 +263,11 @@ export interface CommunicationMessageEnqueueAction { /** * The list of template message types to enqueue. */ - templateTypes?: CommunicationMessageEnqueueActionTemplateTypesArray[] + templateTypes?: TemplateTypes[] | undefined } export const CommunicationMessageEnqueueAction = { - validate: (await import('./schemas/communication-message-enqueue-action.schema.js')) - .validate as ValidateFunction, + validate: CommunicationMessageEnqueueActionValidator as ValidateFunction, get schema() { return CommunicationMessageEnqueueAction.validate.schema }, @@ -260,15 +275,14 @@ export const CommunicationMessageEnqueueAction = { return CommunicationMessageEnqueueAction.validate.errors ?? undefined }, is: (o: unknown): o is CommunicationMessageEnqueueAction => CommunicationMessageEnqueueAction.validate(o) === true, - assert: (o: unknown) => { - if (!CommunicationMessageEnqueueAction.validate(o)) { - throw new ValidationError(CommunicationMessageEnqueueAction.errors ?? []) + parse: (o: unknown): { right: CommunicationMessageEnqueueAction } | { left: DefinedError[] } => { + if (CommunicationMessageEnqueueAction.is(o)) { + return { right: o } } + return { left: (CommunicationMessageEnqueueAction.errors ?? []) as DefinedError[] } }, } as const -type CommunicationMessageEnqueueActionTemplateTypesArray = 'EMAIL' | 'SMS' | 'WEB_HOOK' | 'EVENT_STREAM' | 'TASK' - /** * The unit that composes the list used for communication messages client directed searching */ @@ -336,15 +350,15 @@ export interface CommunicationMessageFilterCriteria { /** * The second value to match the searching criteria, when the `BETWEEN` operator is used. */ - secondValue?: string + secondValue?: string | undefined /** * The value to match the searching criteria. */ - value?: string + value?: string | undefined /** * List of values when the `IN` operator is used. */ - values?: string[] + values?: string[] | undefined } /** @@ -358,7 +372,7 @@ export interface CommunicationMessageSearchSortingCriteria { /** * The sorting order: `ASC` or `DESC`. The default order is `DESC`. */ - order?: 'ASC' | 'DESC' + order?: 'ASC' | 'DESC' | undefined } /** @@ -373,8 +387,7 @@ export interface CommunicationMessagesSearchSortCriteria { } export const CommunicationMessagesSearchSortCriteria = { - validate: (await import('./schemas/communication-messages-search-sort-criteria.schema.js')) - .validate as ValidateFunction, + validate: CommunicationMessagesSearchSortCriteriaValidator as ValidateFunction, get schema() { return CommunicationMessagesSearchSortCriteria.validate.schema }, @@ -383,19 +396,20 @@ export const CommunicationMessagesSearchSortCriteria = { }, is: (o: unknown): o is CommunicationMessagesSearchSortCriteria => CommunicationMessagesSearchSortCriteria.validate(o) === true, - assert: (o: unknown) => { - if (!CommunicationMessagesSearchSortCriteria.validate(o)) { - throw new ValidationError(CommunicationMessagesSearchSortCriteria.errors ?? []) + parse: (o: unknown): { right: CommunicationMessagesSearchSortCriteria } | { left: DefinedError[] } => { + if (CommunicationMessagesSearchSortCriteria.is(o)) { + return { right: o } } + return { left: (CommunicationMessagesSearchSortCriteria.errors ?? []) as DefinedError[] } }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -403,23 +417,24 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } export type Search1Response = CommunicationMessage[] export const Search1Response = { - validate: (await import('./schemas/search1-response.schema.js')).validate as ValidateFunction, + validate: Search1ResponseValidator as ValidateFunction, get schema() { return Search1Response.validate.schema }, @@ -427,12 +442,18 @@ export const Search1Response = { return Search1Response.validate.errors ?? undefined }, is: (o: unknown): o is Search1Response => Search1Response.validate(o) === true, + parse: (o: unknown): { right: Search1Response } | { left: DefinedError[] } => { + if (Search1Response.is(o)) { + return { right: o } + } + return { left: (Search1Response.errors ?? []) as DefinedError[] } + }, } as const export type SearchRequest = CommunicationMessageFilterCriteria[] export const SearchRequest = { - validate: (await import('./schemas/search-request.schema.js')).validate as ValidateFunction, + validate: SearchRequestValidator as ValidateFunction, get schema() { return SearchRequest.validate.schema }, @@ -440,17 +461,18 @@ export const SearchRequest = { return SearchRequest.validate.errors ?? undefined }, is: (o: unknown): o is SearchRequest => SearchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!SearchRequest.validate(o)) { - throw new ValidationError(SearchRequest.errors ?? []) + parse: (o: unknown): { right: SearchRequest } | { left: DefinedError[] } => { + if (SearchRequest.is(o)) { + return { right: o } } + return { left: (SearchRequest.errors ?? []) as DefinedError[] } }, } as const export type SearchResponse = CommunicationMessage[] export const SearchResponse = { - validate: (await import('./schemas/search-response.schema.js')).validate as ValidateFunction, + validate: SearchResponseValidator as ValidateFunction, get schema() { return SearchResponse.validate.schema }, @@ -458,4 +480,12 @@ export const SearchResponse = { return SearchResponse.validate.errors ?? undefined }, is: (o: unknown): o is SearchResponse => SearchResponse.validate(o) === true, + parse: (o: unknown): { right: SearchResponse } | { left: DefinedError[] } => { + if (SearchResponse.is(o)) { + return { right: o } + } + return { left: (SearchResponse.errors ?? []) as DefinedError[] } + }, } as const + +type TemplateTypes = 'EMAIL' | 'SMS' | 'WEB_HOOK' | 'EVENT_STREAM' | 'TASK' diff --git a/src/communications/schemas/communication-message-action.schema.js b/src/communications/schemas/communication-message-action.schema.js index d041263..91b8fbd 100644 --- a/src/communications/schemas/communication-message-action.schema.js +++ b/src/communications/schemas/communication-message-action.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CommunicationMessageAction","type":"object","description":"Represents a list of failed communication messages to resend.","properties":{"messages":{"type":"array","title":"messages","description":"The list of failed communication messages to resend.","items":{"type":"string"}}},"required":["messages"],"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.messages === undefined) && (missing0 = "messages")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.messages !== undefined){let data0 = data.messages;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'200', CreditArrangementAccounts> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(AddCreditArrangementAccountInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`creditarrangements/${path.creditArrangementId}:addAccount`, { @@ -78,20 +99,20 @@ export class MambuCreditArrangements { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: CreditArrangementAccounts, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Change credit arrangement state */ - public async changeState({ + public changeState({ body, path, headers, @@ -99,10 +120,28 @@ export class MambuCreditArrangements { }: { body: CreditArrangementAction path: { creditArrangementId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(CreditArrangementAction, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', CreditArrangement> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CreditArrangementAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`creditarrangements/${path.creditArrangementId}:changeState`, { @@ -111,83 +150,117 @@ export class MambuCreditArrangements { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: CreditArrangement, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create credit arrangement */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: CreditArrangement - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(CreditArrangement, body) + }: { body: CreditArrangement; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', CreditArrangement> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CreditArrangement, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`creditarrangements`, { + this.buildClient(auth).post('creditarrangements', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: CreditArrangement, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete credit arrangement */ - public async delete({ + public delete({ path, auth = [['apiKey'], ['basic']], - }: { - path: { creditArrangementId: string } - auth?: string[][] | string[] - }) { + }: { path: { creditArrangementId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`creditarrangements/${path.creditArrangementId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get credit arrangements */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string; sortBy?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`creditarrangements`, { + this.buildClient(auth).get('creditarrangements', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -197,20 +270,29 @@ export class MambuCreditArrangements { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get all loan and deposit accounts linked to credit arrangement */ - public async getAllAccounts({ + public getAllAccounts({ path, auth = [['apiKey'], ['basic']], - }: { - path: { creditArrangementId: string } - auth?: string[][] | string[] - }) { + }: { path: { creditArrangementId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', CreditArrangementAccounts> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`creditarrangements/${path.creditArrangementId}/accounts`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -221,22 +303,31 @@ export class MambuCreditArrangements { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get credit arrangement */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { creditArrangementId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { creditArrangementId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', CreditArrangement> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`creditarrangements/${path.creditArrangementId}`, { searchParams: query ?? {}, @@ -249,22 +340,31 @@ export class MambuCreditArrangements { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get credit arrangement schedule */ - public async getSchedule({ + public getSchedule({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { creditArrangementId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { creditArrangementId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', CreditArrangementSchedule> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`creditarrangements/${path.creditArrangementId}/schedule`, { searchParams: query ?? {}, @@ -277,44 +377,56 @@ export class MambuCreditArrangements { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update credit arrangement */ - public async patch({ + public patch({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: PatchRequest - path: { creditArrangementId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }: { body: PatchRequest; path: { creditArrangementId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`creditarrangements/${path.creditArrangementId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Remove account from credit arrangement */ - public async removeAccount({ + public removeAccount({ body, path, headers, @@ -322,10 +434,28 @@ export class MambuCreditArrangements { }: { body: RemoveCreditArrangementAccountInput path: { creditArrangementId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(RemoveCreditArrangementAccountInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', CreditArrangementAccounts> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(RemoveCreditArrangementAccountInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`creditarrangements/${path.creditArrangementId}:removeAccount`, { @@ -334,20 +464,20 @@ export class MambuCreditArrangements { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: CreditArrangementAccounts, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Search credit arrangements */ - public async search({ + public search({ body, query, auth = [['apiKey'], ['basic']], @@ -355,11 +485,27 @@ export class MambuCreditArrangements { body: CreditArrangementSearchCriteria query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(CreditArrangementSearchCriteria, body) + }): Promise< + | SuccessResponse<'200', SearchResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CreditArrangementSearchCriteria, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`creditarrangements:search`, { + this.buildClient(auth).post('creditarrangements:search', { json: body, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -370,23 +516,36 @@ export class MambuCreditArrangements { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update credit arrangement */ - public async update({ + public update({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: CreditArrangement - path: { creditArrangementId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(CreditArrangement, body) + }: { body: CreditArrangement; path: { creditArrangementId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', CreditArrangement> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CreditArrangement, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`creditarrangements/${path.creditArrangementId}`, { @@ -400,45 +559,66 @@ export class MambuCreditArrangements { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -465,24 +645,52 @@ export class MambuCreditArrangements { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/credit-arrangements/rest.type.ts b/src/credit-arrangements/rest.type.ts index 09463ec..d8a2c9a 100644 --- a/src/credit-arrangements/rest.type.ts +++ b/src/credit-arrangements/rest.type.ts @@ -3,8 +3,20 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as AddCreditArrangementAccountInputValidator } from './schemas/add-credit-arrangement-account-input.schema.js' +import { validate as CreditArrangementAccountsValidator } from './schemas/credit-arrangement-accounts.schema.js' +import { validate as CreditArrangementActionValidator } from './schemas/credit-arrangement-action.schema.js' +import { validate as CreditArrangementScheduleValidator } from './schemas/credit-arrangement-schedule.schema.js' +import { validate as CreditArrangementSearchCriteriaValidator } from './schemas/credit-arrangement-search-criteria.schema.js' +import { validate as CreditArrangementValidator } from './schemas/credit-arrangement.schema.js' +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 RemoveCreditArrangementAccountInputValidator } from './schemas/remove-credit-arrangement-account-input.schema.js' +import { validate as SearchResponseValidator } from './schemas/search-response.schema.js' /** * The account arrears settings, holds the required information for the arrears settings of an account. @@ -17,34 +29,35 @@ export interface AccountArrearsSettings { | 'ACCOUNT_FIRST_WENT_TO_ARREARS' | 'LAST_LATE_REPAYMENT' | 'ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD' + | undefined /** * The encoded key of the arrears base settings, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Defines monthly arrears tolerance day value. */ - monthlyToleranceDay?: number + monthlyToleranceDay?: number | undefined /** * Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears */ - nonWorkingDaysMethod?: 'INCLUDED' | 'EXCLUDED' + nonWorkingDaysMethod?: 'INCLUDED' | 'EXCLUDED' | undefined /** * Defines the tolerance calculation method */ - toleranceCalculationMethod?: 'ARREARS_TOLERANCE_PERIOD' | 'MONTHLY_ARREARS_TOLERANCE_DAY' + toleranceCalculationMethod?: 'ARREARS_TOLERANCE_PERIOD' | 'MONTHLY_ARREARS_TOLERANCE_DAY' | undefined /** * The tolerance floor amount. */ - toleranceFloorAmount?: number + toleranceFloorAmount?: number | undefined /** * Defines the arrears tolerance amount. */ - tolerancePercentageOfOutstandingPrincipal?: number + tolerancePercentageOfOutstandingPrincipal?: number | undefined /** * Defines the arrears tolerance period value. */ - tolerancePeriod?: number + tolerancePeriod?: number | undefined } /** @@ -54,31 +67,31 @@ export interface AccountInterestRateSettings { /** * The encoded key of the interest rate settings, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Index rate source key. */ - indexSourceKey?: string + indexSourceKey?: string | undefined /** * Interest rate value. */ - interestRate?: number + interestRate?: number | undefined /** * Maximum value allowed for index based interest rate. Valid only for index interest rate. */ - interestRateCeilingValue?: number + interestRateCeilingValue?: number | undefined /** * Minimum value allowed for index based interest rate. Valid only for index interest rate. */ - interestRateFloorValue?: number + interestRateFloorValue?: number | undefined /** * Interest rate review frequency unit count. Valid only for index interest rate. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * Interest rate review frequency measurement unit. Valid only for index interest rate. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * Interest calculation method: fixed or indexed(interest spread + active organization index interest rate) */ @@ -86,7 +99,7 @@ export interface AccountInterestRateSettings { /** * Interest spread value. */ - interestSpread?: number + interestSpread?: number | undefined /** * Date since an interest rate is valid */ @@ -108,8 +121,7 @@ export interface AddCreditArrangementAccountInput { } export const AddCreditArrangementAccountInput = { - validate: (await import('./schemas/add-credit-arrangement-account-input.schema.js')) - .validate as ValidateFunction, + validate: AddCreditArrangementAccountInputValidator as ValidateFunction, get schema() { return AddCreditArrangementAccountInput.validate.schema }, @@ -117,10 +129,11 @@ export const AddCreditArrangementAccountInput = { return AddCreditArrangementAccountInput.validate.errors ?? undefined }, is: (o: unknown): o is AddCreditArrangementAccountInput => AddCreditArrangementAccountInput.validate(o) === true, - assert: (o: unknown) => { - if (!AddCreditArrangementAccountInput.validate(o)) { - throw new ValidationError(AddCreditArrangementAccountInput.errors ?? []) + parse: (o: unknown): { right: AddCreditArrangementAccountInput } | { left: DefinedError[] } => { + if (AddCreditArrangementAccountInput.is(o)) { + return { right: o } } + return { left: (AddCreditArrangementAccountInput.errors ?? []) as DefinedError[] } }, } as const @@ -131,15 +144,15 @@ export interface Amount { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined } /** @@ -149,19 +162,19 @@ export interface AmountWithReduced { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined /** * The reduced amount. */ - reduced?: number + reduced?: number | undefined } /** @@ -179,24 +192,24 @@ export interface Asset { /** * The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null. */ - depositAccountKey?: string + depositAccountKey?: string | undefined /** * The encoded key of the security, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The key of the client/group used as the guarantor. */ - guarantorKey?: string + guarantorKey?: string | undefined /** * The type of the guarantor (client/group) */ - guarantorType?: 'CLIENT' | 'GROUP' + guarantorType?: 'CLIENT' | 'GROUP' | undefined /** * The original amount used by the client for a collateral asset */ - originalAmount?: number - originalCurrency?: Currency + originalAmount?: number | undefined + originalCurrency?: Currency | undefined } /** @@ -206,71 +219,71 @@ export interface Balances { /** * The fees balance. Represents the total fees expected to be paid on this account at a given moment. */ - feesBalance?: number + feesBalance?: number | undefined /** * The fees due. Representing the total fees due for the account. */ - feesDue?: number + feesDue?: number | undefined /** * The fees paid. Represents the total fees paid for the account. */ - feesPaid?: number + feesPaid?: number | undefined /** * The sum of all the authorization hold amounts on this account. */ - holdBalance?: number + holdBalance?: number | undefined /** * Represents the total interest owed by the client (total interest applied for account minus interest paid). */ - interestBalance?: number + interestBalance?: number | undefined /** * The interest due. Indicates how much interest it's due for the account at this moment. */ - interestDue?: number + interestDue?: number | undefined /** * 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). */ - interestFromArrearsBalance?: number + interestFromArrearsBalance?: number | undefined /** * The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment. */ - interestFromArrearsDue?: number + interestFromArrearsDue?: number | undefined /** * The interest from arrears paid, indicates total interest from arrears paid into the account. */ - interestFromArrearsPaid?: number + interestFromArrearsPaid?: number | undefined /** * The interest paid, indicates total interest paid into the account. */ - interestPaid?: number + interestPaid?: number | undefined /** * The penalty balance. Represents the total penalty expected to be paid on this account at a given moment. */ - penaltyBalance?: number + penaltyBalance?: number | undefined /** * The penalty due. Represents the total penalty amount due for the account. */ - penaltyDue?: number + penaltyDue?: number | undefined /** * The Penalty paid. Represents the total penalty amount paid for the account. */ - penaltyPaid?: number + penaltyPaid?: number | undefined /** * The total principal owned by the client, from now on (principal disbursed - principal paid). */ - principalBalance?: number + principalBalance?: number | undefined /** * The principal due, indicates how much principal it's due at this moment. */ - principalDue?: number + principalDue?: number | undefined /** * The principal paid, holds the value of the total paid into the account. */ - principalPaid?: number + principalPaid?: number | undefined /** * The total redraw amount owned by the client, from now on. */ - redrawBalance?: number + redrawBalance?: number | undefined } /** @@ -280,7 +293,7 @@ export interface BillingCycleDays { /** * The billing cycle start days in case it is enabled */ - days?: number[] + days?: number[] | undefined } /** @@ -294,28 +307,28 @@ export interface CreditArrangement { /** * The date when the credit arrangement was approved. */ - approvedDate?: string + approvedDate?: string | undefined /** * The available amount of the credit arrangement. */ - availableCreditAmount?: number + availableCreditAmount?: number | undefined /** * The date when the credit arrangement was closed. */ - closedDate?: string + closedDate?: string | undefined /** * The consumed amount of the credit arrangement, which is calculated as the difference between the amount and available amount. */ - consumedCreditAmount?: number + consumedCreditAmount?: number | undefined /** * The date when the credit arrangement was created. */ - creationDate?: string - currency?: Currency + creationDate?: string | undefined + currency?: Currency | undefined /** * The encoded key of the credit arrangement, it is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The date when the credit arrangement expires. */ @@ -323,11 +336,11 @@ export interface CreditArrangement { /** * The type of exposure limit calculation method used for the credit arrangement. */ - exposureLimitType?: 'APPROVED_AMOUNT' | 'OUTSTANDING_AMOUNT' + exposureLimitType?: 'APPROVED_AMOUNT' | 'OUTSTANDING_AMOUNT' | undefined /** * The encoded key of the credit arrangement holder (individual client or group). */ - holderKey?: string + holderKey?: string | undefined /** * The type of the credit arrangement holder (individual client or group). */ @@ -335,15 +348,15 @@ export interface CreditArrangement { /** * The ID of credit arrangement, can be generated and customized, and must be unique. */ - id?: string + id?: string | undefined /** * The last date when the credit arrangement was modified. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The notes or description of the credit arrangement. */ - notes?: string + notes?: string | undefined /** * The start date from which the credit arrangement became active. */ @@ -351,15 +364,15 @@ export interface CreditArrangement { /** * The state of the credit arrangement. */ - state?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' + state?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' | undefined /** * The substate of credit arrangement. */ - subState?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' + subState?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' | undefined } export const CreditArrangement = { - validate: (await import('./schemas/credit-arrangement.schema.js')).validate as ValidateFunction, + validate: CreditArrangementValidator as ValidateFunction, get schema() { return CreditArrangement.validate.schema }, @@ -367,10 +380,11 @@ export const CreditArrangement = { return CreditArrangement.validate.errors ?? undefined }, is: (o: unknown): o is CreditArrangement => CreditArrangement.validate(o) === true, - assert: (o: unknown) => { - if (!CreditArrangement.validate(o)) { - throw new ValidationError(CreditArrangement.errors ?? []) + parse: (o: unknown): { right: CreditArrangement } | { left: DefinedError[] } => { + if (CreditArrangement.is(o)) { + return { right: o } } + return { left: (CreditArrangement.errors ?? []) as DefinedError[] } }, } as const @@ -381,16 +395,15 @@ export interface CreditArrangementAccounts { /** * List of the deposit accounts linked to the credit arrangement. */ - depositAccounts?: DepositAccount[] + depositAccounts?: DepositAccount[] | undefined /** * List of loan accounts linked to the credit arrangement. */ - loanAccounts?: LoanAccount[] + loanAccounts?: LoanAccount[] | undefined } export const CreditArrangementAccounts = { - validate: (await import('./schemas/credit-arrangement-accounts.schema.js')) - .validate as ValidateFunction, + validate: CreditArrangementAccountsValidator as ValidateFunction, get schema() { return CreditArrangementAccounts.validate.schema }, @@ -398,10 +411,11 @@ export const CreditArrangementAccounts = { return CreditArrangementAccounts.validate.errors ?? undefined }, is: (o: unknown): o is CreditArrangementAccounts => CreditArrangementAccounts.validate(o) === true, - assert: (o: unknown) => { - if (!CreditArrangementAccounts.validate(o)) { - throw new ValidationError(CreditArrangementAccounts.errors ?? []) + parse: (o: unknown): { right: CreditArrangementAccounts } | { left: DefinedError[] } => { + if (CreditArrangementAccounts.is(o)) { + return { right: o } } + return { left: (CreditArrangementAccounts.errors ?? []) as DefinedError[] } }, } as const @@ -416,12 +430,11 @@ export interface CreditArrangementAction { /** * The notes related to the action performed. */ - notes?: string + notes?: string | undefined } export const CreditArrangementAction = { - validate: (await import('./schemas/credit-arrangement-action.schema.js')) - .validate as ValidateFunction, + validate: CreditArrangementActionValidator as ValidateFunction, get schema() { return CreditArrangementAction.validate.schema }, @@ -429,10 +442,11 @@ export const CreditArrangementAction = { return CreditArrangementAction.validate.errors ?? undefined }, is: (o: unknown): o is CreditArrangementAction => CreditArrangementAction.validate(o) === true, - assert: (o: unknown) => { - if (!CreditArrangementAction.validate(o)) { - throw new ValidationError(CreditArrangementAction.errors ?? []) + parse: (o: unknown): { right: CreditArrangementAction } | { left: DefinedError[] } => { + if (CreditArrangementAction.is(o)) { + return { right: o } } + return { left: (CreditArrangementAction.errors ?? []) as DefinedError[] } }, } as const @@ -489,15 +503,15 @@ export interface CreditArrangementFilterCriteria { /** * The second value to match the searching criteria, when the `BETWEEN` operator is used. */ - secondValue?: string + secondValue?: string | undefined /** * The value to match the searching criteria. */ - value?: string + value?: string | undefined /** * List of values when the `IN` operator is used. */ - values?: string[] + values?: string[] | undefined } /** @@ -507,12 +521,11 @@ export interface CreditArrangementSchedule { /** * The list of installments for the credit arrangement. */ - installments?: Installment[] + installments?: Installment[] | undefined } export const CreditArrangementSchedule = { - validate: (await import('./schemas/credit-arrangement-schedule.schema.js')) - .validate as ValidateFunction, + validate: CreditArrangementScheduleValidator as ValidateFunction, get schema() { return CreditArrangementSchedule.validate.schema }, @@ -520,6 +533,12 @@ export const CreditArrangementSchedule = { return CreditArrangementSchedule.validate.errors ?? undefined }, is: (o: unknown): o is CreditArrangementSchedule => CreditArrangementSchedule.validate(o) === true, + parse: (o: unknown): { right: CreditArrangementSchedule } | { left: DefinedError[] } => { + if (CreditArrangementSchedule.is(o)) { + return { right: o } + } + return { left: (CreditArrangementSchedule.errors ?? []) as DefinedError[] } + }, } as const /** @@ -529,13 +548,12 @@ export interface CreditArrangementSearchCriteria { /** * The list of filtering criteria. */ - filterCriteria?: CreditArrangementFilterCriteria[] - sortingCriteria?: CreditArrangementSortingCriteria + filterCriteria?: CreditArrangementFilterCriteria[] | undefined + sortingCriteria?: CreditArrangementSortingCriteria | undefined } export const CreditArrangementSearchCriteria = { - validate: (await import('./schemas/credit-arrangement-search-criteria.schema.js')) - .validate as ValidateFunction, + validate: CreditArrangementSearchCriteriaValidator as ValidateFunction, get schema() { return CreditArrangementSearchCriteria.validate.schema }, @@ -543,10 +561,11 @@ export const CreditArrangementSearchCriteria = { return CreditArrangementSearchCriteria.validate.errors ?? undefined }, is: (o: unknown): o is CreditArrangementSearchCriteria => CreditArrangementSearchCriteria.validate(o) === true, - assert: (o: unknown) => { - if (!CreditArrangementSearchCriteria.validate(o)) { - throw new ValidationError(CreditArrangementSearchCriteria.errors ?? []) + parse: (o: unknown): { right: CreditArrangementSearchCriteria } | { left: DefinedError[] } => { + if (CreditArrangementSearchCriteria.is(o)) { + return { right: o } } + return { left: (CreditArrangementSearchCriteria.errors ?? []) as DefinedError[] } }, } as const @@ -561,7 +580,7 @@ export interface CreditArrangementSortingCriteria { /** * The sorting order: `ASC` or `DESC`. The default order is `DESC`. */ - order?: 'ASC' | 'DESC' + order?: 'ASC' | 'DESC' | undefined } /** @@ -755,15 +774,17 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } /** @@ -773,19 +794,19 @@ export interface CustomPredefinedFee { /** * The amount of the custom fee. */ - amount?: number + amount?: number | undefined /** * The encoded key of the custom predefined fee, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The percentage of the custom fee. */ - percentage?: number + percentage?: number | undefined /** * The encoded key of the predefined fee */ - predefinedFeeEncodedKey?: string + predefinedFeeEncodedKey?: string | undefined } /** @@ -795,11 +816,11 @@ export interface DaysInMonth { /** * 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. */ - daysInMonth?: number[] + daysInMonth?: number[] | undefined /** * 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. */ - shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' + shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' | undefined } /** @@ -829,102 +850,103 @@ export interface DepositAccount { | 'CLOSED_WRITTEN_OFF' | 'WITHDRAWN' | 'CLOSED_REJECTED' + | undefined /** * The deposit account type and the product that it belongs to. */ - accountType?: 'CURRENT_ACCOUNT' | 'REGULAR_SAVINGS' | 'FIXED_DEPOSIT' | 'SAVINGS_PLAN' | 'INVESTOR_ACCOUNT' - accruedAmounts?: DepositAccountAccruedAmounts + accountType?: 'CURRENT_ACCOUNT' | 'REGULAR_SAVINGS' | 'FIXED_DEPOSIT' | 'SAVINGS_PLAN' | 'INVESTOR_ACCOUNT' | undefined + accruedAmounts?: DepositAccountAccruedAmounts | undefined /** * The date when the deposit account was activated, in the organization's timezone and time format. */ - activationDate?: string + activationDate?: string | undefined /** * The date when the deposit account was approved, in the organization's timezone and time format. */ - approvedDate?: string + approvedDate?: string | undefined /** * The key of the branch that this deposit account is assigned to. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * The key of the centre that this account is assigned to. */ - assignedCentreKey?: string + assignedCentreKey?: string | undefined /** * The key of the user that this deposit is assigned to. */ - assignedUserKey?: string - balances?: DepositAccountBalances + assignedUserKey?: string | undefined + balances?: DepositAccountBalances | undefined /** * The date when the deposit account was closed, in UTC. */ - closedDate?: string + closedDate?: string | undefined /** * The date this deposit account was created, in UTC. */ - creationDate?: string + creationDate?: string | undefined /** * The key to the credit arrangement where this account is registered. */ - creditArrangementKey?: string + creditArrangementKey?: string | undefined /** * The currency code. */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the deposit account, which is auto-generated and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the deposit account, which can be generated and customized - but must be unique. */ - id?: string - interestSettings?: DepositAccountInterestSettings - internalControls?: DepositAccountInternalControls + id?: string | undefined + interestSettings?: DepositAccountInterestSettings | undefined + internalControls?: DepositAccountInternalControls | undefined /** * The date when the account was last evaluated for interest calculations and maturity, in the organization's timezone and time format. */ - lastAccountAppraisalDate?: string + lastAccountAppraisalDate?: string | undefined /** * The date when interest was last calculated for the account, in the organization's timezone and time format. */ - lastInterestCalculationDate?: string + lastInterestCalculationDate?: string | undefined /** * The date when regular interest was last reviewed, in the organization's timezone and time format. */ - lastInterestReviewDate?: string + lastInterestReviewDate?: string | undefined /** * The date when interest was last applied on the account, in the organization's timezone and time format. */ - lastInterestStoredDate?: string + lastInterestStoredDate?: string | undefined /** * The last update date for the deposit account, in UTC. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The date when the overdraft interest was last reviewed, in the organization's timezone and time format. */ - lastOverdraftInterestReviewDate?: string + lastOverdraftInterestReviewDate?: string | undefined /** * 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. */ - lastSetToArrearsDate?: string + lastSetToArrearsDate?: string | undefined /** * Lists all loan account keys on which the deposit account is used as the settlement account. */ - linkedSettlementAccountKeys?: string[] + linkedSettlementAccountKeys?: string[] | undefined /** * The date when the deposit account was locked, in the organization's timezone and time format. */ - lockedDate?: string + lockedDate?: string | undefined /** * The date when the account matures, for fixed or compulsory savings plans, in the organization's timezone and time format. */ - maturityDate?: string + maturityDate?: string | undefined /** * The migration event encoded key associated with this deposit account. If this account was imported, you can track which migration event it came from. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * The deposit account name. */ @@ -932,9 +954,9 @@ export interface DepositAccount { /** * The notes or description attached to this object. */ - notes?: string - overdraftInterestSettings?: DepositAccountOverdraftInterestSettings - overdraftSettings?: DepositAccountOverdraftSettings + notes?: string | undefined + overdraftInterestSettings?: DepositAccountOverdraftInterestSettings | undefined + overdraftSettings?: DepositAccountOverdraftSettings | undefined /** * The key to the product type that this account is based on. */ @@ -942,7 +964,7 @@ export interface DepositAccount { /** * The tax source where the account withholding taxes will be updated. */ - withholdingTaxSourceKey?: string + withholdingTaxSourceKey?: string | undefined } /** @@ -952,19 +974,19 @@ export interface DepositAccountAccruedAmounts { /** * The amount of positive interest that has been accrued in the account. */ - interestAccrued?: number + interestAccrued?: number | undefined /** * The amount of negative interest that has been accrued in the account. */ - negativeInterestAccrued?: number + negativeInterestAccrued?: number | undefined /** * The amount of overdraft interest that has been accrued in the account. */ - overdraftInterestAccrued?: number + overdraftInterestAccrued?: number | undefined /** * The amount of technical overdraft interest that has been accrued in the account. */ - technicalOverdraftInterestAccrued?: number + technicalOverdraftInterestAccrued?: number | undefined } /** @@ -974,47 +996,47 @@ export interface DepositAccountBalances { /** * The current available balance for deposit transactions. */ - availableBalance?: number + availableBalance?: number | undefined /** * The sum of all the blocked amounts on an account. */ - blockedBalance?: number + blockedBalance?: number | undefined /** * The amount of fees due to be paid on this account. */ - feesDue?: number + feesDue?: number | undefined /** * The sum of all the authorization hold amounts that have `CRDT` as the `creditDebitIndicator` for an account. */ - forwardAvailableBalance?: number + forwardAvailableBalance?: number | undefined /** * The sum of all the authorization hold amounts that have `DBIT` as the `creditDebitIndicator` for an account. */ - holdBalance?: number + holdBalance?: number | undefined /** * 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). */ - lockedBalance?: number + lockedBalance?: number | undefined /** * 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). */ - overdraftAmount?: number + overdraftAmount?: number | undefined /** * The amount of interest due to be paid on an account as a result of an authorized overdraft. */ - overdraftInterestDue?: number + overdraftInterestDue?: number | undefined /** * 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). */ - technicalOverdraftAmount?: number + technicalOverdraftAmount?: number | undefined /** * The amount of interest due to be paid on an account as a result of a technical overdraft. */ - technicalOverdraftInterestDue?: number + technicalOverdraftInterestDue?: number | undefined /** * The current balance of the account. */ - totalBalance?: number + totalBalance?: number | undefined } /** @@ -1024,7 +1046,7 @@ export interface DepositAccountInterestPaymentSettings { /** * The list of all dates when the interest is paid into the deposit account. */ - interestPaymentDates?: MonthAndDay[] + interestPaymentDates?: MonthAndDay[] | undefined /** * The interest payment point, which specifies when the interest should be paid to the account. */ @@ -1039,6 +1061,7 @@ export interface DepositAccountInterestPaymentSettings { | 'ANNUALLY' | 'BI_ANNUALLY' | 'ON_ACCOUNT_MATURITY' + | undefined } /** @@ -1048,43 +1071,50 @@ export interface DepositAccountInterestRateSettings { /** * The encoded key for the set of interest settings, which is auto-generated and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The interest charge frequency, which shows how often interest is charged on loan or deposit accounts. */ - interestChargeFrequency?: 'ANNUALIZED' | 'EVERY_MONTH' | 'EVERY_FOUR_WEEKS' | 'EVERY_WEEK' | 'EVERY_DAY' | 'EVERY_X_DAYS' + interestChargeFrequency?: + | 'ANNUALIZED' + | 'EVERY_MONTH' + | 'EVERY_FOUR_WEEKS' + | 'EVERY_WEEK' + | 'EVERY_DAY' + | 'EVERY_X_DAYS' + | undefined /** * The number of times to apply interest in a time period. */ - interestChargeFrequencyCount?: number + interestChargeFrequencyCount?: number | undefined /** * The interest rate for the deposit account. */ - interestRate?: number + interestRate?: number | undefined /** * The number of times to review the interest rate in a time period. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * The time unit to use to determine the frequency of interest rate reviews. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * The interest calculation method used. */ - interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' + interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' | undefined /** * The terms for how interest rate is determined when accruing for an account. */ - interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' + interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' | undefined /** * The list of interest rate tiers, which hold the values to define how interest is calculated. */ - interestRateTiers?: DepositAccountInterestRateTier[] + interestRateTiers?: DepositAccountInterestRateTier[] | undefined /** * The index interest rate that is used to calculate the interest rate that is applied to accounts. */ - interestSpread?: number + interestSpread?: number | undefined } /** @@ -1094,15 +1124,15 @@ export interface DepositAccountInterestRateTier { /** * The encoded key of the interest rate tier, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The top-limit value for the account balance in order to determine if this tier is used or not */ - endingBalance?: number + endingBalance?: number | undefined /** * The end date for the account period. Used to determine if this interest rate tier is used or not. */ - endingDay?: number + endingDay?: number | undefined /** * The rate used for computing the interest for an account which has the balance less than the ending balance */ @@ -1113,8 +1143,8 @@ export interface DepositAccountInterestRateTier { * Represents information about the deposit account's interest settings. */ export interface DepositAccountInterestSettings { - interestPaymentSettings?: DepositAccountInterestPaymentSettings - interestRateSettings?: DepositAccountInterestRateSettings + interestPaymentSettings?: DepositAccountInterestPaymentSettings | undefined + interestRateSettings?: DepositAccountInterestRateSettings | undefined } /** @@ -1124,19 +1154,19 @@ export interface DepositAccountInternalControls { /** * The maximum deposit balance of the account. */ - maxDepositBalance?: number + maxDepositBalance?: number | undefined /** * The maximum amount allowed for a withdrawal. */ - maxWithdrawalAmount?: number + maxWithdrawalAmount?: number | undefined /** * The recommended amount for a deposit. */ - recommendedDepositAmount?: number + recommendedDepositAmount?: number | undefined /** * The target amount for a deposit made towards a savings goal. */ - targetAmount?: number + targetAmount?: number | undefined } /** @@ -1146,50 +1176,57 @@ export interface DepositAccountOverdraftInterestRateSettings { /** * The encoded key for the set of interest settings, which is auto-generated and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The interest charge frequency, which shows how often interest is charged on loan or deposit accounts. */ - interestChargeFrequency?: 'ANNUALIZED' | 'EVERY_MONTH' | 'EVERY_FOUR_WEEKS' | 'EVERY_WEEK' | 'EVERY_DAY' | 'EVERY_X_DAYS' + interestChargeFrequency?: + | 'ANNUALIZED' + | 'EVERY_MONTH' + | 'EVERY_FOUR_WEEKS' + | 'EVERY_WEEK' + | 'EVERY_DAY' + | 'EVERY_X_DAYS' + | undefined /** * The number of times to apply interest in a time period. */ - interestChargeFrequencyCount?: number + interestChargeFrequencyCount?: number | undefined /** * The interest rate for the deposit account. */ - interestRate?: number + interestRate?: number | undefined /** * The number of times to review the interest rate in a time period. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * The time unit to use to determine the frequency of interest rate reviews. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * The interest calculation method used. */ - interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' + interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' | undefined /** * The terms for how interest rate is determined when accruing for an account. */ - interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' + interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' | undefined /** * The list of interest rate tiers, which hold the values to define how interest is calculated. */ - interestRateTiers?: DepositAccountInterestRateTier[] + interestRateTiers?: DepositAccountInterestRateTier[] | undefined /** * The index interest rate that is used to calculate the interest rate that is applied to accounts. */ - interestSpread?: number + interestSpread?: number | undefined } /** * Represents information about a deposit account's overdraft interest settings. */ export interface DepositAccountOverdraftInterestSettings { - interestRateSettings?: DepositAccountOverdraftInterestRateSettings + interestRateSettings?: DepositAccountOverdraftInterestRateSettings | undefined } /** @@ -1199,15 +1236,15 @@ export interface DepositAccountOverdraftSettings { /** * `TRUE` if this account supports overdraft, `FALSE` otherwise. */ - allowOverdraft?: boolean + allowOverdraft?: boolean | undefined /** * The expiration date of an overdraft. */ - overdraftExpiryDate?: string + overdraftExpiryDate?: string | undefined /** * The limit amount that may be taken out as overdraft, where null means 0. */ - overdraftLimit?: number + overdraftLimit?: number | undefined } /** @@ -1217,32 +1254,32 @@ export interface DisbursementDetails { /** * The activation date, the date when the disbursement actually took place. */ - disbursementDate?: string + disbursementDate?: string | undefined /** * The encoded key of the disbursement details, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The date of the expected disbursement.Stored as Organization Time. */ - expectedDisbursementDate?: string + expectedDisbursementDate?: string | undefined /** * List of fees that should be applied at the disbursement time. */ - fees?: CustomPredefinedFee[] + fees?: CustomPredefinedFee[] | undefined /** * The date of the expected first repayment. Stored as Organization Time. */ - firstRepaymentDate?: string - transactionDetails?: LoanTransactionDetails + firstRepaymentDate?: string | undefined + transactionDetails?: LoanTransactionDetails | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -1250,10 +1287,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -1264,25 +1302,25 @@ export interface FeeAmount { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The expected amount, which is the sum of unapplied fee and planned fee due amounts. */ - expectedUnapplied?: number + expectedUnapplied?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined } export type GetAllResponse = CreditArrangement[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -1290,6 +1328,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -1303,15 +1347,15 @@ export interface Guarantor { /** * The name of a value the client guarantees with (populated when the guaranty type is ASSET) */ - assetName?: string + assetName?: string | undefined /** * The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null. */ - depositAccountKey?: string + depositAccountKey?: string | undefined /** * The encoded key of the security, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The key of the client/group used as the guarantor. */ @@ -1329,108 +1373,94 @@ export interface Installment { /** * The installment due date. */ - dueDate?: string + dueDate?: string | undefined /** * The encoded key of the installment, which is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The expected closing balance is the remaining amount per installment only applicable for interest only equal installment products. */ - expectedClosingBalance?: number - fee?: InstallmentFee + expectedClosingBalance?: number | undefined + fee?: InstallmentFee | undefined /** * The breakdown of the fee amounts that have been applied to the loan account. */ - feeDetails?: InstallmentFeeDetails[] - interest?: InstallmentAllocationElementTaxableAmount + feeDetails?: InstallmentFeeDetails[] | undefined + interest?: InstallmentAllocationElementTaxableAmount | undefined /** * The interest accrued calculated on previous repayment closing balance only applicable interest only equal installment products. */ - interestAccrued?: number + interestAccrued?: number | undefined /** * `TRUE` if a payment holiday is offered for the installment, `FALSE` otherwise. */ - isPaymentHoliday?: boolean + isPaymentHoliday?: boolean | undefined /** * The installment last paid date. */ - lastPaidDate?: string + lastPaidDate?: string | undefined /** * The order number of an installment among all the installments generated for a loan. Loan installments are put in ascending order by due date. The order number only applies to the content of a particular JSON response therefore it is not unique. */ - number?: string + number?: string | undefined /** * The parent account key of the installment. */ - parentAccountKey?: string - penalty?: InstallmentAllocationElementTaxableAmount - principal?: InstallmentAllocationElementAmount + parentAccountKey?: string | undefined + penalty?: InstallmentAllocationElementTaxableAmount | undefined + principal?: InstallmentAllocationElementAmount | undefined /** * The installment repaid date. */ - repaidDate?: string + repaidDate?: string | undefined /** * The installment state. */ - state?: 'PENDING' | 'LATE' | 'PAID' | 'PARTIALLY_PAID' | 'GRACE' + state?: 'PENDING' | 'LATE' | 'PAID' | 'PARTIALLY_PAID' | 'GRACE' | undefined } /** * Represents an installment allocation element amount structure. */ export interface InstallmentAllocationElementAmount { - amount?: Amount + amount?: Amount | undefined } /** * Represents an installment allocation element taxable amount structure. */ export interface InstallmentAllocationElementTaxableAmount { - amount?: Amount - tax?: Amount + amount?: Amount | undefined + tax?: Amount | undefined } /** * Represents an installment fee structure. */ export interface InstallmentFee { - amount?: FeeAmount - tax?: Amount + amount?: FeeAmount | undefined + tax?: Amount | undefined } /** * Represents fee details for an installment. */ export interface InstallmentFeeDetails { - amount?: AmountWithReduced + amount?: AmountWithReduced | undefined /** * The encoded key of the predefined fee, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The id of the fee, provided by the client */ - id?: string + id?: string | undefined /** * The name of the fee */ - name?: string - tax?: AmountWithReduced -} - -/** - * Represents interest rate change threshold settings for loan accounts and loan products. - */ -export interface InterestRateChangePMTAdjustmentThreshold { - /** - * The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS - */ - method?: 'WORKING_DAYS' | 'CALENDAR_DAYS' - /** - * The number of days that trigger an interest rate change. - */ - numberOfDays?: number + name?: string | undefined + tax?: AmountWithReduced | undefined } /** @@ -1440,57 +1470,64 @@ export interface InterestSettings { /** * Adjustable interest rates settings for loan account */ - accountInterestRateSettings?: AccountInterestRateSettings[] + accountInterestRateSettings?: AccountInterestRateSettings[] | undefined /** * The accrue interest after maturity. If the product support this option, specify if the interest should be accrued after the account maturity date. */ - accrueInterestAfterMaturity?: boolean + accrueInterestAfterMaturity?: boolean | undefined /** * Indicates whether late interest is accrued for this loan account */ - accrueLateInterest?: boolean - interestApplicationDays?: DaysInMonth + accrueLateInterest?: boolean | 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. */ - interestApplicationMethod?: 'AFTER_DISBURSEMENT' | 'REPAYMENT_DUE_DATE' | 'FIXED_DAYS_OF_MONTH' + interestApplicationMethod?: 'AFTER_DISBURSEMENT' | 'REPAYMENT_DUE_DATE' | 'FIXED_DAYS_OF_MONTH' | undefined /** * The interest balance calculation method. Represents the option which determines the way the balance for the account's interest is computed. */ - interestBalanceCalculationMethod?: 'ONLY_PRINCIPAL' | 'PRINCIPAL_AND_INTEREST' + interestBalanceCalculationMethod?: 'ONLY_PRINCIPAL' | 'PRINCIPAL_AND_INTEREST' | undefined /** * The interest calculation method. Holds the type of interest calculation method. */ - interestCalculationMethod?: 'FLAT' | 'DECLINING_BALANCE' | 'DECLINING_BALANCE_DISCOUNTED' | 'EQUAL_INSTALLMENTS' + interestCalculationMethod?: 'FLAT' | 'DECLINING_BALANCE' | 'DECLINING_BALANCE_DISCOUNTED' | 'EQUAL_INSTALLMENTS' | undefined /** * The interest change frequency. Holds the possible values for how often is interest charged on loan or deposit accounts */ - interestChargeFrequency?: 'ANNUALIZED' | 'EVERY_MONTH' | 'EVERY_FOUR_WEEKS' | 'EVERY_WEEK' | 'EVERY_DAY' | 'EVERY_X_DAYS' + interestChargeFrequency?: + | 'ANNUALIZED' + | 'EVERY_MONTH' + | 'EVERY_FOUR_WEEKS' + | 'EVERY_WEEK' + | 'EVERY_DAY' + | 'EVERY_X_DAYS' + | undefined /** * 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. */ - interestRate?: number - interestRateChangePMTAdjustmentThreshold?: InterestRateChangePMTAdjustmentThreshold + interestRate?: number | undefined /** * Interest rate update frequency unit count. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * The interest rate review unit. Defines the interest rate update frequency measurement unit. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * The interest rate source. Represents the interest calculation method: fixed or (interest spread + active organization index interest rate) */ - interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' + interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' | undefined /** * Interest to be added to active organization index interest rate in order to find out actual interest rate */ - interestSpread?: number + interestSpread?: number | undefined /** * The possible values for how we compute and apply the interest */ - interestType?: 'SIMPLE_INTEREST' | 'CAPITALIZED_INTEREST' | 'COMPOUNDING_INTEREST' + interestType?: 'SIMPLE_INTEREST' | 'CAPITALIZED_INTEREST' | 'COMPOUNDING_INTEREST' | undefined + pmtAdjustmentThreshold?: PMTAdjustmentThreshold | undefined } /** @@ -1504,15 +1541,15 @@ export interface InvestorFund { /** * The name of a value the client guarantees with (populated when the guaranty type is ASSET) */ - assetName?: string + assetName?: string | undefined /** * The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null. */ - depositAccountKey?: string + depositAccountKey?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The key of the client/group used as the guarantor. */ @@ -1524,22 +1561,22 @@ export interface InvestorFund { /** * Investor fund unique identifier. All versions of an investor fund will have same id. */ - id?: string + id?: string | undefined /** * The constraint minimum value */ - interestCommission?: number + interestCommission?: number | undefined /** * Percentage of loan shares this investor owns */ - sharePercentage?: number + sharePercentage?: number | undefined } /** * 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. */ export interface LoanAccount { - accountArrearsSettings?: AccountArrearsSettings + accountArrearsSettings?: AccountArrearsSettings | undefined /** * The encoded key of the account holder. */ @@ -1551,7 +1588,7 @@ export interface LoanAccount { /** * The state of the loan account. */ - accountState?: 'PARTIAL_APPLICATION' | 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'ACTIVE_IN_ARREARS' | 'CLOSED' + accountState?: 'PARTIAL_APPLICATION' | 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'ACTIVE_IN_ARREARS' | 'CLOSED' | undefined /** * 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`. */ @@ -1566,134 +1603,139 @@ export interface LoanAccount { | 'REJECTED' | 'WRITTEN_OFF' | 'TERMINATED' + | undefined /** * The amount of interest that has been accrued in the loan account. */ - accruedInterest?: number + accruedInterest?: number | undefined /** * The accrued penalty, represents the amount of penalty that has been accrued in the loan account. */ - accruedPenalty?: number + accruedPenalty?: number | undefined /** * The encoded key of the transaction that activated the loan account. */ - activationTransactionKey?: string + activationTransactionKey?: string | undefined /** * DEPRECATED - Will always be false. */ - allowOffset?: boolean + allowOffset?: boolean | undefined /** * The date the loan account was approved. */ - approvedDate?: string + approvedDate?: string | undefined /** * The arrears tolerance (period or day of month) depending on the product settings. */ - arrearsTolerancePeriod?: number + arrearsTolerancePeriod?: number | undefined /** * The list of assets associated with the current loan account. */ - assets?: Asset[] + assets?: Asset[] | undefined /** * The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * The key of the centre this account is assigned to. */ - assignedCentreKey?: string + assignedCentreKey?: string | undefined /** * The key of the user this loan account is assigned to. */ - assignedUserKey?: string - balances?: Balances + assignedUserKey?: string | undefined + balances?: Balances | undefined /** * The date the loan was closed. */ - closedDate?: string + closedDate?: string | undefined /** * The date the loan account was created. */ - creationDate?: string + creationDate?: string | undefined /** * The key to the line of credit where this account is registered to. */ - creditArrangementKey?: string - currency?: Currency + creditArrangementKey?: string | undefined + currency?: Currency | undefined /** * The number of days the loan account is in arrears. */ - daysInArrears?: number + daysInArrears?: number | undefined /** * The number of days a repayment for the loan account is late. */ - daysLate?: number - disbursementDetails?: DisbursementDetails + daysLate?: number | undefined + disbursementDetails?: DisbursementDetails | undefined /** * The encoded key of the loan account, it is auto generated, and must be unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The list of funds associated with the loan account. */ - fundingSources?: InvestorFund[] + fundingSources?: InvestorFund[] | undefined /** * Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account. */ - futurePaymentsAcceptance?: 'NO_FUTURE_PAYMENTS' | 'ACCEPT_FUTURE_PAYMENTS' | 'ACCEPT_OVERPAYMENTS' + futurePaymentsAcceptance?: 'NO_FUTURE_PAYMENTS' | 'ACCEPT_FUTURE_PAYMENTS' | 'ACCEPT_OVERPAYMENTS' | undefined /** * The list of guarantees associated with the loan account. */ - guarantors?: Guarantor[] + guarantors?: Guarantor[] | undefined /** * The ID of the loan account, it can be generated and customized, and must be unique. */ - id?: string + id?: string | undefined /** * The interest that is accrued in the current billing cycle. */ - interestAccruedInBillingCycle?: number + interestAccruedInBillingCycle?: number | undefined /** * The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled. */ - interestCommission?: number + interestCommission?: number | undefined /** * The amount of interest from arrears that has been accrued in the loan account. */ - interestFromArrearsAccrued?: number - interestSettings?: InterestSettings + interestFromArrearsAccrued?: number | undefined + interestSettings?: InterestSettings | undefined /** * 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. */ - lastAccountAppraisalDate?: string + lastAccountAppraisalDate?: string | undefined /** * 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. */ - lastInterestAppliedDate?: string + lastInterestAppliedDate?: string | undefined /** * The date the interest was reviewed last time, stored in the organization time format and time zone. */ - lastInterestReviewDate?: string + lastInterestReviewDate?: string | undefined /** * 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. */ - lastLockedDate?: string + lastLockedDate?: string | undefined /** * The last date the loan was updated. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * 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. */ - lastSetToArrearsDate?: string + lastSetToArrearsDate?: string | undefined /** * The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone. */ - lastTaxRateReviewDate?: string + lastTaxRateReviewDate?: string | undefined /** * The overdue payments recalculation method inherited from the loan product on which this loan account is based. */ - latePaymentsRecalculationMethod?: 'OVERDUE_INSTALLMENTS_INCREASE' | 'LAST_INSTALLMENT_INCREASE' + latePaymentsRecalculationMethod?: + | 'OVERDUE_INSTALLMENTS_INCREASE' + | 'LAST_INSTALLMENT_INCREASE' + | 'NO_RECALCULATION' + | undefined /** * The loan amount. */ @@ -1701,72 +1743,72 @@ export interface LoanAccount { /** * The name of the loan account. */ - loanName?: string + loanName?: string | undefined /** * The locked account total due type. */ - lockedAccountTotalDueType?: 'BALANCE_AMOUNT' | 'DUE_AMOUNT_ON_LATE_INSTALLMENTS' + lockedAccountTotalDueType?: 'BALANCE_AMOUNT' | 'DUE_AMOUNT_ON_LATE_INSTALLMENTS' | undefined /** * A list with operations which are locked when the account is in the AccountState.LOCKED substate. */ - lockedOperations?: ('APPLY_INTEREST' | 'APPLY_FEES' | 'APPLY_PENALTIES')[] + lockedOperations?: ('APPLY_INTEREST' | 'APPLY_FEES' | 'APPLY_PENALTIES')[] | undefined /** * The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency */ - modifyInterestForFirstInstallment?: boolean + modifyInterestForFirstInstallment?: boolean | undefined /** * The notes about this loan account. */ - notes?: string + notes?: string | undefined /** * The key of the original rescheduled or refinanced loan account. */ - originalAccountKey?: string + originalAccountKey?: string | undefined /** * The amount of interest that has been accrued during payment holidays in the loan account. */ - paymentHolidaysAccruedInterest?: number + paymentHolidaysAccruedInterest?: number | undefined /** * The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account). */ - paymentMethod?: 'HORIZONTAL' | 'VERTICAL' - penaltySettings?: PenaltySettings + paymentMethod?: 'HORIZONTAL' | 'VERTICAL' | undefined + penaltySettings?: PenaltySettings | undefined /** * The list with manual fees planned on the installments of the loan account. */ - plannedInstallmentFees?: PlannedInstallmentFee[] - prepaymentSettings?: PrepaymentSettings - principalPaymentSettings?: PrincipalPaymentAccountSettings + plannedInstallmentFees?: PlannedInstallmentFee[] | undefined + prepaymentSettings?: PrepaymentSettings | undefined + principalPaymentSettings?: PrincipalPaymentAccountSettings | undefined /** * The key for the type of loan product that this loan account is based on. */ productTypeKey: string - redrawSettings?: LoanAccountRedrawSettings + redrawSettings?: LoanAccountRedrawSettings | undefined /** * The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled. */ - rescheduledAccountKey?: string + rescheduledAccountKey?: string | undefined scheduleSettings: ScheduleSettings /** * The encoded key of the settlement account. */ - settlementAccountKey?: string + settlementAccountKey?: string | undefined /** * The tax rate. */ - taxRate?: number + taxRate?: number | undefined /** * The date this loan account was terminated. */ - terminationDate?: string + terminationDate?: string | undefined /** * The list of disbursement tranches available for the loan account. */ - tranches?: LoanTranche[] + tranches?: LoanTranche[] | undefined } /** @@ -1787,19 +1829,19 @@ export interface LoanTranche { * The amount this tranche has available for disburse */ amount: number - disbursementDetails?: TrancheDisbursementDetails + disbursementDetails?: TrancheDisbursementDetails | undefined /** * The encoded key of the transaction details , auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Fees that are associated with this tranche */ - fees?: CustomPredefinedFee[] + fees?: CustomPredefinedFee[] | undefined /** * Index indicating the tranche number */ - trancheNumber?: number + trancheNumber?: number | undefined } /** @@ -1809,23 +1851,23 @@ export interface LoanTransactionDetails { /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Whether the transaction was transferred between loans or deposit accounts */ - internalTransfer?: boolean + internalTransfer?: boolean | undefined /** * In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made. */ - targetDepositAccountKey?: string + targetDepositAccountKey?: string | undefined /** * The ID of the transaction channel associated with the transaction details. */ - transactionChannelId?: string + transactionChannelId?: string | undefined /** * The encoded key of the transaction channel associated with the transaction details. */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } /** @@ -1835,11 +1877,11 @@ export interface MonthAndDay { /** * The day in the month */ - day?: number + day?: number | undefined /** * The month of the year */ - month?: number + month?: number | undefined } /** @@ -1849,7 +1891,7 @@ export interface PatchOperation { /** * The field from where a value should be moved, when using move */ - from?: string + from?: string | undefined /** * The change to perform */ @@ -1861,15 +1903,13 @@ export interface PatchOperation { /** * The value of the field, can be null */ - value?: { - [k: string]: unknown | undefined - } + value?: unknown } export type PatchRequest = PatchOperation[] export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, + validate: PatchRequestValidator as ValidateFunction, get schema() { return PatchRequest.validate.schema }, @@ -1877,10 +1917,11 @@ export const PatchRequest = { return PatchRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } }, } as const @@ -1891,11 +1932,16 @@ export interface PenaltySettings { /** * The last penalty calculation method, represents on what amount are the penalties calculated. */ - loanPenaltyCalculationMethod?: 'NONE' | 'OVERDUE_BALANCE' | 'OVERDUE_BALANCE_AND_INTEREST' | 'OUTSTANDING_PRINCIPAL' + loanPenaltyCalculationMethod?: + | 'NONE' + | 'OVERDUE_BALANCE' + | 'OVERDUE_BALANCE_AND_INTEREST' + | 'OUTSTANDING_PRINCIPAL' + | undefined /** * The penalty rate, represents the rate (in percent) which is charged as a penalty. */ - penaltyRate?: number + penaltyRate?: number | undefined } /** @@ -1909,7 +1955,7 @@ export interface PeriodicPayment { /** * The encoded key of the periodic payment, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The installment's position up to which the PMT will be used */ @@ -1923,29 +1969,43 @@ export interface PlannedInstallmentFee { /** * The amount of the planned fee. */ - amount?: number + amount?: number | undefined /** * 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. */ - applyOnDate?: string + applyOnDate?: string | undefined /** * The encoded key of the planned installment fee, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The encoded key of the installment on which the predefined fee is planned. */ - installmentKey?: string + installmentKey?: string | undefined /** * 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. */ - installmentNumber?: number + installmentNumber?: number | undefined /** * The encoded key of the predefined fee which is planned. */ predefinedFeeKey: string } +/** + * Represents PMT Adjustment threshold settings for loan accounts and loan products. + */ +export interface PMTAdjustmentThreshold { + /** + * The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS + */ + method?: 'WORKING_DAYS' | 'CALENDAR_DAYS' | undefined + /** + * The number of days that trigger a PMT Adjustment. + */ + numberOfDays?: number | undefined +} + /** * The prepayment settings, holds all prepayment properties. */ @@ -1953,16 +2013,16 @@ export interface PrepaymentSettings { /** * Apply interest on prepayment method copied from loan product on which this account is based. */ - applyInterestOnPrepaymentMethod?: 'AUTOMATIC' | 'MANUAL' + applyInterestOnPrepaymentMethod?: 'AUTOMATIC' | 'MANUAL' | undefined /** * The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated. */ - elementsRecalculationMethod?: 'PRINCIPAL_EXPECTED_FIXED' | 'TOTAL_EXPECTED_FIXED' - ercFreeAllowanceAmount?: number + elementsRecalculationMethod?: 'PRINCIPAL_EXPECTED_FIXED' | 'TOTAL_EXPECTED_FIXED' | undefined + ercFreeAllowanceAmount?: number | undefined /** * Early repayment charge fee free allowance in percentage per year */ - ercFreeAllowancePercentage?: number + ercFreeAllowancePercentage?: number | undefined /** * Prepayment recalculation method copied from the loan product on which this account is based. */ @@ -1975,10 +2035,11 @@ export interface PrepaymentSettings { | 'REDUCE_AMOUNT_PER_INSTALLMENT' | 'REDUCE_NUMBER_OF_INSTALLMENTS' | 'REDUCE_NUMBER_OF_INSTALLMENTS_NEW' + | undefined /** * Installment status for the case when principal is paid off (copied from loan product). */ - principalPaidInstallmentStatus?: 'PARTIALLY_PAID' | 'PAID' | 'ORIGINAL_TOTAL_EXPECTED_PAID' + principalPaidInstallmentStatus?: 'PARTIALLY_PAID' | 'PAID' | 'ORIGINAL_TOTAL_EXPECTED_PAID' | undefined } /** @@ -1988,31 +2049,31 @@ export interface PrincipalPaymentAccountSettings { /** * Fixed amount for being used for the repayments principal due. */ - amount?: number + amount?: number | undefined /** * The encoded key of the principal payment base settings, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account */ - includeFeesInFloorAmount?: boolean + includeFeesInFloorAmount?: boolean | undefined /** * Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account */ - includeInterestInFloorAmount?: boolean + includeInterestInFloorAmount?: boolean | undefined /** * Percentage of principal amount used for the repayments principal due. */ - percentage?: number + percentage?: number | undefined /** * The maximum principal due amount a repayment made with this settings can have */ - principalCeilingValue?: number + principalCeilingValue?: number | undefined /** * The minimum principal due amount a repayment made with this settings can have */ - principalFloorValue?: number + principalFloorValue?: number | undefined /** * The method of principal payment for revolving credit. */ @@ -2023,10 +2084,11 @@ export interface PrincipalPaymentAccountSettings { | 'TOTAL_BALANCE_PERCENTAGE' | 'TOTAL_BALANCE_FLAT' | 'TOTAL_PRINCIPAL_PERCENTAGE' + | undefined /** * The minimum total due amount a repayment made with this settings can have */ - totalDueAmountFloor?: number + totalDueAmountFloor?: number | undefined /** * The method of total due payment for revolving credit */ @@ -2037,6 +2099,7 @@ export interface PrincipalPaymentAccountSettings { | 'TOTAL_BALANCE_PERCENTAGE' | 'TOTAL_BALANCE_FLAT' | 'TOTAL_PRINCIPAL_PERCENTAGE' + | undefined } /** @@ -2054,8 +2117,7 @@ export interface RemoveCreditArrangementAccountInput { } export const RemoveCreditArrangementAccountInput = { - validate: (await import('./schemas/remove-credit-arrangement-account-input.schema.js')) - .validate as ValidateFunction, + validate: RemoveCreditArrangementAccountInputValidator as ValidateFunction, get schema() { return RemoveCreditArrangementAccountInput.validate.schema }, @@ -2063,17 +2125,18 @@ export const RemoveCreditArrangementAccountInput = { return RemoveCreditArrangementAccountInput.validate.errors ?? undefined }, is: (o: unknown): o is RemoveCreditArrangementAccountInput => RemoveCreditArrangementAccountInput.validate(o) === true, - assert: (o: unknown) => { - if (!RemoveCreditArrangementAccountInput.validate(o)) { - throw new ValidationError(RemoveCreditArrangementAccountInput.errors ?? []) + parse: (o: unknown): { right: RemoveCreditArrangementAccountInput } | { left: DefinedError[] } => { + if (RemoveCreditArrangementAccountInput.is(o)) { + return { right: o } } + return { left: (RemoveCreditArrangementAccountInput.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -2083,7 +2146,7 @@ export interface RevolvingAccountSettings { /** * The number of previewed instalments */ - numberOfPreviewedInstalments?: number + numberOfPreviewedInstalments?: number | undefined } /** @@ -2093,16 +2156,16 @@ export interface ScheduleSettings { /** * The PMT is calculated as the loan would have [amortizationPeriod] installments. */ - amortizationPeriod?: number - billingCycle?: BillingCycleDays + amortizationPeriod?: number | undefined + billingCycle?: BillingCycleDays | undefined /** * 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) */ - defaultFirstRepaymentDueDateOffset?: number + defaultFirstRepaymentDueDateOffset?: number | undefined /** * Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH. */ - fixedDaysOfMonth?: number[] + fixedDaysOfMonth?: number[] | undefined /** * The grace period. Represents the grace period for loan repayment - in number of installments. */ @@ -2110,54 +2173,54 @@ export interface ScheduleSettings { /** * The grace period type. Representing the type of grace period which is possible for a loan account. */ - gracePeriodType?: 'NONE' | 'PAY_INTEREST_ONLY' | 'INTEREST_FORGIVENESS' + gracePeriodType?: 'NONE' | 'PAY_INTEREST_ONLY' | 'INTEREST_FORGIVENESS' | undefined /** * Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due */ - hasCustomSchedule?: boolean + hasCustomSchedule?: boolean | undefined /** * A list of periodic payments for the current loan account. */ - paymentPlan?: PeriodicPayment[] + paymentPlan?: PeriodicPayment[] | undefined /** * The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments */ - periodicPayment?: number - previewSchedule?: RevolvingAccountSettings + periodicPayment?: number | undefined + previewSchedule?: RevolvingAccountSettings | undefined /** * The principal repayment interval. Indicates the interval of repayments that the principal has to be paid. */ - principalRepaymentInterval?: number + principalRepaymentInterval?: number | undefined /** * The repayment installments. Represents how many installments are required to pay back the loan. */ - repaymentInstallments?: number + repaymentInstallments?: number | undefined /** * The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option. */ - repaymentPeriodCount?: number + repaymentPeriodCount?: number | undefined /** * The repayment period unit. Represents the frequency of loan repayment. */ - repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' + repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' | undefined /** * 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. */ - repaymentScheduleMethod?: 'NONE' | 'FIXED' | 'DYNAMIC' + repaymentScheduleMethod?: 'NONE' | 'FIXED' | 'DYNAMIC' | undefined /** * The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments. */ - scheduleDueDatesMethod?: 'INTERVAL' | 'FIXED_DAYS_OF_MONTH' + scheduleDueDatesMethod?: 'INTERVAL' | 'FIXED_DAYS_OF_MONTH' | undefined /** * 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. */ - shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' + shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' | undefined } export type SearchResponse = CreditArrangement[] export const SearchResponse = { - validate: (await import('./schemas/search-response.schema.js')).validate as ValidateFunction, + validate: SearchResponseValidator as ValidateFunction, get schema() { return SearchResponse.validate.schema }, @@ -2165,6 +2228,12 @@ export const SearchResponse = { return SearchResponse.validate.errors ?? undefined }, is: (o: unknown): o is SearchResponse => SearchResponse.validate(o) === true, + parse: (o: unknown): { right: SearchResponse } | { left: DefinedError[] } => { + if (SearchResponse.is(o)) { + return { right: o } + } + return { left: (SearchResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -2174,9 +2243,9 @@ export interface TrancheDisbursementDetails { /** * The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement */ - disbursementTransactionKey?: string + disbursementTransactionKey?: string | undefined /** * The date when this tranche is supposed to be disbursed (as Organization Time) */ - expectedDisbursementDate?: string + expectedDisbursementDate?: string | undefined } diff --git a/src/credit-arrangements/schemas/add-credit-arrangement-account-input.schema.js b/src/credit-arrangements/schemas/add-credit-arrangement-account-input.schema.js index 5012964..5dbb768 100644 --- a/src/credit-arrangements/schemas/add-credit-arrangement-account-input.schema.js +++ b/src/credit-arrangements/schemas/add-credit-arrangement-account-input.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AddCreditArrangementAccountInput","type":"object","description":"Represents the account to add to the credit arrangement.","properties":{"accountId":{"type":"string","title":"accountId","description":"The encoded key of the account."},"accountType":{"title":"accountType","description":"The type of the account.","enum":["LOAN","DEPOSIT"]}},"required":["accountId","accountType"],"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.accountId === undefined) && (missing0 = "accountId")) || ((data.accountType === undefined) && (missing0 = "accountType"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountId !== undefined){const _errs2 = errors;if(typeof data.accountId !== "string"){validate10.errors = [{instancePath:instancePath+"/accountId",schemaPath:"#/properties/accountId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.accountType !== undefined){let data1 = data.accountType;const _errs4 = errors;if(!((data1 === "LOAN") || (data1 === "DEPOSIT"))){validate10.errors = [{instancePath:instancePath+"/accountType",schemaPath:"#/properties/accountType/enum",keyword:"enum",params:{allowedValues: schema11.properties.accountType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs4 === 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 +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AddCreditArrangementAccountInput","type":"object","description":"Represents the account to add to the credit arrangement.","properties":{"accountId":{"type":"string","description":"The encoded key of the account."},"accountType":{"description":"The type of the account.","enum":["LOAN","DEPOSIT"]}},"required":["accountId","accountType"],"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.accountId === undefined) && (missing0 = "accountId")) || ((data.accountType === undefined) && (missing0 = "accountType"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountId !== undefined){const _errs2 = errors;if(typeof data.accountId !== "string"){validate10.errors = [{instancePath:instancePath+"/accountId",schemaPath:"#/properties/accountId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.accountType !== undefined){let data1 = data.accountType;const _errs4 = errors;if(!((data1 === "LOAN") || (data1 === "DEPOSIT"))){validate10.errors = [{instancePath:instancePath+"/accountType",schemaPath:"#/properties/accountType/enum",keyword:"enum",params:{allowedValues: schema11.properties.accountType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs4 === 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/credit-arrangements/schemas/credit-arrangement-accounts.schema.js b/src/credit-arrangements/schemas/credit-arrangement-accounts.schema.js index 23e66f9..d91d992 100644 --- a/src/credit-arrangements/schemas/credit-arrangement-accounts.schema.js +++ b/src/credit-arrangements/schemas/credit-arrangement-accounts.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";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","title":"depositAccounts","description":"List of the deposit accounts linked to the credit arrangement.","items":{"$ref":"#/$defs/DepositAccountaf30"}},"loanAccounts":{"type":"array","title":"loanAccounts","description":"List of loan accounts linked to the credit arrangement.","items":{"$ref":"#/$defs/LoanAccountaf30"}}},"additionalProperties":true,"$defs":{"DepositAccountaf30":{"type":"object","title":"DepositAccountaf30","description":"Represents information about a deposit account.","properties":{"accountHolderKey":{"type":"string","title":"accountHolderKey","description":"The encoded key of the account holder, which is an individual client or group."},"accountHolderType":{"title":"accountHolderType","description":"The account holder type.","enum":["CLIENT","GROUP"]},"accountState":{"title":"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":{"title":"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":{"title":"accruedAmounts","$ref":"#/$defs/DepositAccountAccruedAmountsaf30"},"activationDate":{"type":"string","title":"activationDate","description":"The date when the deposit account was activated, in the organization's timezone and time format.","format":"date-time"},"approvedDate":{"type":"string","title":"approvedDate","description":"The date when the deposit account was approved, in the organization's timezone and time format.","format":"date-time"},"assignedBranchKey":{"type":"string","title":"assignedBranchKey","description":"The key of the branch that this deposit account is assigned to."},"assignedCentreKey":{"type":"string","title":"assignedCentreKey","description":"The key of the centre that this account is assigned to."},"assignedUserKey":{"type":"string","title":"assignedUserKey","description":"The key of the user that this deposit is assigned to."},"balances":{"title":"balances","$ref":"#/$defs/DepositAccountBalancesaf30"},"closedDate":{"type":"string","title":"closedDate","description":"The date when the deposit account was closed, in UTC.","format":"date-time"},"creationDate":{"type":"string","title":"creationDate","description":"The date this deposit account was created, in UTC.","format":"date-time"},"creditArrangementKey":{"type":"string","title":"creditArrangementKey","description":"The key to the credit arrangement where this account is registered."},"currencyCode":{"type":"string","title":"currencyCode","description":"The currency code."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the deposit account, which is auto-generated and unique."},"id":{"type":"string","title":"id","description":"The ID of the deposit account, which can be generated and customized - but must be unique."},"interestSettings":{"title":"interestSettings","$ref":"#/$defs/DepositAccountInterestSettingsaf30"},"internalControls":{"title":"internalControls","$ref":"#/$defs/DepositAccountInternalControlsaf30"},"lastAccountAppraisalDate":{"type":"string","title":"lastAccountAppraisalDate","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","title":"lastInterestCalculationDate","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","title":"lastInterestReviewDate","description":"The date when regular interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastInterestStoredDate":{"type":"string","title":"lastInterestStoredDate","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","title":"lastModifiedDate","description":"The last update date for the deposit account, in UTC.","format":"date-time"},"lastOverdraftInterestReviewDate":{"type":"string","title":"lastOverdraftInterestReviewDate","description":"The date when the overdraft interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","title":"lastSetToArrearsDate","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","title":"linkedSettlementAccountKeys","description":"Lists all loan account keys on which the deposit account is used as the settlement account.","items":{"type":"string"}},"lockedDate":{"type":"string","title":"lockedDate","description":"The date when the deposit account was locked, in the organization's timezone and time format.","format":"date-time"},"maturityDate":{"type":"string","title":"maturityDate","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","title":"migrationEventKey","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","title":"name","description":"The deposit account name."},"notes":{"type":"string","title":"notes","description":"The notes or description attached to this object."},"overdraftInterestSettings":{"title":"overdraftInterestSettings","$ref":"#/$defs/DepositAccountOverdraftInterestSettingsaf30"},"overdraftSettings":{"title":"overdraftSettings","$ref":"#/$defs/DepositAccountOverdraftSettingsaf30"},"productTypeKey":{"type":"string","title":"productTypeKey","description":"The key to the product type that this account is based on."},"withholdingTaxSourceKey":{"type":"string","title":"withholdingTaxSourceKey","description":"The tax source where the account withholding taxes will be updated."}},"required":["accountHolderKey","accountHolderType","name","productTypeKey"],"additionalProperties":true},"DepositAccountAccruedAmountsaf30":{"type":"object","title":"DepositAccountAccruedAmountsaf30","description":"Represents information about the accrued amounts of deposit accounts.","properties":{"interestAccrued":{"type":"number","title":"interestAccrued","description":"The amount of positive interest that has been accrued in the account."},"negativeInterestAccrued":{"type":"number","title":"negativeInterestAccrued","description":"The amount of negative interest that has been accrued in the account."},"overdraftInterestAccrued":{"type":"number","title":"overdraftInterestAccrued","description":"The amount of overdraft interest that has been accrued in the account."},"technicalOverdraftInterestAccrued":{"type":"number","title":"technicalOverdraftInterestAccrued","description":"The amount of technical overdraft interest that has been accrued in the account."}},"additionalProperties":true},"DepositAccountBalancesaf30":{"type":"object","title":"DepositAccountBalancesaf30","description":"Represents information about the balances of a deposit account.","properties":{"availableBalance":{"type":"number","title":"availableBalance","description":"The current available balance for deposit transactions."},"blockedBalance":{"type":"number","title":"blockedBalance","description":"The sum of all the blocked amounts on an account."},"feesDue":{"type":"number","title":"feesDue","description":"The amount of fees due to be paid on this account."},"forwardAvailableBalance":{"type":"number","title":"forwardAvailableBalance","description":"The sum of all the authorization hold amounts that have `CRDT` as the `creditDebitIndicator` for an account."},"holdBalance":{"type":"number","title":"holdBalance","description":"The sum of all the authorization hold amounts that have `DBIT` as the `creditDebitIndicator` for an account."},"lockedBalance":{"type":"number","title":"lockedBalance","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","title":"overdraftAmount","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","title":"overdraftInterestDue","description":"The amount of interest due to be paid on an account as a result of an authorized overdraft."},"technicalOverdraftAmount":{"type":"number","title":"technicalOverdraftAmount","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","title":"technicalOverdraftInterestDue","description":"The amount of interest due to be paid on an account as a result of a technical overdraft."},"totalBalance":{"type":"number","title":"totalBalance","description":"The current balance of the account."}},"additionalProperties":true},"DepositAccountInterestSettingsaf30":{"type":"object","title":"DepositAccountInterestSettingsaf30","description":"Represents information about the deposit account's interest settings.","properties":{"interestPaymentSettings":{"title":"interestPaymentSettings","$ref":"#/$defs/DepositAccountInterestPaymentSettingsaf30"},"interestRateSettings":{"title":"interestRateSettings","$ref":"#/$defs/DepositAccountInterestRateSettingsaf30"}},"additionalProperties":true},"DepositAccountInterestPaymentSettingsaf30":{"type":"object","title":"DepositAccountInterestPaymentSettingsaf30","description":"Represents information about the interest payment settings.","properties":{"interestPaymentDates":{"type":"array","title":"interestPaymentDates","description":"The list of all dates when the interest is paid into the deposit account.","items":{"$ref":"#/$defs/MonthAndDayaf30"}},"interestPaymentPoint":{"title":"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},"MonthAndDayaf30":{"type":"object","title":"MonthAndDayaf30","description":"Wrapper for month and day for instances where the year isn't needed","properties":{"day":{"type":"integer","title":"day","description":"The day in the month"},"month":{"type":"integer","title":"month","description":"The month of the year"}},"additionalProperties":true},"DepositAccountInterestRateSettingsaf30":{"type":"object","title":"DepositAccountInterestRateSettingsaf30","description":"Represents information about the interest rate settings for deposit accounts.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key for the set of interest settings, which is auto-generated and unique."},"interestChargeFrequency":{"title":"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","title":"interestChargeFrequencyCount","description":"The number of times to apply interest in a time period."},"interestRate":{"type":"number","title":"interestRate","description":"The interest rate for the deposit account."},"interestRateReviewCount":{"type":"integer","title":"interestRateReviewCount","description":"The number of times to review the interest rate in a time period."},"interestRateReviewUnit":{"title":"interestRateReviewUnit","description":"The time unit to use to determine the frequency of interest rate reviews.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"title":"interestRateSource","description":"The interest calculation method used.","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"title":"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","title":"interestRateTiers","description":"The list of interest rate tiers, which hold the values to define how interest is calculated.","items":{"$ref":"#/$defs/DepositAccountInterestRateTieraf30"}},"interestSpread":{"type":"number","title":"interestSpread","description":"The index interest rate that is used to calculate the interest rate that is applied to accounts."}},"additionalProperties":true},"DepositAccountInterestRateTieraf30":{"type":"object","title":"DepositAccountInterestRateTieraf30","description":"Represents information about how interest rate is calculated.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","title":"endingBalance","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"endingDay":{"type":"integer","title":"endingDay","description":"The end date for the account period. Used to determine if this interest rate tier is used or not."},"interestRate":{"type":"number","title":"interestRate","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true},"DepositAccountInternalControlsaf30":{"type":"object","title":"DepositAccountInternalControlsaf30","description":"Represents information about internal controls.","properties":{"maxDepositBalance":{"type":"number","title":"maxDepositBalance","description":"The maximum deposit balance of the account."},"maxWithdrawalAmount":{"type":"number","title":"maxWithdrawalAmount","description":"The maximum amount allowed for a withdrawal."},"recommendedDepositAmount":{"type":"number","title":"recommendedDepositAmount","description":"The recommended amount for a deposit."},"targetAmount":{"type":"number","title":"targetAmount","description":"The target amount for a deposit made towards a savings goal."}},"additionalProperties":true},"DepositAccountOverdraftInterestSettingsaf30":{"type":"object","title":"DepositAccountOverdraftInterestSettingsaf30","description":"Represents information about a deposit account's overdraft interest settings.","properties":{"interestRateSettings":{"title":"interestRateSettings","$ref":"#/$defs/DepositAccountOverdraftInterestRateSettingsaf30"}},"additionalProperties":true},"DepositAccountOverdraftInterestRateSettingsaf30":{"type":"object","title":"DepositAccountOverdraftInterestRateSettingsaf30","description":"Represents information about overdraft interest rate settings for deposit accounts.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key for the set of interest settings, which is auto-generated and unique."},"interestChargeFrequency":{"title":"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","title":"interestChargeFrequencyCount","description":"The number of times to apply interest in a time period."},"interestRate":{"type":"number","title":"interestRate","description":"The interest rate for the deposit account."},"interestRateReviewCount":{"type":"integer","title":"interestRateReviewCount","description":"The number of times to review the interest rate in a time period."},"interestRateReviewUnit":{"title":"interestRateReviewUnit","description":"The time unit to use to determine the frequency of interest rate reviews.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"title":"interestRateSource","description":"The interest calculation method used.","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"title":"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","title":"interestRateTiers","description":"The list of interest rate tiers, which hold the values to define how interest is calculated.","items":{"$ref":"#/$defs/DepositAccountInterestRateTieraf30"}},"interestSpread":{"type":"number","title":"interestSpread","description":"The index interest rate that is used to calculate the interest rate that is applied to accounts."}},"additionalProperties":true},"DepositAccountOverdraftSettingsaf30":{"type":"object","title":"DepositAccountOverdraftSettingsaf30","description":"Represents information about a deposit account's overdraft settings.","properties":{"allowOverdraft":{"type":"boolean","title":"allowOverdraft","description":"`TRUE` if this account supports overdraft, `FALSE` otherwise."},"overdraftExpiryDate":{"type":"string","title":"overdraftExpiryDate","description":"The expiration date of an overdraft.","format":"date-time"},"overdraftLimit":{"type":"number","title":"overdraftLimit","description":"The limit amount that may be taken out as overdraft, where null means 0."}},"additionalProperties":true},"LoanAccountaf30":{"type":"object","title":"LoanAccountaf30","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":{"title":"accountArrearsSettings","$ref":"#/$defs/AccountArrearsSettingsaf30"},"accountHolderKey":{"type":"string","title":"accountHolderKey","description":"The encoded key of the account holder."},"accountHolderType":{"title":"accountHolderType","description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"title":"accountState","description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"title":"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","title":"accruedInterest","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","title":"accruedPenalty","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","title":"activationTransactionKey","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","title":"allowOffset","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","title":"approvedDate","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","title":"arrearsTolerancePeriod","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","title":"assets","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Assetaf30"}},"assignedBranchKey":{"type":"string","title":"assignedBranchKey","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","title":"assignedCentreKey","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","title":"assignedUserKey","description":"The key of the user this loan account is assigned to."},"balances":{"title":"balances","$ref":"#/$defs/Balancesaf30"},"closedDate":{"type":"string","title":"closedDate","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","title":"creationDate","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","title":"creditArrangementKey","description":"The key to the line of credit where this account is registered to."},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"daysInArrears":{"type":"integer","title":"daysInArrears","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","title":"daysLate","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/DisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","title":"fundingSources","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFundaf30"}},"futurePaymentsAcceptance":{"title":"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","title":"guarantors","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantoraf30"}},"id":{"type":"string","title":"id","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","title":"interestAccruedInBillingCycle","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","title":"interestCommission","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","title":"interestFromArrearsAccrued","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"title":"interestSettings","$ref":"#/$defs/InterestSettingsaf30"},"lastAccountAppraisalDate":{"type":"string","title":"lastAccountAppraisalDate","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","title":"lastInterestAppliedDate","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","title":"lastInterestReviewDate","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","title":"lastLockedDate","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","title":"lastModifiedDate","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","title":"lastSetToArrearsDate","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","title":"lastTaxRateReviewDate","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":{"title":"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"]},"loanAmount":{"type":"number","title":"loanAmount","description":"The loan amount."},"loanName":{"type":"string","title":"loanName","description":"The name of the loan account."},"lockedAccountTotalDueType":{"title":"lockedAccountTotalDueType","description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","title":"lockedOperations","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","title":"migrationEventKey","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","title":"modifyInterestForFirstInstallment","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","title":"notes","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","title":"originalAccountKey","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","title":"paymentHolidaysAccruedInterest","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"title":"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":{"title":"penaltySettings","$ref":"#/$defs/PenaltySettingsaf30"},"plannedInstallmentFees":{"type":"array","title":"plannedInstallmentFees","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFeeaf30"}},"prepaymentSettings":{"title":"prepaymentSettings","$ref":"#/$defs/PrepaymentSettingsaf30"},"principalPaymentSettings":{"title":"principalPaymentSettings","$ref":"#/$defs/PrincipalPaymentAccountSettingsaf30"},"productTypeKey":{"type":"string","title":"productTypeKey","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"title":"redrawSettings","$ref":"#/$defs/LoanAccountRedrawSettingsaf30"},"rescheduledAccountKey":{"type":"string","title":"rescheduledAccountKey","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"title":"scheduleSettings","$ref":"#/$defs/ScheduleSettingsaf30"},"settlementAccountKey":{"type":"string","title":"settlementAccountKey","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","title":"taxRate","description":"The tax rate."},"terminationDate":{"type":"string","title":"terminationDate","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","title":"tranches","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTrancheaf30"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true},"AccountArrearsSettingsaf30":{"type":"object","title":"AccountArrearsSettingsaf30","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"title":"dateCalculationMethod","description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","title":"monthlyToleranceDay","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"title":"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":{"title":"toleranceCalculationMethod","description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","title":"toleranceFloorAmount","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","title":"tolerancePercentageOfOutstandingPrincipal","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","title":"tolerancePeriod","description":"Defines the arrears tolerance period value."}},"additionalProperties":true},"Assetaf30":{"type":"object","title":"Assetaf30","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","title":"originalAmount","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"title":"originalCurrency","$ref":"#/$defs/Currencyaf30"}},"required":["amount","assetName"],"additionalProperties":true},"Currencyaf30":{"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true},"Balancesaf30":{"type":"object","title":"Balancesaf30","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","title":"feesBalance","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","title":"feesDue","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","title":"feesPaid","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","title":"holdBalance","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","title":"interestBalance","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","title":"interestDue","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","title":"interestFromArrearsBalance","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","title":"interestFromArrearsDue","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","title":"interestFromArrearsPaid","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","title":"interestPaid","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","title":"penaltyBalance","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","title":"penaltyDue","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","title":"penaltyPaid","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","title":"principalBalance","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","title":"principalDue","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","title":"principalPaid","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","title":"redrawBalance","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true},"DisbursementDetailsaf30":{"type":"object","title":"DisbursementDetailsaf30","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","title":"disbursementDate","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","title":"expectedDisbursementDate","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","title":"fees","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"firstRepaymentDate":{"type":"string","title":"firstRepaymentDate","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"title":"transactionDetails","$ref":"#/$defs/LoanTransactionDetailsaf30"}},"additionalProperties":true},"CustomPredefinedFeeaf30":{"type":"object","title":"CustomPredefinedFeeaf30","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","title":"amount","description":"The amount of the custom fee."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","title":"percentage","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","title":"predefinedFeeEncodedKey","description":"The encoded key of the predefined fee"}},"additionalProperties":true},"LoanTransactionDetailsaf30":{"type":"object","title":"LoanTransactionDetailsaf30","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","title":"internalTransfer","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","title":"targetDepositAccountKey","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","title":"transactionChannelId","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true},"InvestorFundaf30":{"type":"object","title":"InvestorFundaf30","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","title":"id","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","title":"interestCommission","description":"The constraint minimum value"},"sharePercentage":{"type":"number","title":"sharePercentage","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true},"Guarantoraf30":{"type":"object","title":"Guarantoraf30","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","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true},"InterestSettingsaf30":{"type":"object","title":"InterestSettingsaf30","description":"The interest settings, holds all the properties regarding interests for the loan account.","properties":{"accountInterestRateSettings":{"type":"array","title":"accountInterestRateSettings","description":"Adjustable interest rates settings for loan account","items":{"$ref":"#/$defs/AccountInterestRateSettingsaf30"}},"accrueInterestAfterMaturity":{"type":"boolean","title":"accrueInterestAfterMaturity","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","title":"accrueLateInterest","description":"Indicates whether late interest is accrued for this loan account"},"interestApplicationDays":{"title":"interestApplicationDays","$ref":"#/$defs/DaysInMonthaf30"},"interestApplicationMethod":{"title":"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":{"title":"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":{"title":"interestCalculationMethod","description":"The interest calculation method. Holds the type of interest calculation method.","enum":["FLAT","DECLINING_BALANCE","DECLINING_BALANCE_DISCOUNTED","EQUAL_INSTALLMENTS"]},"interestChargeFrequency":{"title":"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","title":"interestRate","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."},"interestRateChangePMTAdjustmentThreshold":{"title":"interestRateChangePMTAdjustmentThreshold","$ref":"#/$defs/InterestRateChangePMTAdjustmentThresholdaf30"},"interestRateReviewCount":{"type":"integer","title":"interestRateReviewCount","description":"Interest rate update frequency unit count."},"interestRateReviewUnit":{"title":"interestRateReviewUnit","description":"The interest rate review unit. Defines the interest rate update frequency measurement unit.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"title":"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","title":"interestSpread","description":"Interest to be added to active organization index interest rate in order to find out actual interest rate"},"interestType":{"title":"interestType","description":"The possible values for how we compute and apply the interest","enum":["SIMPLE_INTEREST","CAPITALIZED_INTEREST","COMPOUNDING_INTEREST"]}},"additionalProperties":true},"AccountInterestRateSettingsaf30":{"type":"object","title":"AccountInterestRateSettingsaf30","description":"Adjustable interest rates settings for loan account","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate settings, auto generated, unique"},"indexSourceKey":{"type":"string","title":"indexSourceKey","description":"Index rate source key."},"interestRate":{"type":"number","title":"interestRate","description":"Interest rate value."},"interestRateCeilingValue":{"type":"number","title":"interestRateCeilingValue","description":"Maximum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateFloorValue":{"type":"number","title":"interestRateFloorValue","description":"Minimum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateReviewCount":{"type":"integer","title":"interestRateReviewCount","description":"Interest rate review frequency unit count. Valid only for index interest rate."},"interestRateReviewUnit":{"title":"interestRateReviewUnit","description":"Interest rate review frequency measurement unit. Valid only for index interest rate.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"title":"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","title":"interestSpread","description":"Interest spread value."},"validFrom":{"type":"string","title":"validFrom","description":"Date since an interest rate is valid","format":"date-time"}},"required":["interestRateSource","validFrom"],"additionalProperties":true},"DaysInMonthaf30":{"type":"object","title":"DaysInMonthaf30","description":"Enumeration for days of month and method of handling shorter months.","properties":{"daysInMonth":{"type":"array","title":"daysInMonth","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":{"title":"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},"InterestRateChangePMTAdjustmentThresholdaf30":{"type":"object","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"additionalProperties":true},"PenaltySettingsaf30":{"type":"object","title":"PenaltySettingsaf30","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"title":"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","title":"penaltyRate","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFeeaf30":{"type":"object","title":"PlannedInstallmentFeeaf30","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","title":"applyOnDate","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","title":"encodedKey","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","title":"installmentKey","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","title":"installmentNumber","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","title":"predefinedFeeKey","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettingsaf30":{"type":"object","title":"PrepaymentSettingsaf30","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowanceAmount"},"ercFreeAllowancePercentage":{"type":"number","title":"ercFreeAllowancePercentage","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"title":"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":{"title":"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},"PrincipalPaymentAccountSettingsaf30":{"type":"object","title":"PrincipalPaymentAccountSettingsaf30","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","title":"amount","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","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","title":"percentage","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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},"LoanAccountRedrawSettingsaf30":{"type":"object","title":"LoanAccountRedrawSettingsaf30","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","title":"restrictNextDueWithdrawal","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettingsaf30":{"type":"object","title":"ScheduleSettingsaf30","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","title":"amortizationPeriod","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"title":"billingCycle","$ref":"#/$defs/BillingCycleDaysaf30"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","title":"defaultFirstRepaymentDueDateOffset","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","title":"fixedDaysOfMonth","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","title":"gracePeriod","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"title":"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","title":"hasCustomSchedule","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","title":"paymentPlan","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPaymentaf30"}},"periodicPayment":{"type":"number","title":"periodicPayment","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"title":"previewSchedule","$ref":"#/$defs/RevolvingAccountSettingsaf30"},"principalRepaymentInterval":{"type":"integer","title":"principalRepaymentInterval","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","title":"repaymentInstallments","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","title":"repaymentPeriodCount","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"title":"repaymentPeriodUnit","description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"title":"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":{"title":"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":{"title":"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},"BillingCycleDaysaf30":{"type":"object","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPaymentaf30":{"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettingsaf30":{"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTrancheaf30":{"type":"object","title":"LoanTrancheaf30","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","title":"amount","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/TrancheDisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","title":"fees","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"trancheNumber":{"type":"integer","title":"trancheNumber","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetailsaf30":{"type":"object","title":"TrancheDisbursementDetailsaf30","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","title":"disbursementTransactionKey","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","title":"expectedDisbursementDate","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"DepositAccountaf30","description":"Represents information about a deposit account.","properties":{"accountHolderKey":{"type":"string","title":"accountHolderKey","description":"The encoded key of the account holder, which is an individual client or group."},"accountHolderType":{"title":"accountHolderType","description":"The account holder type.","enum":["CLIENT","GROUP"]},"accountState":{"title":"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":{"title":"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":{"title":"accruedAmounts","$ref":"#/$defs/DepositAccountAccruedAmountsaf30"},"activationDate":{"type":"string","title":"activationDate","description":"The date when the deposit account was activated, in the organization's timezone and time format.","format":"date-time"},"approvedDate":{"type":"string","title":"approvedDate","description":"The date when the deposit account was approved, in the organization's timezone and time format.","format":"date-time"},"assignedBranchKey":{"type":"string","title":"assignedBranchKey","description":"The key of the branch that this deposit account is assigned to."},"assignedCentreKey":{"type":"string","title":"assignedCentreKey","description":"The key of the centre that this account is assigned to."},"assignedUserKey":{"type":"string","title":"assignedUserKey","description":"The key of the user that this deposit is assigned to."},"balances":{"title":"balances","$ref":"#/$defs/DepositAccountBalancesaf30"},"closedDate":{"type":"string","title":"closedDate","description":"The date when the deposit account was closed, in UTC.","format":"date-time"},"creationDate":{"type":"string","title":"creationDate","description":"The date this deposit account was created, in UTC.","format":"date-time"},"creditArrangementKey":{"type":"string","title":"creditArrangementKey","description":"The key to the credit arrangement where this account is registered."},"currencyCode":{"type":"string","title":"currencyCode","description":"The currency code."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the deposit account, which is auto-generated and unique."},"id":{"type":"string","title":"id","description":"The ID of the deposit account, which can be generated and customized - but must be unique."},"interestSettings":{"title":"interestSettings","$ref":"#/$defs/DepositAccountInterestSettingsaf30"},"internalControls":{"title":"internalControls","$ref":"#/$defs/DepositAccountInternalControlsaf30"},"lastAccountAppraisalDate":{"type":"string","title":"lastAccountAppraisalDate","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","title":"lastInterestCalculationDate","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","title":"lastInterestReviewDate","description":"The date when regular interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastInterestStoredDate":{"type":"string","title":"lastInterestStoredDate","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","title":"lastModifiedDate","description":"The last update date for the deposit account, in UTC.","format":"date-time"},"lastOverdraftInterestReviewDate":{"type":"string","title":"lastOverdraftInterestReviewDate","description":"The date when the overdraft interest was last reviewed, in the organization's timezone and time format.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","title":"lastSetToArrearsDate","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","title":"linkedSettlementAccountKeys","description":"Lists all loan account keys on which the deposit account is used as the settlement account.","items":{"type":"string"}},"lockedDate":{"type":"string","title":"lockedDate","description":"The date when the deposit account was locked, in the organization's timezone and time format.","format":"date-time"},"maturityDate":{"type":"string","title":"maturityDate","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","title":"migrationEventKey","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","title":"name","description":"The deposit account name."},"notes":{"type":"string","title":"notes","description":"The notes or description attached to this object."},"overdraftInterestSettings":{"title":"overdraftInterestSettings","$ref":"#/$defs/DepositAccountOverdraftInterestSettingsaf30"},"overdraftSettings":{"title":"overdraftSettings","$ref":"#/$defs/DepositAccountOverdraftSettingsaf30"},"productTypeKey":{"type":"string","title":"productTypeKey","description":"The key to the product type that this account is based on."},"withholdingTaxSourceKey":{"type":"string","title":"withholdingTaxSourceKey","description":"The tax source where the account withholding taxes will be updated."}},"required":["accountHolderKey","accountHolderType","name","productTypeKey"],"additionalProperties":true};const schema13 = {"type":"object","title":"DepositAccountAccruedAmountsaf30","description":"Represents information about the accrued amounts of deposit accounts.","properties":{"interestAccrued":{"type":"number","title":"interestAccrued","description":"The amount of positive interest that has been accrued in the account."},"negativeInterestAccrued":{"type":"number","title":"negativeInterestAccrued","description":"The amount of negative interest that has been accrued in the account."},"overdraftInterestAccrued":{"type":"number","title":"overdraftInterestAccrued","description":"The amount of overdraft interest that has been accrued in the account."},"technicalOverdraftInterestAccrued":{"type":"number","title":"technicalOverdraftInterestAccrued","description":"The amount of technical overdraft interest that has been accrued in the account."}},"additionalProperties":true};const schema14 = {"type":"object","title":"DepositAccountBalancesaf30","description":"Represents information about the balances of a deposit account.","properties":{"availableBalance":{"type":"number","title":"availableBalance","description":"The current available balance for deposit transactions."},"blockedBalance":{"type":"number","title":"blockedBalance","description":"The sum of all the blocked amounts on an account."},"feesDue":{"type":"number","title":"feesDue","description":"The amount of fees due to be paid on this account."},"forwardAvailableBalance":{"type":"number","title":"forwardAvailableBalance","description":"The sum of all the authorization hold amounts that have `CRDT` as the `creditDebitIndicator` for an account."},"holdBalance":{"type":"number","title":"holdBalance","description":"The sum of all the authorization hold amounts that have `DBIT` as the `creditDebitIndicator` for an account."},"lockedBalance":{"type":"number","title":"lockedBalance","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","title":"overdraftAmount","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","title":"overdraftInterestDue","description":"The amount of interest due to be paid on an account as a result of an authorized overdraft."},"technicalOverdraftAmount":{"type":"number","title":"technicalOverdraftAmount","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","title":"technicalOverdraftInterestDue","description":"The amount of interest due to be paid on an account as a result of a technical overdraft."},"totalBalance":{"type":"number","title":"totalBalance","description":"The current balance of the account."}},"additionalProperties":true};const schema20 = {"type":"object","title":"DepositAccountInternalControlsaf30","description":"Represents information about internal controls.","properties":{"maxDepositBalance":{"type":"number","title":"maxDepositBalance","description":"The maximum deposit balance of the account."},"maxWithdrawalAmount":{"type":"number","title":"maxWithdrawalAmount","description":"The maximum amount allowed for a withdrawal."},"recommendedDepositAmount":{"type":"number","title":"recommendedDepositAmount","description":"The recommended amount for a deposit."},"targetAmount":{"type":"number","title":"targetAmount","description":"The target amount for a deposit made towards a savings goal."}},"additionalProperties":true};const schema24 = {"type":"object","title":"DepositAccountOverdraftSettingsaf30","description":"Represents information about a deposit account's overdraft settings.","properties":{"allowOverdraft":{"type":"boolean","title":"allowOverdraft","description":"`TRUE` if this account supports overdraft, `FALSE` otherwise."},"overdraftExpiryDate":{"type":"string","title":"overdraftExpiryDate","description":"The expiration date of an overdraft.","format":"date-time"},"overdraftLimit":{"type":"number","title":"overdraftLimit","description":"The limit amount that may be taken out as overdraft, where null means 0."}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;const schema15 = {"type":"object","title":"DepositAccountInterestSettingsaf30","description":"Represents information about the deposit account's interest settings.","properties":{"interestPaymentSettings":{"title":"interestPaymentSettings","$ref":"#/$defs/DepositAccountInterestPaymentSettingsaf30"},"interestRateSettings":{"title":"interestRateSettings","$ref":"#/$defs/DepositAccountInterestRateSettingsaf30"}},"additionalProperties":true};const schema16 = {"type":"object","title":"DepositAccountInterestPaymentSettingsaf30","description":"Represents information about the interest payment settings.","properties":{"interestPaymentDates":{"type":"array","title":"interestPaymentDates","description":"The list of all dates when the interest is paid into the deposit account.","items":{"$ref":"#/$defs/MonthAndDayaf30"}},"interestPaymentPoint":{"title":"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","title":"MonthAndDayaf30","description":"Wrapper for month and day for instances where the year isn't needed","properties":{"day":{"type":"integer","title":"day","description":"The day in the month"},"month":{"type":"integer","title":"month","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","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"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","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema47 = {"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema48 = {"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","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/BillingCycleDaysaf30/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/BillingCycleDaysaf30/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate30.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDaysaf30/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"},"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 = require("ajv/dist/runtime/equal").default;const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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 + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'500', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '500'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).post(`crons/eod:run`, { + this.buildClient(auth).post('crons/eod:run', { headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', }), @@ -58,40 +76,48 @@ export class MambuCrons { 401: ErrorResponse, 403: ErrorResponse, 500: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -118,24 +144,52 @@ export class MambuCrons { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/crons/rest.type.ts b/src/crons/rest.type.ts index 2859128..0fefd71 100644 --- a/src/crons/rest.type.ts +++ b/src/crons/rest.type.ts @@ -3,15 +3,18 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as TriggerHourlyAndEndOfDayProcessingResponseValidator } from './schemas/trigger-hourly-and-end-of-day-processing-response.schema.js' export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -19,17 +22,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -51,11 +55,11 @@ export interface TriggerHourlyAndEndOfDayProcessingResponse { | 'TRANSIENT_ERROR' | 'OVERRIDDEN' | 'RECOVERABLE_ERROR' + | undefined } export const TriggerHourlyAndEndOfDayProcessingResponse = { - validate: (await import('./schemas/trigger-hourly-and-end-of-day-processing-response.schema.js')) - .validate as ValidateFunction, + validate: TriggerHourlyAndEndOfDayProcessingResponseValidator as ValidateFunction, get schema() { return TriggerHourlyAndEndOfDayProcessingResponse.validate.schema }, @@ -64,4 +68,10 @@ export const TriggerHourlyAndEndOfDayProcessingResponse = { }, is: (o: unknown): o is TriggerHourlyAndEndOfDayProcessingResponse => TriggerHourlyAndEndOfDayProcessingResponse.validate(o) === true, + parse: (o: unknown): { right: TriggerHourlyAndEndOfDayProcessingResponse } | { left: DefinedError[] } => { + if (TriggerHourlyAndEndOfDayProcessingResponse.is(o)) { + return { right: o } + } + return { left: (TriggerHourlyAndEndOfDayProcessingResponse.errors ?? []) as DefinedError[] } + }, } as const diff --git a/src/crons/schemas/error-response.schema.js b/src/crons/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/crons/schemas/error-response.schema.js +++ b/src/crons/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/currencies.yaml`, { + this.buildClient(auth).get('configuration/currencies.yaml', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update currencies configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/currencies.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/currencies.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -139,24 +175,52 @@ export class MambuCurrenciesConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/currencies/index.ts b/src/currencies/index.ts index f231972..9afdc32 100644 --- a/src/currencies/index.ts +++ b/src/currencies/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuCurrencies } from './rest.client.js' export * as currencies from './rest.type.js' diff --git a/src/currencies/rest.client.ts b/src/currencies/rest.client.ts index 33448be..4e7b365 100644 --- a/src/currencies/rest.client.ts +++ b/src/currencies/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { CurrencyDetails, ErrorResponse, GetAllResponse } from './rest.type.js' /** @@ -46,64 +49,103 @@ export class MambuCurrencies { /** * Create currency */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: CurrencyDetails - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(CurrencyDetails, body) + }: { body: CurrencyDetails; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', CurrencyDetails> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CurrencyDetails, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`currencies`, { + this.buildClient(auth).post('currencies', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: CurrencyDetails, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete currency by code */ - public async delete({ + public delete({ path, auth = [['apiKey'], ['basic']], - }: { - path: { currencyCode: string } - auth?: string[][] | string[] - }) { + }: { path: { currencyCode: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`currencies/${path.currencyCode}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get currency by code */ - public async get({ path, auth = [['apiKey'], ['basic']] }: { path: { currencyCode: string }; auth?: string[][] | string[] }) { + public get({ + path, + query, + auth = [['apiKey'], ['basic']], + }: { path: { currencyCode: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', CurrencyDetails> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`currencies/${path.currencyCode}`, { + searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', }), @@ -112,22 +154,34 @@ export class MambuCurrencies { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get all currencies */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { - query?: { offset?: string; limit?: string; paginationDetails?: string; type?: string } + query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string; type?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`currencies`, { + this.buildClient(auth).get('currencies', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -137,23 +191,36 @@ export class MambuCurrencies { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update currency by code */ - public async update({ + public update({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: CurrencyDetails - path: { currencyCode: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(CurrencyDetails, body) + }: { body: CurrencyDetails; path: { currencyCode: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', CurrencyDetails> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CurrencyDetails, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`currencies/${path.currencyCode}`, { @@ -167,45 +234,66 @@ export class MambuCurrencies { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -232,24 +320,52 @@ export class MambuCurrencies { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/currencies/rest.type.ts b/src/currencies/rest.type.ts index 5f6ea5a..0879ad4 100644 --- a/src/currencies/rest.type.ts +++ b/src/currencies/rest.type.ts @@ -3,8 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as CurrencyDetailsValidator } from './schemas/currency-details.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' /** * Represents a currency. @@ -21,7 +25,11 @@ export interface CurrencyDetails { /** * The date this currency was created. It cannot be changed and it's a read-only field not required for update operations. */ - creationDate?: string + creationDate?: string | undefined + /** + * The list of holidays for this currency. + */ + currencyHolidays?: Holiday[] | undefined /** * The currency symbol position. */ @@ -29,11 +37,11 @@ export interface CurrencyDetails { /** * The number of digits that are supported for a given currency. */ - digitsAfterDecimal?: number + digitsAfterDecimal?: number | undefined /** * The last date this currency was modified. It's updated automatically and it's a read-only field not required for update operations. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The name of the currency. */ @@ -41,7 +49,7 @@ export interface CurrencyDetails { /** * The currency numeric code. */ - numericCode?: string + numericCode?: string | undefined /** * The currency symbol. */ @@ -53,7 +61,7 @@ export interface CurrencyDetails { } export const CurrencyDetails = { - validate: (await import('./schemas/currency-details.schema.js')).validate as ValidateFunction, + validate: CurrencyDetailsValidator as ValidateFunction, get schema() { return CurrencyDetails.validate.schema }, @@ -61,19 +69,20 @@ export const CurrencyDetails = { return CurrencyDetails.validate.errors ?? undefined }, is: (o: unknown): o is CurrencyDetails => CurrencyDetails.validate(o) === true, - assert: (o: unknown) => { - if (!CurrencyDetails.validate(o)) { - throw new ValidationError(CurrencyDetails.errors ?? []) + parse: (o: unknown): { right: CurrencyDetails } | { left: DefinedError[] } => { + if (CurrencyDetails.is(o)) { + return { right: o } } + return { left: (CurrencyDetails.errors ?? []) as DefinedError[] } }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -81,17 +90,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = CurrencyDetails[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -99,10 +109,46 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const +/** + * Represents the holiday. + */ +export interface Holiday { + /** + * The date when the holiday was created. + */ + creationDate?: string | undefined + /** + * The date the holiday takes place. + */ + date?: string | undefined + /** + * The encoded key of the entity, generated, globally unique + */ + encodedKey?: string | undefined + /** + * The ID of the holiday. + */ + id?: number | undefined + /** + * `TRUE` if a holiday is annually recurring, `FALSE` otherwise. + */ + isAnnuallyRecurring?: boolean | undefined + /** + * The name of the holiday. + */ + name?: string | undefined +} + export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/currencies/schemas/currency-details.schema.js b/src/currencies/schemas/currency-details.schema.js index e900355..a263b79 100644 --- a/src/currencies/schemas/currency-details.schema.js +++ b/src/currencies/schemas/currency-details.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CurrencyDetails","type":"object","description":"Represents a currency.","properties":{"baseCurrency":{"type":"boolean","title":"baseCurrency","description":"`TRUE` if the currency is the base currency, `FALSE` otherwise. It cannot be changed and it's a read-only field not required for update operations."},"code":{"type":"string","title":"code","description":"The currency code, which cannot be changed once the currency is created."},"creationDate":{"type":"string","title":"creationDate","description":"The date this currency was created. It cannot be changed and it's a read-only field not required for update operations.","format":"date-time"},"currencySymbolPosition":{"title":"currencySymbolPosition","description":"The currency symbol position.","enum":["BEFORE_NUMBER","AFTER_NUMBER"]},"digitsAfterDecimal":{"type":"integer","title":"digitsAfterDecimal","description":"The number of digits that are supported for a given currency."},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last date this currency was modified. It's updated automatically and it's a read-only field not required for update operations.","format":"date-time"},"name":{"type":"string","title":"name","description":"The name of the currency."},"numericCode":{"type":"string","title":"numericCode","description":"The currency numeric code."},"symbol":{"type":"string","title":"symbol","description":"The currency symbol."},"type":{"title":"type","description":"The type of the currency.","enum":["FIAT_CURRENCY","CRYPTOCURRENCY","NON_TRADITIONAL_CURRENCY"]}},"required":["baseCurrency","code","currencySymbolPosition","name","symbol","type"],"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;let valid0 = true;for( missing0 of schema11.required){valid0 = data[missing0] !== undefined;if(!valid0){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;break;}}if(valid0){if(data.baseCurrency !== undefined){const _errs2 = errors;if(typeof data.baseCurrency !== "boolean"){validate10.errors = [{instancePath:instancePath+"/baseCurrency",schemaPath:"#/properties/baseCurrency/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid1 = _errs2 === errors;}else {var valid1 = true;}if(valid1){if(data.code !== undefined){const _errs4 = errors;if(typeof data.code !== "string"){validate10.errors = [{instancePath:instancePath+"/code",schemaPath:"#/properties/code/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid1 = _errs4 === errors;}else {var valid1 = true;}if(valid1){if(data.creationDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){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 valid1 = _errs6 === errors;}else {var valid1 = true;}if(valid1){if(data.currencySymbolPosition !== undefined){let data3 = data.currencySymbolPosition;const _errs8 = errors;if(!((data3 === "BEFORE_NUMBER") || (data3 === "AFTER_NUMBER"))){validate10.errors = [{instancePath:instancePath+"/currencySymbolPosition",schemaPath:"#/properties/currencySymbolPosition/enum",keyword:"enum",params:{allowedValues: schema11.properties.currencySymbolPosition.enum},message:"must be equal to one of the allowed values"}];return false;}var valid1 = _errs8 === errors;}else {var valid1 = true;}if(valid1){if(data.digitsAfterDecimal !== undefined){let data4 = data.digitsAfterDecimal;const _errs9 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/digitsAfterDecimal",schemaPath:"#/properties/digitsAfterDecimal/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid1 = _errs9 === errors;}else {var valid1 = true;}if(valid1){if(data.lastModifiedDate !== undefined){const _errs11 = errors;if(errors === _errs11){if(errors === _errs11){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 valid1 = _errs11 === errors;}else {var valid1 = true;}if(valid1){if(data.name !== undefined){const _errs13 = 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 valid1 = _errs13 === errors;}else {var valid1 = true;}if(valid1){if(data.numericCode !== undefined){const _errs15 = errors;if(typeof data.numericCode !== "string"){validate10.errors = [{instancePath:instancePath+"/numericCode",schemaPath:"#/properties/numericCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid1 = _errs15 === errors;}else {var valid1 = true;}if(valid1){if(data.symbol !== undefined){const _errs17 = errors;if(typeof data.symbol !== "string"){validate10.errors = [{instancePath:instancePath+"/symbol",schemaPath:"#/properties/symbol/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid1 = _errs17 === errors;}else {var valid1 = true;}if(valid1){if(data.type !== undefined){let data9 = data.type;const _errs19 = errors;if(!(((data9 === "FIAT_CURRENCY") || (data9 === "CRYPTOCURRENCY")) || (data9 === "NON_TRADITIONAL_CURRENCY"))){validate10.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/enum",keyword:"enum",params:{allowedValues: schema11.properties.type.enum},message:"must be equal to one of the allowed values"}];return false;}var valid1 = _errs19 === errors;}else {var valid1 = 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CurrencyDetails","type":"object","description":"Represents a currency.","properties":{"baseCurrency":{"type":"boolean","description":"`TRUE` if the currency is the base currency, `FALSE` otherwise. It cannot be changed and it's a read-only field not required for update operations."},"code":{"type":"string","description":"The currency code, which cannot be changed once the currency is created."},"creationDate":{"type":"string","description":"The date this currency was created. It cannot be changed and it's a read-only field not required for update operations.","format":"date-time"},"currencyHolidays":{"type":"array","description":"The list of holidays for this currency.","items":{"$ref":"#/$defs/Holiday"}},"currencySymbolPosition":{"description":"The currency symbol position.","enum":["BEFORE_NUMBER","AFTER_NUMBER"]},"digitsAfterDecimal":{"type":"integer","description":"The number of digits that are supported for a given currency."},"lastModifiedDate":{"type":"string","description":"The last date this currency was modified. It's updated automatically and it's a read-only field not required for update operations.","format":"date-time"},"name":{"type":"string","description":"The name of the currency."},"numericCode":{"type":"string","description":"The currency numeric code."},"symbol":{"type":"string","description":"The currency symbol."},"type":{"description":"The type of the currency.","enum":["FIAT_CURRENCY","CRYPTOCURRENCY","NON_TRADITIONAL_CURRENCY"]}},"required":["baseCurrency","code","currencySymbolPosition","name","symbol","type"],"additionalProperties":true,"$defs":{"Holiday":{"type":"object","description":"Represents the holiday.","properties":{"creationDate":{"type":"string","description":"The date when the holiday was created.","format":"date-time"},"date":{"type":"string","description":"The date the holiday takes place.","format":"date"},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"id":{"type":"integer","description":"The ID of the holiday."},"isAnnuallyRecurring":{"type":"boolean","description":"`TRUE` if a holiday is annually recurring, `FALSE` otherwise."},"name":{"type":"string","description":"The name of the holiday."}},"additionalProperties":true}}};const schema12 = {"type":"object","description":"Represents the holiday.","properties":{"creationDate":{"type":"string","description":"The date when the holiday was created.","format":"date-time"},"date":{"type":"string","description":"The date the holiday takes place.","format":"date"},"encodedKey":{"type":"string","description":"The encoded key of the entity, generated, globally unique"},"id":{"type":"integer","description":"The ID of the holiday."},"isAnnuallyRecurring":{"type":"boolean","description":"`TRUE` if a holiday is annually recurring, `FALSE` otherwise."},"name":{"type":"string","description":"The name of the holiday."}},"additionalProperties":true};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];const formats4 = require("ajv-formats/dist/formats").fullFormats.date;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;let valid0 = true;for( missing0 of schema11.required){valid0 = data[missing0] !== undefined;if(!valid0){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;break;}}if(valid0){if(data.baseCurrency !== undefined){const _errs2 = errors;if(typeof data.baseCurrency !== "boolean"){validate10.errors = [{instancePath:instancePath+"/baseCurrency",schemaPath:"#/properties/baseCurrency/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid1 = _errs2 === errors;}else {var valid1 = true;}if(valid1){if(data.code !== undefined){const _errs4 = errors;if(typeof data.code !== "string"){validate10.errors = [{instancePath:instancePath+"/code",schemaPath:"#/properties/code/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid1 = _errs4 === errors;}else {var valid1 = true;}if(valid1){if(data.creationDate !== undefined){let data2 = data.creationDate;const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(typeof data2 === "string"){if(!(formats0.validate(data2))){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid1 = _errs6 === errors;}else {var valid1 = true;}if(valid1){if(data.currencyHolidays !== undefined){let data3 = data.currencyHolidays;const _errs8 = errors;if(errors === _errs8){if(Array.isArray(data3)){var valid2 = true;const len0 = data3.length;for(let i0=0; i0 + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`customfieldsets`, { + this.buildClient(auth).get('customfieldsets', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -71,14 +86,14 @@ export class MambuCustomFieldSets { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get custom field definitions by custom field set */ - public async getAllBySetId({ + public getAllBySetId({ path, query, auth = [['apiKey'], ['basic']], @@ -86,7 +101,20 @@ export class MambuCustomFieldSets { path: { customFieldSetId: string } query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetAllBySetIdResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`customfieldsets/${path.customFieldSetId}/customfields`, { searchParams: query ?? {}, @@ -99,40 +127,48 @@ export class MambuCustomFieldSets { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -159,24 +195,52 @@ export class MambuCustomFieldSets { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/custom-field-sets/rest.type.ts b/src/custom-field-sets/rest.type.ts index 4e4a368..4c43340 100644 --- a/src/custom-field-sets/rest.type.ts +++ b/src/custom-field-sets/rest.type.ts @@ -3,8 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllBySetIdResponseValidator } from './schemas/get-all-by-set-id-response.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' /** * Represents one option of a selection custom field definition. @@ -13,15 +17,15 @@ export interface CustomFieldAvailableOption { /** * The score of the option. */ - score?: number + score?: number | undefined /** * The system-generated ID of the option. */ - selectionKey?: string + selectionKey?: string | undefined /** * The name of the option. */ - value?: string + value?: string | undefined } /** @@ -41,22 +45,23 @@ export interface CustomFieldDisplaySettings { | 'MOBILE_PHONE_2' | 'HOME_PHONE' | 'EMAIL_ADDRESS' + | undefined /** * The user-provided description of the custom field definition. */ - description?: string + description?: string | undefined /** * The user-provided name of the custom field definition. */ - displayName?: string + displayName?: string | undefined /** * The custom field value display size in the UI. */ - fieldSize?: 'SHORT' | 'LONG' + fieldSize?: 'SHORT' | 'LONG' | undefined /** * The custom field definition position in the custom field set. */ - position?: number + position?: number | undefined } /** @@ -66,11 +71,11 @@ export interface CustomFieldEditRights { /** * `TRUE` if custom field values of a custom field definition can be edited by all users, `FALSE` if custom field values of a custom field definition can only be edited by users with the specified roles. */ - allUsers?: boolean + allUsers?: boolean | undefined /** * The list of IDs of the roles that have edit rights for the custom field values of a custom field definition if it is not accessible by all users. */ - roles?: string[] + roles?: string[] | undefined } /** @@ -80,11 +85,11 @@ export interface CustomFieldIdentity { /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * User-provided ID of the custom field */ - id?: string + id?: string | undefined } /** @@ -108,46 +113,57 @@ export interface CustomFieldMeta { | 'BRANCH' | 'CENTRE' | 'USER' + | undefined /** * The date the custom field definition was created. */ - creationDate?: string + creationDate?: string | undefined /** * Can be defined only for selection custom field definitions. Indicates the parent custom field definition on which the dependency is based upon. */ - dependentFieldKey?: string - displaySettings?: CustomFieldDisplaySettings - editRights?: CustomFieldEditRights + dependentFieldKey?: string | undefined + displaySettings?: CustomFieldDisplaySettings | undefined + editRights?: CustomFieldEditRights | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The user-defined ID, which is globally unique. */ - id?: string + id?: string | undefined /** * The date the latest update was performed for this custom field definition. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * Can be defined only for selection custom field definitions. Indicates that the field has predefined selections and only those can be used to populate it. */ - selectionOptions?: CustomFieldSelectionOption[] + selectionOptions?: CustomFieldSelectionOption[] | undefined /** * Indicates whether the custom field definition is active or inactive. */ - state?: 'ACTIVE' | 'INACTIVE' + state?: 'ACTIVE' | 'INACTIVE' | undefined /** * The type of custom field definition. */ - type?: 'FREE_TEXT' | 'SELECTION' | 'NUMBER' | 'CHECKBOX' | 'DATE' | 'DATE_TIME' | 'CLIENT_LINK' | 'GROUP_LINK' | 'USER_LINK' + type?: + | 'FREE_TEXT' + | 'SELECTION' + | 'NUMBER' + | 'CHECKBOX' + | 'DATE' + | 'DATE_TIME' + | 'CLIENT_LINK' + | 'GROUP_LINK' + | 'USER_LINK' + | undefined /** * Represents the usage settings of a custom field definition. */ - usage?: CustomFieldUsage[] - valueValidationSettings?: CustomFieldValueValidationSettings - viewRights?: CustomFieldViewRights + usage?: CustomFieldUsage[] | undefined + valueValidationSettings?: CustomFieldValueValidationSettings | undefined + viewRights?: CustomFieldViewRights | undefined } /** @@ -157,15 +173,15 @@ export interface CustomFieldSelectionOption { /** * The list of options that that are available for the dependent selection custom field value based on the selected parent custom field value. */ - availableOptions?: CustomFieldAvailableOption[] + availableOptions?: CustomFieldAvailableOption[] | undefined /** * The key for the parent selection custom field value. */ - forSelectionKey?: string + forSelectionKey?: string | undefined /** * The parent selection custom field value. */ - forValue?: string + forValue?: string | undefined } /** @@ -177,15 +193,15 @@ export interface CustomFieldSetDisplaySettings { * True - when this is a "mambu" field set, * False - when this is a tenant-defined field set */ - builtIn?: boolean + builtIn?: boolean | undefined /** * User-provided name of the custom field set */ - displayName?: string + displayName?: string | undefined /** * Represents the order of the custom field set (starts from 0) */ - position?: number + position?: number | undefined } /** @@ -209,31 +225,32 @@ export interface CustomFieldSetMeta { | 'BRANCH' | 'CENTRE' | 'USER' + | undefined /** * Date at which the custom field set was created */ - creationDate?: string + creationDate?: string | undefined /** * This section lists all the custom fields associated with this set */ - customFields?: CustomFieldIdentity[] + customFields?: CustomFieldIdentity[] | undefined /** * Free text field to store eventual notes with regard to custom field group purpose/details */ - description?: string - displaySettings?: CustomFieldSetDisplaySettings + description?: string | undefined + displaySettings?: CustomFieldSetDisplaySettings | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The usage decides how the custom field set will be used in the UI and how the custom field values will be stored. For STANDARD set type the custom field set can be used only once (i.e Personal Information). For GROUPED set type the custom field set can be used multiple times (i.e Addresses). For further details please see [here](https://support.mambu.com/customer/en/portal/articles/1986000-custom-fields?b_id=873#2) */ - fieldSetType?: 'STANDARD' | 'GROUPED' + fieldSetType?: 'STANDARD' | 'GROUPED' | undefined /** * User-defined ID, gobally unique */ - id?: string + id?: string | undefined } /** @@ -243,15 +260,15 @@ export interface CustomFieldUsage { /** * `TRUE` if the field is displayed by default on create or edit pages for this record type, `FALSE` otherwise. */ - default?: boolean + default?: boolean | undefined /** * The key of the record type. */ - objectKey?: string + objectKey?: string | undefined /** * `TRUE` if the field is required for this record type, `FALSE` otherwise. */ - required?: boolean + required?: boolean | undefined } /** @@ -261,11 +278,11 @@ export interface CustomFieldValueValidationSettings { /** * `TRUE` if this field does not allow duplicate values, `FALSE` otherwise. */ - unique?: boolean + unique?: boolean | undefined /** * The expected format for the input. */ - validationPattern?: string + validationPattern?: string | undefined } /** @@ -275,19 +292,19 @@ export interface CustomFieldViewRights { /** * `TRUE` if custom field values of a custom field definition can be viewed by all users, `FALSE` if custom field values of a custom field definition can only be viewed by users with the specified roles. */ - allUsers?: boolean + allUsers?: boolean | undefined /** * Lists the IDs of the roles that have view rights for the custom field values of a custom field definition if it is not accessible by all users. */ - roles?: string[] + roles?: string[] | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -295,18 +312,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllBySetIdResponse = CustomFieldMeta[] export const GetAllBySetIdResponse = { - validate: (await import('./schemas/get-all-by-set-id-response.schema.js')) - .validate as ValidateFunction, + validate: GetAllBySetIdResponseValidator as ValidateFunction, get schema() { return GetAllBySetIdResponse.validate.schema }, @@ -314,12 +331,18 @@ export const GetAllBySetIdResponse = { return GetAllBySetIdResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllBySetIdResponse => GetAllBySetIdResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllBySetIdResponse } | { left: DefinedError[] } => { + if (GetAllBySetIdResponse.is(o)) { + return { right: o } + } + return { left: (GetAllBySetIdResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetAllResponse = CustomFieldSetMeta[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -327,10 +350,16 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/custom-field-sets/schemas/error-response.schema.js b/src/custom-field-sets/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/custom-field-sets/schemas/error-response.schema.js +++ b/src/custom-field-sets/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/customfields.yaml`, { + this.buildClient(auth).get('configuration/customfields.yaml', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Get custom field definitions configuration template */ - public async getTemplate({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public getTemplate({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/customfields/template.yaml`, { + this.buildClient(auth).get('configuration/customfields/template.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update custom field definitions configuration */ - public async update({ + public update({ headers, auth = [['apiKey'], ['basic']], - }: { headers?: { ['X-Mambu-Async']?: string; ['X-Mambu-Callback']?: string }; auth?: string[][] | string[] } = {}) { + }: { headers?: { 'X-Mambu-Async'?: string; 'X-Mambu-Callback'?: string }; auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | SuccessResponse<'202', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/customfields.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml', ...headers }, + this.buildClient(auth).put('configuration/customfields.yaml', { + headers: headers ?? {}, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 202: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 202: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -159,24 +197,52 @@ export class MambuCustomFieldsConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/custom-fields/index.ts b/src/custom-fields/index.ts index d2083da..0f68787 100644 --- a/src/custom-fields/index.ts +++ b/src/custom-fields/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuCustomFields } from './rest.client.js' export * as customFields from './rest.type.js' diff --git a/src/custom-fields/rest.client.ts b/src/custom-fields/rest.client.ts index 0b6194f..b3d94ae 100644 --- a/src/custom-fields/rest.client.ts +++ b/src/custom-fields/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { CustomFieldMeta, ErrorResponse } from './rest.type.js' /** @@ -46,15 +49,24 @@ export class MambuCustomFields { /** * Get custom field definition */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { customfieldId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { customfieldId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', CustomFieldMeta> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`customfields/${path.customfieldId}`, { searchParams: query ?? {}, @@ -67,40 +79,48 @@ export class MambuCustomFields { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -127,24 +147,52 @@ export class MambuCustomFields { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/custom-fields/rest.type.ts b/src/custom-fields/rest.type.ts index 0c140cd..99912ae 100644 --- a/src/custom-fields/rest.type.ts +++ b/src/custom-fields/rest.type.ts @@ -3,8 +3,11 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as CustomFieldMetaValidator } from './schemas/custom-field-meta.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' /** * Represents one option of a selection custom field definition. @@ -13,15 +16,15 @@ export interface CustomFieldAvailableOption { /** * The score of the option. */ - score?: number + score?: number | undefined /** * The system-generated ID of the option. */ - selectionKey?: string + selectionKey?: string | undefined /** * The name of the option. */ - value?: string + value?: string | undefined } /** @@ -41,22 +44,23 @@ export interface CustomFieldDisplaySettings { | 'MOBILE_PHONE_2' | 'HOME_PHONE' | 'EMAIL_ADDRESS' + | undefined /** * The user-provided description of the custom field definition. */ - description?: string + description?: string | undefined /** * The user-provided name of the custom field definition. */ - displayName?: string + displayName?: string | undefined /** * The custom field value display size in the UI. */ - fieldSize?: 'SHORT' | 'LONG' + fieldSize?: 'SHORT' | 'LONG' | undefined /** * The custom field definition position in the custom field set. */ - position?: number + position?: number | undefined } /** @@ -66,11 +70,11 @@ export interface CustomFieldEditRights { /** * `TRUE` if custom field values of a custom field definition can be edited by all users, `FALSE` if custom field values of a custom field definition can only be edited by users with the specified roles. */ - allUsers?: boolean + allUsers?: boolean | undefined /** * The list of IDs of the roles that have edit rights for the custom field values of a custom field definition if it is not accessible by all users. */ - roles?: string[] + roles?: string[] | undefined } /** @@ -94,50 +98,61 @@ export interface CustomFieldMeta { | 'BRANCH' | 'CENTRE' | 'USER' + | undefined /** * The date the custom field definition was created. */ - creationDate?: string + creationDate?: string | undefined /** * Can be defined only for selection custom field definitions. Indicates the parent custom field definition on which the dependency is based upon. */ - dependentFieldKey?: string - displaySettings?: CustomFieldDisplaySettings - editRights?: CustomFieldEditRights + dependentFieldKey?: string | undefined + displaySettings?: CustomFieldDisplaySettings | undefined + editRights?: CustomFieldEditRights | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The user-defined ID, which is globally unique. */ - id?: string + id?: string | undefined /** * The date the latest update was performed for this custom field definition. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * Can be defined only for selection custom field definitions. Indicates that the field has predefined selections and only those can be used to populate it. */ - selectionOptions?: CustomFieldSelectionOption[] + selectionOptions?: CustomFieldSelectionOption[] | undefined /** * Indicates whether the custom field definition is active or inactive. */ - state?: 'ACTIVE' | 'INACTIVE' + state?: 'ACTIVE' | 'INACTIVE' | undefined /** * The type of custom field definition. */ - type?: 'FREE_TEXT' | 'SELECTION' | 'NUMBER' | 'CHECKBOX' | 'DATE' | 'DATE_TIME' | 'CLIENT_LINK' | 'GROUP_LINK' | 'USER_LINK' + type?: + | 'FREE_TEXT' + | 'SELECTION' + | 'NUMBER' + | 'CHECKBOX' + | 'DATE' + | 'DATE_TIME' + | 'CLIENT_LINK' + | 'GROUP_LINK' + | 'USER_LINK' + | undefined /** * Represents the usage settings of a custom field definition. */ - usage?: CustomFieldUsage[] - valueValidationSettings?: CustomFieldValueValidationSettings - viewRights?: CustomFieldViewRights + usage?: CustomFieldUsage[] | undefined + valueValidationSettings?: CustomFieldValueValidationSettings | undefined + viewRights?: CustomFieldViewRights | undefined } export const CustomFieldMeta = { - validate: (await import('./schemas/custom-field-meta.schema.js')).validate as ValidateFunction, + validate: CustomFieldMetaValidator as ValidateFunction, get schema() { return CustomFieldMeta.validate.schema }, @@ -145,6 +160,12 @@ export const CustomFieldMeta = { return CustomFieldMeta.validate.errors ?? undefined }, is: (o: unknown): o is CustomFieldMeta => CustomFieldMeta.validate(o) === true, + parse: (o: unknown): { right: CustomFieldMeta } | { left: DefinedError[] } => { + if (CustomFieldMeta.is(o)) { + return { right: o } + } + return { left: (CustomFieldMeta.errors ?? []) as DefinedError[] } + }, } as const /** @@ -154,15 +175,15 @@ export interface CustomFieldSelectionOption { /** * The list of options that that are available for the dependent selection custom field value based on the selected parent custom field value. */ - availableOptions?: CustomFieldAvailableOption[] + availableOptions?: CustomFieldAvailableOption[] | undefined /** * The key for the parent selection custom field value. */ - forSelectionKey?: string + forSelectionKey?: string | undefined /** * The parent selection custom field value. */ - forValue?: string + forValue?: string | undefined } /** @@ -172,15 +193,15 @@ export interface CustomFieldUsage { /** * `TRUE` if the field is displayed by default on create or edit pages for this record type, `FALSE` otherwise. */ - default?: boolean + default?: boolean | undefined /** * The key of the record type. */ - objectKey?: string + objectKey?: string | undefined /** * `TRUE` if the field is required for this record type, `FALSE` otherwise. */ - required?: boolean + required?: boolean | undefined } /** @@ -190,11 +211,11 @@ export interface CustomFieldValueValidationSettings { /** * `TRUE` if this field does not allow duplicate values, `FALSE` otherwise. */ - unique?: boolean + unique?: boolean | undefined /** * The expected format for the input. */ - validationPattern?: string + validationPattern?: string | undefined } /** @@ -204,19 +225,19 @@ export interface CustomFieldViewRights { /** * `TRUE` if custom field values of a custom field definition can be viewed by all users, `FALSE` if custom field values of a custom field definition can only be viewed by users with the specified roles. */ - allUsers?: boolean + allUsers?: boolean | undefined /** * Lists the IDs of the roles that have view rights for the custom field values of a custom field definition if it is not accessible by all users. */ - roles?: string[] + roles?: string[] | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -224,15 +245,16 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/custom-fields/schemas/custom-field-meta.schema.js b/src/custom-fields/schemas/custom-field-meta.schema.js index 3b970d6..2ed2493 100644 --- a/src/custom-fields/schemas/custom-field-meta.schema.js +++ b/src/custom-fields/schemas/custom-field-meta.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CustomFieldMeta","type":"object","description":"Represents a custom field definition.","properties":{"availableFor":{"title":"availableFor","description":"The entity type the custom field definition is associated with.","enum":["CLIENT","GROUP","CREDIT_ARRANGEMENT","LOAN_ACCOUNT","GUARANTOR","ASSET","DEPOSIT_ACCOUNT","DEPOSIT_PRODUCT","TRANSACTION_CHANNEL","TRANSACTION_TYPE","BRANCH","CENTRE","USER"]},"creationDate":{"type":"string","title":"creationDate","description":"The date the custom field definition was created.","format":"date-time"},"dependentFieldKey":{"type":"string","title":"dependentFieldKey","description":"Can be defined only for selection custom field definitions. Indicates the parent custom field definition on which the dependency is based upon."},"displaySettings":{"title":"displaySettings","$ref":"#/$defs/CustomFieldDisplaySettingsaf30"},"editRights":{"title":"editRights","$ref":"#/$defs/CustomFieldEditRightsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"id":{"type":"string","title":"id","description":"The user-defined ID, which is globally unique."},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The date the latest update was performed for this custom field definition.","format":"date-time"},"selectionOptions":{"type":"array","title":"selectionOptions","description":"Can be defined only for selection custom field definitions. Indicates that the field has predefined selections and only those can be used to populate it.","items":{"$ref":"#/$defs/CustomFieldSelectionOptionaf30"}},"state":{"title":"state","description":"Indicates whether the custom field definition is active or inactive.","enum":["ACTIVE","INACTIVE"]},"type":{"title":"type","description":"The type of custom field definition.","enum":["FREE_TEXT","SELECTION","NUMBER","CHECKBOX","DATE","DATE_TIME","CLIENT_LINK","GROUP_LINK","USER_LINK"]},"usage":{"type":"array","title":"usage","description":"Represents the usage settings of a custom field definition.","items":{"$ref":"#/$defs/CustomFieldUsageaf30"}},"valueValidationSettings":{"title":"valueValidationSettings","$ref":"#/$defs/CustomFieldValueValidationSettingsaf30"},"viewRights":{"title":"viewRights","$ref":"#/$defs/CustomFieldViewRightsaf30"}},"additionalProperties":true,"$defs":{"CustomFieldDisplaySettingsaf30":{"type":"object","title":"CustomFieldDisplaySettingsaf30","description":"Represents the display settings of a custom field definition.","properties":{"builtInId":{"title":"builtInId","description":"The original ID of the built-in custom field definition.","enum":["FIRST_NAME","MIDDLE_NAME","LAST_NAME","BIRTHDATE","GENDER","MOBILE_PHONE","MOBILE_PHONE_2","HOME_PHONE","EMAIL_ADDRESS"]},"description":{"type":"string","title":"description","description":"The user-provided description of the custom field definition."},"displayName":{"type":"string","title":"displayName","description":"The user-provided name of the custom field definition."},"fieldSize":{"title":"fieldSize","description":"The custom field value display size in the UI.","enum":["SHORT","LONG"]},"position":{"type":"integer","title":"position","description":"The custom field definition position in the custom field set."}},"additionalProperties":true},"CustomFieldEditRightsaf30":{"type":"object","title":"CustomFieldEditRightsaf30","description":"Represents the edit rights for custom field values for a particular custom field definition.","properties":{"allUsers":{"type":"boolean","title":"allUsers","description":"`TRUE` if custom field values of a custom field definition can be edited by all users, `FALSE` if custom field values of a custom field definition can only be edited by users with the specified roles."},"roles":{"type":"array","title":"roles","description":"The list of IDs of the roles that have edit rights for the custom field values of a custom field definition if it is not accessible by all users.","items":{"type":"string"}}},"additionalProperties":true},"CustomFieldSelectionOptionaf30":{"type":"object","title":"CustomFieldSelectionOptionaf30","description":"Represents the information related to the options of a selection custom field definition.","properties":{"availableOptions":{"type":"array","title":"availableOptions","description":"The list of options that that are available for the dependent selection custom field value based on the selected parent custom field value.","items":{"$ref":"#/$defs/CustomFieldAvailableOptionaf30"}},"forSelectionKey":{"type":"string","title":"forSelectionKey","description":"The key for the parent selection custom field value."},"forValue":{"type":"string","title":"forValue","description":"The parent selection custom field value."}},"additionalProperties":true},"CustomFieldAvailableOptionaf30":{"type":"object","title":"CustomFieldAvailableOptionaf30","description":"Represents one option of a selection custom field definition.","properties":{"score":{"type":"number","title":"score","description":"The score of the option."},"selectionKey":{"type":"string","title":"selectionKey","description":"The system-generated ID of the option."},"value":{"type":"string","title":"value","description":"The name of the option."}},"additionalProperties":true},"CustomFieldUsageaf30":{"type":"object","title":"CustomFieldUsageaf30","description":"Represents the usage settings of the custom field definition.","properties":{"default":{"type":"boolean","title":"default","description":"`TRUE` if the field is displayed by default on create or edit pages for this record type, `FALSE` otherwise."},"objectKey":{"type":"string","title":"objectKey","description":"The key of the record type."},"required":{"type":"boolean","title":"required","description":"`TRUE` if the field is required for this record type, `FALSE` otherwise."}},"additionalProperties":true},"CustomFieldValueValidationSettingsaf30":{"type":"object","title":"CustomFieldValueValidationSettingsaf30","description":"Represents the settings for field input validation.","properties":{"unique":{"type":"boolean","title":"unique","description":"`TRUE` if this field does not allow duplicate values, `FALSE` otherwise."},"validationPattern":{"type":"string","title":"validationPattern","description":"The expected format for the input."}},"additionalProperties":true},"CustomFieldViewRightsaf30":{"type":"object","title":"CustomFieldViewRightsaf30","description":"Represents the view rights for custom field values for a particular custom field definition.","properties":{"allUsers":{"type":"boolean","title":"allUsers","description":"`TRUE` if custom field values of a custom field definition can be viewed by all users, `FALSE` if custom field values of a custom field definition can only be viewed by users with the specified roles."},"roles":{"type":"array","title":"roles","description":"Lists the IDs of the roles that have view rights for the custom field values of a custom field definition if it is not accessible by all users.","items":{"type":"string"}}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"CustomFieldDisplaySettingsaf30","description":"Represents the display settings of a custom field definition.","properties":{"builtInId":{"title":"builtInId","description":"The original ID of the built-in custom field definition.","enum":["FIRST_NAME","MIDDLE_NAME","LAST_NAME","BIRTHDATE","GENDER","MOBILE_PHONE","MOBILE_PHONE_2","HOME_PHONE","EMAIL_ADDRESS"]},"description":{"type":"string","title":"description","description":"The user-provided description of the custom field definition."},"displayName":{"type":"string","title":"displayName","description":"The user-provided name of the custom field definition."},"fieldSize":{"title":"fieldSize","description":"The custom field value display size in the UI.","enum":["SHORT","LONG"]},"position":{"type":"integer","title":"position","description":"The custom field definition position in the custom field set."}},"additionalProperties":true};const schema13 = {"type":"object","title":"CustomFieldEditRightsaf30","description":"Represents the edit rights for custom field values for a particular custom field definition.","properties":{"allUsers":{"type":"boolean","title":"allUsers","description":"`TRUE` if custom field values of a custom field definition can be edited by all users, `FALSE` if custom field values of a custom field definition can only be edited by users with the specified roles."},"roles":{"type":"array","title":"roles","description":"The list of IDs of the roles that have edit rights for the custom field values of a custom field definition if it is not accessible by all users.","items":{"type":"string"}}},"additionalProperties":true};const schema16 = {"type":"object","title":"CustomFieldUsageaf30","description":"Represents the usage settings of the custom field definition.","properties":{"default":{"type":"boolean","title":"default","description":"`TRUE` if the field is displayed by default on create or edit pages for this record type, `FALSE` otherwise."},"objectKey":{"type":"string","title":"objectKey","description":"The key of the record type."},"required":{"type":"boolean","title":"required","description":"`TRUE` if the field is required for this record type, `FALSE` otherwise."}},"additionalProperties":true};const schema17 = {"type":"object","title":"CustomFieldValueValidationSettingsaf30","description":"Represents the settings for field input validation.","properties":{"unique":{"type":"boolean","title":"unique","description":"`TRUE` if this field does not allow duplicate values, `FALSE` otherwise."},"validationPattern":{"type":"string","title":"validationPattern","description":"The expected format for the input."}},"additionalProperties":true};const schema18 = {"type":"object","title":"CustomFieldViewRightsaf30","description":"Represents the view rights for custom field values for a particular custom field definition.","properties":{"allUsers":{"type":"boolean","title":"allUsers","description":"`TRUE` if custom field values of a custom field definition can be viewed by all users, `FALSE` if custom field values of a custom field definition can only be viewed by users with the specified roles."},"roles":{"type":"array","title":"roles","description":"Lists the IDs of the roles that have view rights for the custom field values of a custom field definition if it is not accessible by all users.","items":{"type":"string"}}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;const schema14 = {"type":"object","title":"CustomFieldSelectionOptionaf30","description":"Represents the information related to the options of a selection custom field definition.","properties":{"availableOptions":{"type":"array","title":"availableOptions","description":"The list of options that that are available for the dependent selection custom field value based on the selected parent custom field value.","items":{"$ref":"#/$defs/CustomFieldAvailableOptionaf30"}},"forSelectionKey":{"type":"string","title":"forSelectionKey","description":"The key for the parent selection custom field value."},"forValue":{"type":"string","title":"forValue","description":"The parent selection custom field value."}},"additionalProperties":true};const schema15 = {"type":"object","title":"CustomFieldAvailableOptionaf30","description":"Represents one option of a selection custom field definition.","properties":{"score":{"type":"number","title":"score","description":"The score of the option."},"selectionKey":{"type":"string","title":"selectionKey","description":"The system-generated ID of the option."},"value":{"type":"string","title":"value","description":"The name of the option."}},"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)){if(data.availableOptions !== undefined){let data0 = data.availableOptions;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DataImportAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`data/import/events/${path.eventKey}:action`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Allows you to import data */ - public async dataImport({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public dataImport({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'202', DataImportResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).post(`data/import`, { + this.buildClient(auth).post('data/import', { headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', }), @@ -90,20 +125,30 @@ export class MambuDataImport { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Allows you to retrieve a data import response */ - public async getImport({ + public getImport({ path, auth = [['apiKey'], ['basic']], - }: { - path: { importKey: string } - auth?: string[][] | string[] - }) { + }: { path: { importKey: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', DataImportStatus> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`data/import/${path.importKey}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -115,45 +160,66 @@ export class MambuDataImport { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -180,24 +246,52 @@ export class MambuDataImport { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/data-import/rest.type.ts b/src/data-import/rest.type.ts index 625bc52..b524503 100644 --- a/src/data-import/rest.type.ts +++ b/src/data-import/rest.type.ts @@ -3,8 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as DataImportActionValidator } from './schemas/data-import-action.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' /** * Holds information about the data import action @@ -17,7 +22,7 @@ export interface DataImportAction { } export const DataImportAction = { - validate: (await import('./schemas/data-import-action.schema.js')).validate as ValidateFunction, + validate: DataImportActionValidator as ValidateFunction, get schema() { return DataImportAction.validate.schema }, @@ -25,10 +30,11 @@ export const DataImportAction = { return DataImportAction.validate.errors ?? undefined }, is: (o: unknown): o is DataImportAction => DataImportAction.validate(o) === true, - assert: (o: unknown) => { - if (!DataImportAction.validate(o)) { - throw new ValidationError(DataImportAction.errors ?? []) + parse: (o: unknown): { right: DataImportAction } | { left: DefinedError[] } => { + if (DataImportAction.is(o)) { + return { right: o } } + return { left: (DataImportAction.errors ?? []) as DefinedError[] } }, } as const @@ -36,19 +42,19 @@ export const DataImportAction = { * Holds information about the data import error */ export interface DataImportError { - column?: DataImportErrorColumn + column?: DataImportErrorColumn | undefined /** * Error message */ - errorMessage?: string + errorMessage?: string | undefined /** * Row index */ - row?: number + row?: number | undefined /** * Sheet name */ - sheet?: string + sheet?: string | undefined } /** @@ -58,11 +64,11 @@ export interface DataImportErrorColumn { /** * Column index */ - index?: number + index?: number | undefined /** * Column name */ - name?: string + name?: string | undefined } /** @@ -72,7 +78,7 @@ export interface DataImportResponse { /** * Import key */ - importKey?: string + importKey?: string | undefined /** * Background process state */ @@ -88,10 +94,11 @@ export interface DataImportResponse { | 'TRANSIENT_ERROR' | 'OVERRIDDEN' | 'RECOVERABLE_ERROR' + | undefined } export const DataImportResponse = { - validate: (await import('./schemas/data-import-response.schema.js')).validate as ValidateFunction, + validate: DataImportResponseValidator as ValidateFunction, get schema() { return DataImportResponse.validate.schema }, @@ -99,6 +106,12 @@ export const DataImportResponse = { return DataImportResponse.validate.errors ?? undefined }, is: (o: unknown): o is DataImportResponse => DataImportResponse.validate(o) === true, + parse: (o: unknown): { right: DataImportResponse } | { left: DefinedError[] } => { + if (DataImportResponse.is(o)) { + return { right: o } + } + return { left: (DataImportResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -108,11 +121,11 @@ export interface DataImportStatus { /** * List of errors */ - errors?: DataImportError[] + errors?: DataImportError[] | undefined /** * Event key */ - eventKey?: string + eventKey?: string | undefined /** * Background process state */ @@ -128,10 +141,11 @@ export interface DataImportStatus { | 'TRANSIENT_ERROR' | 'OVERRIDDEN' | 'RECOVERABLE_ERROR' + | undefined } export const DataImportStatus = { - validate: (await import('./schemas/data-import-status.schema.js')).validate as ValidateFunction, + validate: DataImportStatusValidator as ValidateFunction, get schema() { return DataImportStatus.validate.schema }, @@ -139,14 +153,20 @@ export const DataImportStatus = { return DataImportStatus.validate.errors ?? undefined }, is: (o: unknown): o is DataImportStatus => DataImportStatus.validate(o) === true, + parse: (o: unknown): { right: DataImportStatus } | { left: DefinedError[] } => { + if (DataImportStatus.is(o)) { + return { right: o } + } + return { left: (DataImportStatus.errors ?? []) as DefinedError[] } + }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -154,15 +174,16 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/data-import/schemas/data-import-action.schema.js b/src/data-import/schemas/data-import-action.schema.js index 32ac3d9..a378edb 100644 --- a/src/data-import/schemas/data-import-action.schema.js +++ b/src/data-import/schemas/data-import-action.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DataImportAction","type":"object","description":"Holds information about the data import action","properties":{"type":{"title":"type","description":"Type of the data import action","enum":["APPROVE","REJECT"]}},"required":["type"],"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.type === undefined) && (missing0 = "type")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.type !== undefined){let data0 = data.type;if(!((data0 === "APPROVE") || (data0 === "REJECT"))){validate10.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/enum",keyword:"enum",params:{allowedValues: schema11.properties.type.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 +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DataImportAction","type":"object","description":"Holds information about the data import action","properties":{"type":{"description":"Type of the data import action","enum":["APPROVE","REJECT"]}},"required":["type"],"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.type === undefined) && (missing0 = "type")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.type !== undefined){let data0 = data.type;if(!((data0 === "APPROVE") || (data0 === "REJECT"))){validate10.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/enum",keyword:"enum",params:{allowedValues: schema11.properties.type.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/data-import/schemas/data-import-response.schema.js b/src/data-import/schemas/data-import-response.schema.js index 1734043..efd1fd5 100644 --- a/src/data-import/schemas/data-import-response.schema.js +++ b/src/data-import/schemas/data-import-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DataImportResponse","type":"object","description":"Holds information about the response of the data import action","properties":{"importKey":{"type":"string","title":"importKey","description":"Import key"},"state":{"title":"state","description":"Background process state","enum":["QUEUED","IN_PROGRESS","COMPLETE","NOT_FOUND","CANCEL","TO_BE_CANCELED","TIMED_OUT","ERROR","TRANSIENT_ERROR","OVERRIDDEN","RECOVERABLE_ERROR"]}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.importKey !== undefined){const _errs2 = errors;if(typeof data.importKey !== "string"){validate10.errors = [{instancePath:instancePath+"/importKey",schemaPath:"#/properties/importKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.state !== undefined){const _errs4 = errors;let valid1;valid1 = false;for(const v0 of schema11.properties.state.enum){if(func0(data.state, v0)){valid1 = true;break;}}if(!valid1){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 = _errs4 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DataImportResponse","type":"object","description":"Holds information about the response of the data import action","properties":{"importKey":{"type":"string","description":"Import key"},"state":{"description":"Background process state","enum":["QUEUED","IN_PROGRESS","COMPLETE","NOT_FOUND","CANCEL","TO_BE_CANCELED","TIMED_OUT","ERROR","TRANSIENT_ERROR","OVERRIDDEN","RECOVERABLE_ERROR"]}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.importKey !== undefined){const _errs2 = errors;if(typeof data.importKey !== "string"){validate10.errors = [{instancePath:instancePath+"/importKey",schemaPath:"#/properties/importKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.state !== undefined){const _errs4 = errors;let valid1;valid1 = false;for(const v0 of schema11.properties.state.enum){if(func0(data.state, v0)){valid1 = true;break;}}if(!valid1){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 = _errs4 === 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/data-import/schemas/data-import-status.schema.js b/src/data-import/schemas/data-import-status.schema.js index 40543b0..03552de 100644 --- a/src/data-import/schemas/data-import-status.schema.js +++ b/src/data-import/schemas/data-import-status.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DataImportStatus","type":"object","description":"Holds information about the data import status","properties":{"errors":{"type":"array","title":"errors","description":"List of errors","items":{"$ref":"#/$defs/DataImportErroraf30"}},"eventKey":{"type":"string","title":"eventKey","description":"Event key"},"state":{"title":"state","description":"Background process state","enum":["QUEUED","IN_PROGRESS","COMPLETE","NOT_FOUND","CANCEL","TO_BE_CANCELED","TIMED_OUT","ERROR","TRANSIENT_ERROR","OVERRIDDEN","RECOVERABLE_ERROR"]}},"additionalProperties":true,"$defs":{"DataImportErroraf30":{"type":"object","title":"DataImportErroraf30","description":"Holds information about the data import error","properties":{"column":{"title":"column","$ref":"#/$defs/DataImportErrorColumnaf30"},"errorMessage":{"type":"string","title":"errorMessage","description":"Error message"},"row":{"type":"integer","title":"row","description":"Row index"},"sheet":{"type":"string","title":"sheet","description":"Sheet name"}},"additionalProperties":true},"DataImportErrorColumnaf30":{"type":"object","title":"DataImportErrorColumnaf30","description":"Holds basic information for an error column: the index and the corresponding name","properties":{"index":{"type":"integer","title":"index","description":"Column index"},"name":{"type":"string","title":"name","description":"Column name"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"DataImportErroraf30","description":"Holds information about the data import error","properties":{"column":{"title":"column","$ref":"#/$defs/DataImportErrorColumnaf30"},"errorMessage":{"type":"string","title":"errorMessage","description":"Error message"},"row":{"type":"integer","title":"row","description":"Row index"},"sheet":{"type":"string","title":"sheet","description":"Sheet name"}},"additionalProperties":true};const schema13 = {"type":"object","title":"DataImportErrorColumnaf30","description":"Holds basic information for an error column: the index and the corresponding name","properties":{"index":{"type":"integer","title":"index","description":"Column index"},"name":{"type":"string","title":"name","description":"Column name"}},"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)){if(data.column !== undefined){let data0 = data.column;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.index !== undefined){let data1 = data0.index;const _errs6 = errors;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate11.errors = [{instancePath:instancePath+"/column/index",schemaPath:"#/$defs/DataImportErrorColumnaf30/properties/index/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.name !== undefined){const _errs8 = errors;if(typeof data0.name !== "string"){validate11.errors = [{instancePath:instancePath+"/column/name",schemaPath:"#/$defs/DataImportErrorColumnaf30/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}}}else {validate11.errors = [{instancePath:instancePath+"/column",schemaPath:"#/$defs/DataImportErrorColumnaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.errorMessage !== undefined){const _errs10 = errors;if(typeof data.errorMessage !== "string"){validate11.errors = [{instancePath:instancePath+"/errorMessage",schemaPath:"#/properties/errorMessage/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.row !== undefined){let data4 = data.row;const _errs12 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate11.errors = [{instancePath:instancePath+"/row",schemaPath:"#/properties/row/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.sheet !== undefined){const _errs14 = errors;if(typeof data.sheet !== "string"){validate11.errors = [{instancePath:instancePath+"/sheet",schemaPath:"#/properties/sheet/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs14 === 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 func0 = require("ajv/dist/runtime/equal").default;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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - }) + }: { path: { databaseBackupVersion: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + return this.awaitResponse( + this.buildClient(auth).get(`database/backup/${path.databaseBackupVersion}`, { + responseType: 'text', + }), + { + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Trigger database backup */ - public async triggerBackup({ + public triggerBackup({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: TriggerDatabaseBackupRequest - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(TriggerDatabaseBackupRequest, body) + }: { body: TriggerDatabaseBackupRequest; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'202', TriggerDatabaseBackupResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(TriggerDatabaseBackupRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`database/backup`, { + this.buildClient(auth).post('database/backup', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 202: TriggerDatabaseBackupResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -152,24 +203,52 @@ export class MambuDatabaseBackup { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/database-backup/rest.type.ts b/src/database-backup/rest.type.ts index a15de16..bed482c 100644 --- a/src/database-backup/rest.type.ts +++ b/src/database-backup/rest.type.ts @@ -3,15 +3,19 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as TriggerDatabaseBackupRequestValidator } from './schemas/trigger-database-backup-request.schema.js' +import { validate as TriggerDatabaseBackupResponseValidator } from './schemas/trigger-database-backup-response.schema.js' export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -19,17 +23,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -39,20 +44,19 @@ export interface TriggerDatabaseBackupRequest { /** * If provided, it needs to be a valid URL. It will be a webhook call that will later execute when the backup is complete. */ - callback?: string + callback?: string | undefined /** * If provided, it needs to be a date time from which the backup should include data. If not provided, the backup will include all the data. */ - createBackupFromDate?: string + createBackupFromDate?: string | undefined /** * If provided, it needs to be a list of tables that exist in the database schema. The backup will only include the specified tables. If not provided, the backup will include all tables. */ - tables?: string[] + tables?: string[] | undefined } export const TriggerDatabaseBackupRequest = { - validate: (await import('./schemas/trigger-database-backup-request.schema.js')) - .validate as ValidateFunction, + validate: TriggerDatabaseBackupRequestValidator as ValidateFunction, get schema() { return TriggerDatabaseBackupRequest.validate.schema }, @@ -60,10 +64,11 @@ export const TriggerDatabaseBackupRequest = { return TriggerDatabaseBackupRequest.validate.errors ?? undefined }, is: (o: unknown): o is TriggerDatabaseBackupRequest => TriggerDatabaseBackupRequest.validate(o) === true, - assert: (o: unknown) => { - if (!TriggerDatabaseBackupRequest.validate(o)) { - throw new ValidationError(TriggerDatabaseBackupRequest.errors ?? []) + parse: (o: unknown): { right: TriggerDatabaseBackupRequest } | { left: DefinedError[] } => { + if (TriggerDatabaseBackupRequest.is(o)) { + return { right: o } } + return { left: (TriggerDatabaseBackupRequest.errors ?? []) as DefinedError[] } }, } as const @@ -86,11 +91,11 @@ export interface TriggerDatabaseBackupResponse { | 'TRANSIENT_ERROR' | 'OVERRIDDEN' | 'RECOVERABLE_ERROR' + | undefined } export const TriggerDatabaseBackupResponse = { - validate: (await import('./schemas/trigger-database-backup-response.schema.js')) - .validate as ValidateFunction, + validate: TriggerDatabaseBackupResponseValidator as ValidateFunction, get schema() { return TriggerDatabaseBackupResponse.validate.schema }, @@ -98,4 +103,10 @@ export const TriggerDatabaseBackupResponse = { return TriggerDatabaseBackupResponse.validate.errors ?? undefined }, is: (o: unknown): o is TriggerDatabaseBackupResponse => TriggerDatabaseBackupResponse.validate(o) === true, + parse: (o: unknown): { right: TriggerDatabaseBackupResponse } | { left: DefinedError[] } => { + if (TriggerDatabaseBackupResponse.is(o)) { + return { right: o } + } + return { left: (TriggerDatabaseBackupResponse.errors ?? []) as DefinedError[] } + }, } as const diff --git a/src/database-backup/schemas/error-response.schema.js b/src/database-backup/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/database-backup/schemas/error-response.schema.js +++ b/src/database-backup/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate10.errors = [{instancePath:instancePath+"/tables",schemaPath:"#/properties/tables/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 {validate10.errors = [{instancePath:instancePath+"/tables",schemaPath:"#/properties/tables/type",keyword:"type",params:{type: "array"},message:"must be array"}];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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"TriggerDatabaseBackupRequest","type":"object","description":"Represents a request for triggering a database backup.","properties":{"callback":{"type":"string","description":"If provided, it needs to be a valid URL. It will be a webhook call that will later execute when the backup is complete."},"createBackupFromDate":{"type":"string","description":"If provided, it needs to be a date time from which the backup should include data. If not provided, the backup will include all the data.","format":"date-time"},"tables":{"type":"array","description":"If provided, it needs to be a list of tables that exist in the database schema. The backup will only include the specified tables. If not provided, the backup will include all tables.","items":{"type":"string"},"uniqueItems":true}},"additionalProperties":true};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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.callback !== undefined){const _errs2 = errors;if(typeof data.callback !== "string"){validate10.errors = [{instancePath:instancePath+"/callback",schemaPath:"#/properties/callback/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.createBackupFromDate !== undefined){let data1 = data.createBackupFromDate;const _errs4 = errors;if(errors === _errs4){if(errors === _errs4){if(typeof data1 === "string"){if(!(formats0.validate(data1))){validate10.errors = [{instancePath:instancePath+"/createBackupFromDate",schemaPath:"#/properties/createBackupFromDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/createBackupFromDate",schemaPath:"#/properties/createBackupFromDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.tables !== undefined){let data2 = data.tables;const _errs6 = errors;if(errors === _errs6){if(Array.isArray(data2)){var valid1 = true;const len0 = data2.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data2[i1];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate10.errors = [{instancePath:instancePath+"/tables",schemaPath:"#/properties/tables/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 {validate10.errors = [{instancePath:instancePath+"/tables",schemaPath:"#/properties/tables/type",keyword:"type",params:{type: "array"},message:"must be array"}];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/database-backup/schemas/trigger-database-backup-response.schema.js b/src/database-backup/schemas/trigger-database-backup-response.schema.js index 68b1268..549a570 100644 --- a/src/database-backup/schemas/trigger-database-backup-response.schema.js +++ b/src/database-backup/schemas/trigger-database-backup-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"TriggerDatabaseBackupResponse","type":"object","description":"Represents a response for triggering a database backup","properties":{"state":{"title":"state","description":"The state of the database backup process","enum":["QUEUED","IN_PROGRESS","COMPLETE","NOT_FOUND","CANCEL","TO_BE_CANCELED","TIMED_OUT","ERROR","TRANSIENT_ERROR","OVERRIDDEN","RECOVERABLE_ERROR"]}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.state !== undefined){let valid1;valid1 = false;for(const v0 of schema11.properties.state.enum){if(func0(data.state, v0)){valid1 = true;break;}}if(!valid1){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;}}}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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"TriggerDatabaseBackupResponse","type":"object","description":"Represents a response for triggering a database backup","properties":{"state":{"description":"The state of the database backup process","enum":["QUEUED","IN_PROGRESS","COMPLETE","NOT_FOUND","CANCEL","TO_BE_CANCELED","TIMED_OUT","ERROR","TRANSIENT_ERROR","OVERRIDDEN","RECOVERABLE_ERROR"]}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.state !== undefined){let valid1;valid1 = false;for(const v0 of schema11.properties.state.enum){if(func0(data.state, v0)){valid1 = true;break;}}if(!valid1){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;}}}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/index.ts b/src/deposit-accounts/index.ts index 0adb916..da54ad0 100644 --- a/src/deposit-accounts/index.ts +++ b/src/deposit-accounts/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuDepositAccounts } from './rest.client.js' export * as depositAccounts from './rest.type.js' diff --git a/src/deposit-accounts/rest.client.ts b/src/deposit-accounts/rest.client.ts index 9fd5275..174e1ca 100644 --- a/src/deposit-accounts/rest.client.ts +++ b/src/deposit-accounts/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { AccountAuthorizationHold, ApplyInterestInput, @@ -25,7 +28,11 @@ import { GetAllResponse, GetDepositAccountDocumentResponse, GetFundedLoansResponse, + GetInterestAvailabilitiesListResponse, GetWithholdingTaxHistoryResponse, + InterestAccountSettingsAvailability, + InterestAccountSettingsAvailabilityResponse, + InterestAccountSettingsAvailabilityUpdate, LoanAccountSchedule, PatchBlockFundRequest, PatchRequest, @@ -72,7 +79,7 @@ export class MambuDepositAccounts { /** * Represents information to apply accrued interest. */ - public async applyInterest({ + public applyInterest({ body, path, headers, @@ -80,33 +87,52 @@ export class MambuDepositAccounts { }: { body: ApplyInterestInput path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ApplyInterestInput, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ApplyInterestInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:applyInterest`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Change deposit account interest rate */ - public async changeInterestRate({ + public changeInterestRate({ body, path, headers, @@ -114,33 +140,52 @@ export class MambuDepositAccounts { }: { body: ChangeInterestRateAction path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ChangeInterestRateAction, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ChangeInterestRateAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:changeInterestRate`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Represents the information to post an action, such as approving a deposit account. */ - public async changeState({ + public changeState({ body, path, headers, @@ -148,10 +193,29 @@ export class MambuDepositAccounts { }: { body: DepositAccountAction path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(DepositAccountAction, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', DepositAccount> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DepositAccountAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:changeState`, { @@ -160,21 +224,21 @@ export class MambuDepositAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: DepositAccount, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Change deposit account withholding tax rate */ - public async changeWithholdingTax({ + public changeWithholdingTax({ body, path, headers, @@ -182,63 +246,95 @@ export class MambuDepositAccounts { }: { body: ChangeWithholdingTaxAction path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ChangeWithholdingTaxAction, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ChangeWithholdingTaxAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:changeWithholdingTax`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create deposit account */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: DepositAccount - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(DepositAccount, body) + }: { body: DepositAccount; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', DepositAccount> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'409', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DepositAccount, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`deposits`, { + this.buildClient(auth).post('deposits', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: DepositAccount, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create an authorization hold corresponding to a given account */ - public async createAuthorizationHold({ + public createAuthorizationHold({ body, path, headers, @@ -246,10 +342,29 @@ export class MambuDepositAccounts { }: { body: AccountAuthorizationHold path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(AccountAuthorizationHold, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', AccountAuthorizationHold> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(AccountAuthorizationHold, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/authorizationholds`, { @@ -258,21 +373,21 @@ export class MambuDepositAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: AccountAuthorizationHold, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create a block fund for the account */ - public async createBlockFund({ + public createBlockFund({ body, path, headers, @@ -280,10 +395,29 @@ export class MambuDepositAccounts { }: { body: BlockFund path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(BlockFund, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', BlockFund> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(BlockFund, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/blocks`, { @@ -292,21 +426,21 @@ export class MambuDepositAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: BlockFund, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Represents the information needed to create and associate a new card to an account. */ - public async createCard({ + public createCard({ body, path, headers, @@ -314,84 +448,212 @@ export class MambuDepositAccounts { }: { body: Card path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(Card, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Card, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/cards`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 201: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 201: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** - * Delete inactive deposit account + * Create Interest Availability */ - public async delete({ + public createInterestAvailability({ + body, path, + headers, auth = [['apiKey'], ['basic']], }: { + body: InterestAccountSettingsAvailability path: { depositAccountId: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', InterestAccountSettingsAvailabilityResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'409', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(InterestAccountSettingsAvailability, body) + if ('left' in _body) { + return Promise.resolve(_body) + } + return this.awaitResponse( - this.buildClient(auth).delete(`deposits/${path.depositAccountId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, + this.buildClient(auth).post(`deposits/${path.depositAccountId}/interest-availabilities`, { + json: body, + headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 201: InterestAccountSettingsAvailabilityResponse, + 400: ErrorResponse, + 401: ErrorResponse, + 403: ErrorResponse, + 409: ErrorResponse, + }, + ) as ReturnType + } + + /** + * Delete inactive deposit account + */ + public delete({ + path, + auth = [['apiKey'], ['basic']], + }: { path: { depositAccountId: string }; auth?: string[][] | string[] }): Promise< + | 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, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + return this.awaitResponse( + this.buildClient(auth).delete(`deposits/${path.depositAccountId}`, { + responseType: 'text', + }), + { + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Represents the information needed to delete a card associated to an account using its reference token. */ - public async deleteCard({ + public deleteCard({ path, auth = [['apiKey'], ['basic']], - }: { - path: { depositAccountId: string; cardReferenceToken: string } - auth?: string[][] | string[] - }) { + }: { path: { depositAccountId: string; cardReferenceToken: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`deposits/${path.depositAccountId}/cards/${path.cardReferenceToken}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType + } + + /** + * Delete Interest Availability + */ + public deleteInterestAvailability({ + path, + auth = [['apiKey'], ['basic']], + }: { path: { depositAccountId: string; interestAvailabilityKey: string }; auth?: string[][] | string[] }): Promise< + | 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, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + return this.awaitResponse( + this.buildClient(auth).delete( + `deposits/${path.depositAccountId}/interest-availabilities/${path.interestAvailabilityKey}`, + { + responseType: 'text', + }, + ), + { + 204: { parse: (x: unknown) => ({ right: x }) }, + 400: ErrorResponse, + 401: ErrorResponse, + 403: ErrorResponse, + 404: ErrorResponse, + 409: ErrorResponse, + }, + ) as ReturnType } /** * Get deposit accounts */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { @@ -408,9 +670,22 @@ export class MambuDepositAccounts { accountHolderId?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`deposits`, { + this.buildClient(auth).get('deposits', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -421,14 +696,14 @@ export class MambuDepositAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get authorization holds related to a deposit account, ordered from newest to oldest by creation date */ - public async getAllAuthorizationHolds({ + public getAllAuthorizationHolds({ path, query, auth = [['apiKey'], ['basic']], @@ -436,7 +711,20 @@ export class MambuDepositAccounts { path: { depositAccountId: string } query?: { offset?: string; limit?: string; paginationDetails?: string; status?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetAllAuthorizationHoldsResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/authorizationholds`, { searchParams: query ?? {}, @@ -449,14 +737,14 @@ export class MambuDepositAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get all block funds for a deposit account */ - public async getAllBlocks({ + public getAllBlocks({ path, query, auth = [['apiKey'], ['basic']], @@ -464,7 +752,20 @@ export class MambuDepositAccounts { path: { depositAccountId: string } query?: { offset?: string; limit?: string; paginationDetails?: string; state?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetAllBlocksResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/blocks`, { searchParams: query ?? {}, @@ -477,20 +778,30 @@ export class MambuDepositAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get cards associated with an account */ - public async getAllCards({ + public getAllCards({ path, auth = [['apiKey'], ['basic']], - }: { - path: { depositAccountId: string } - auth?: string[][] | string[] - }) { + }: { path: { depositAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', GetAllCardsResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/cards`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -502,27 +813,40 @@ export class MambuDepositAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get account authorization hold */ - public async getAuthorizationHoldById({ + public getAuthorizationHoldById({ path, auth = [['apiKey'], ['basic']], }: { path: { depositAccountId: string; authorizationHoldExternalReferenceId: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', AccountAuthorizationHold> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get( `deposits/${path.depositAccountId}/authorizationholds/${path.authorizationHoldExternalReferenceId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', - } + }, ), { 200: AccountAuthorizationHold, @@ -530,22 +854,31 @@ export class MambuDepositAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get deposit account */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { depositAccountId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { depositAccountId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', DepositAccount> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}`, { searchParams: query ?? {}, @@ -558,14 +891,14 @@ export class MambuDepositAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get deposit account document */ - public async getDepositAccountDocument({ + public getDepositAccountDocument({ path, query, auth = [['apiKey'], ['basic']], @@ -573,7 +906,20 @@ export class MambuDepositAccounts { path: { depositAccountId: string; templateId: string } query?: { startDate?: string; endDate?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetDepositAccountDocumentResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/templates/${path.templateId}`, { searchParams: query ?? {}, @@ -586,39 +932,128 @@ export class MambuDepositAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get all loan accounts funded by the deposit account with the given ID or encoded key */ - public async getFundedLoans({ + public getFundedLoans({ + path, + auth = [['apiKey'], ['basic']], + }: { path: { depositAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', GetFundedLoansResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + return this.awaitResponse( + this.buildClient(auth).get(`deposits/${path.depositAccountId}/funding`, { + headers: { Accept: 'application/vnd.mambu.v2+json' }, + responseType: 'json', + }), + { + 200: GetFundedLoansResponse, + 400: ErrorResponse, + 401: ErrorResponse, + 403: ErrorResponse, + 404: ErrorResponse, + }, + ) as ReturnType + } + + /** + * Get Interest Availabilities + */ + public getInterestAvailabilitiesList({ path, + query, auth = [['apiKey'], ['basic']], }: { path: { depositAccountId: string } + query?: { offset?: string; limit?: string; paginationDetails?: string; type?: string; from?: string; to?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetInterestAvailabilitiesListResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`deposits/${path.depositAccountId}/funding`, { + this.buildClient(auth).get(`deposits/${path.depositAccountId}/interest-availabilities`, { + searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', }), { - 200: GetFundedLoansResponse, + 200: GetInterestAvailabilitiesListResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType + } + + /** + * Get Interest Availability + */ + public getInterestAvailabilityById({ + path, + auth = [['apiKey'], ['basic']], + }: { path: { depositAccountId: string; interestAvailabilityKey: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', InterestAccountSettingsAvailabilityResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + return this.awaitResponse( + this.buildClient(auth).get( + `deposits/${path.depositAccountId}/interest-availabilities/${path.interestAvailabilityKey}`, + { + headers: { Accept: 'application/vnd.mambu.v2+json' }, + responseType: 'json', + }, + ), + { + 200: InterestAccountSettingsAvailabilityResponse, + 400: ErrorResponse, + 401: ErrorResponse, + 403: ErrorResponse, + 404: ErrorResponse, + }, + ) as ReturnType } /** * Download deposit account document PDF */ - public async getPdfDocument({ + public getPdfDocument({ path, query, auth = [['apiKey'], ['basic']], @@ -626,31 +1061,55 @@ export class MambuDepositAccounts { path: { depositAccountId: string; templateId: string } query?: { startDate?: string; endDate?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/templates/${path.templateId}/pdf`, { searchParams: query ?? {}, + responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * 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 async getScheduleForFundedAccount({ + public getScheduleForFundedAccount({ path, auth = [['apiKey'], ['basic']], - }: { - path: { depositAccountId: string; loanAccountId: string } - auth?: string[][] | string[] - }) { + }: { path: { depositAccountId: string; loanAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', LoanAccountSchedule> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/funding/${path.loanAccountId}/schedule`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -662,22 +1121,31 @@ export class MambuDepositAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get deposit account withholding tax history */ - public async getWithholdingTaxHistory({ + public getWithholdingTaxHistory({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { depositAccountId: string } - query?: { from?: string; to?: string } - auth?: string[][] | string[] - }) { + }: { path: { depositAccountId: string }; query?: { from?: string; to?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', GetWithholdingTaxHistoryResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/withholdingtaxes`, { searchParams: query ?? {}, @@ -690,75 +1158,105 @@ export class MambuDepositAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create Interest Availabilities for a group of accounts */ - public async makeBulkInterestAccountSettingsAvailabilities({ + public makeBulkInterestAccountSettingsAvailabilities({ body, headers, auth = [['apiKey'], ['basic']], }: { body: BulkInterestAccountSettingsAvailabilityInput - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(BulkInterestAccountSettingsAvailabilityInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'202', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(BulkInterestAccountSettingsAvailabilityInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`deposits/interest-availabilities:bulk`, { + this.buildClient(auth).post('deposits/interest-availabilities:bulk', { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 202: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 202: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update deposit account */ - public async patch({ + public patch({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: PatchRequest - path: { depositAccountId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }: { body: PatchRequest; path: { depositAccountId: string }; auth?: string[][] | string[] }): Promise< + | 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, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`deposits/${path.depositAccountId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * 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 async patchBlockFund({ + public patchBlockFund({ body, path, auth = [['apiKey'], ['basic']], @@ -766,30 +1264,47 @@ export class MambuDepositAccounts { body: PatchBlockFundRequest path: { depositAccountId: string; externalReferenceId: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchBlockFundRequest, body) + }): Promise< + | 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, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchBlockFundRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`deposits/${path.depositAccountId}/blocks/${path.externalReferenceId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Reopen a deposit account */ - public async reopen({ + public reopen({ body, path, headers, @@ -797,10 +1312,29 @@ export class MambuDepositAccounts { }: { body: ReopenDepositAction path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ReopenDepositAction, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', DepositAccount> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ReopenDepositAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:reopen`, { @@ -809,50 +1343,63 @@ export class MambuDepositAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: DepositAccount, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Reverse account authorization hold */ - public async reverseAuthorizationHold({ + public reverseAuthorizationHold({ path, auth = [['apiKey'], ['basic']], }: { path: { depositAccountId: string; authorizationHoldExternalReferenceId: string } auth?: string[][] | string[] - }) { + }): Promise< + | 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, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete( `deposits/${path.depositAccountId}/authorizationholds/${path.authorizationHoldExternalReferenceId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', - } + responseType: 'text', + }, ), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Search deposit accounts */ - public async search({ + public search({ body, query, auth = [['apiKey'], ['basic']], @@ -860,11 +1407,27 @@ export class MambuDepositAccounts { body: DepositAccountSearchCriteria query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(DepositAccountSearchCriteria, body) + }): Promise< + | SuccessResponse<'200', SearchResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DepositAccountSearchCriteria, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`deposits:search`, { + this.buildClient(auth).post('deposits:search', { json: body, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -875,14 +1438,14 @@ export class MambuDepositAccounts { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Represents information to start the maturity period for the specified deposit account. */ - public async startMaturity({ + public startMaturity({ body, path, headers, @@ -890,10 +1453,29 @@ export class MambuDepositAccounts { }: { body: StartMaturityAction path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(StartMaturityAction, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', DepositAccount> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(StartMaturityAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:startMaturity`, { @@ -902,47 +1484,57 @@ export class MambuDepositAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: DepositAccount, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Unblock a previously blocked fund for a deposit account */ - public async unblockFund({ + public unblockFund({ path, auth = [['apiKey'], ['basic']], - }: { - path: { depositAccountId: string; externalReferenceId: string } - auth?: string[][] | string[] - }) { + }: { path: { depositAccountId: string; externalReferenceId: string }; auth?: string[][] | string[] }): Promise< + | 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, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`deposits/${path.depositAccountId}/blocks/${path.externalReferenceId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Represents the action to undo the maturity period for the specified deposit account. */ - public async undoMaturity({ + public undoMaturity({ body, path, headers, @@ -950,42 +1542,75 @@ export class MambuDepositAccounts { }: { body: UndoMaturityAction path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(UndoMaturityAction, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(UndoMaturityAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}:undoMaturity`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update deposit account */ - public async update({ + public update({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: DepositAccount - path: { depositAccountId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(DepositAccount, body) + }: { body: DepositAccount; path: { depositAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', DepositAccount> + | 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, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DepositAccount, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`deposits/${path.depositAccountId}`, { @@ -1000,45 +1625,118 @@ export class MambuDepositAccounts { 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType + } + + /** + * Update Interest Availability + */ + public updateInterestAvailability({ + body, + path, + auth = [['apiKey'], ['basic']], + }: { + body: InterestAccountSettingsAvailabilityUpdate + path: { depositAccountId: string; interestAvailabilityKey: string } + auth?: string[][] | string[] + }): Promise< + | SuccessResponse<'200', InterestAccountSettingsAvailabilityResponse> + | 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, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(InterestAccountSettingsAvailabilityUpdate, body) + if ('left' in _body) { + return Promise.resolve(_body) + } + + return this.awaitResponse( + this.buildClient(auth).put( + `deposits/${path.depositAccountId}/interest-availabilities/${path.interestAvailabilityKey}`, + { + json: body, + headers: { Accept: 'application/vnd.mambu.v2+json' }, + responseType: 'json', + }, + ), + { + 200: InterestAccountSettingsAvailabilityResponse, + 400: ErrorResponse, + 401: ErrorResponse, + 403: ErrorResponse, + 404: ErrorResponse, + 409: ErrorResponse, + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -1065,24 +1763,52 @@ export class MambuDepositAccounts { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/deposit-accounts/rest.type.ts b/src/deposit-accounts/rest.type.ts index 57b2e10..102ae51 100644 --- a/src/deposit-accounts/rest.type.ts +++ b/src/deposit-accounts/rest.type.ts @@ -3,8 +3,38 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as AccountAuthorizationHoldValidator } from './schemas/account-authorization-hold.schema.js' +import { validate as ApplyInterestInputValidator } from './schemas/apply-interest-input.schema.js' +import { validate as BlockFundValidator } from './schemas/block-fund.schema.js' +import { validate as BulkInterestAccountSettingsAvailabilityInputValidator } from './schemas/bulk-interest-account-settings-availability-input.schema.js' +import { validate as CardValidator } from './schemas/card.schema.js' +import { validate as ChangeInterestRateActionValidator } from './schemas/change-interest-rate-action.schema.js' +import { validate as ChangeWithholdingTaxActionValidator } from './schemas/change-withholding-tax-action.schema.js' +import { validate as DepositAccountActionValidator } from './schemas/deposit-account-action.schema.js' +import { validate as DepositAccountSearchCriteriaValidator } from './schemas/deposit-account-search-criteria.schema.js' +import { validate as DepositAccountValidator } from './schemas/deposit-account.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllAuthorizationHoldsResponseValidator } from './schemas/get-all-authorization-holds-response.schema.js' +import { validate as GetAllBlocksResponseValidator } from './schemas/get-all-blocks-response.schema.js' +import { validate as GetAllCardsResponseValidator } from './schemas/get-all-cards-response.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' +import { validate as GetDepositAccountDocumentResponseValidator } from './schemas/get-deposit-account-document-response.schema.js' +import { validate as GetFundedLoansResponseValidator } from './schemas/get-funded-loans-response.schema.js' +import { validate as GetInterestAvailabilitiesListResponseValidator } from './schemas/get-interest-availabilities-list-response.schema.js' +import { validate as GetWithholdingTaxHistoryResponseValidator } from './schemas/get-withholding-tax-history-response.schema.js' +import { validate as InterestAccountSettingsAvailabilityResponseValidator } from './schemas/interest-account-settings-availability-response.schema.js' +import { validate as InterestAccountSettingsAvailabilityUpdateValidator } from './schemas/interest-account-settings-availability-update.schema.js' +import { validate as InterestAccountSettingsAvailabilityValidator } from './schemas/interest-account-settings-availability.schema.js' +import { validate as LoanAccountScheduleValidator } from './schemas/loan-account-schedule.schema.js' +import { validate as PatchBlockFundRequestValidator } from './schemas/patch-block-fund-request.schema.js' +import { validate as PatchRequestValidator } from './schemas/patch-request.schema.js' +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 UndoMaturityActionValidator } from './schemas/undo-maturity-action.schema.js' /** * The account arrears settings, holds the required information for the arrears settings of an account. @@ -17,34 +47,35 @@ export interface AccountArrearsSettings { | 'ACCOUNT_FIRST_WENT_TO_ARREARS' | 'LAST_LATE_REPAYMENT' | 'ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD' + | undefined /** * The encoded key of the arrears base settings, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Defines monthly arrears tolerance day value. */ - monthlyToleranceDay?: number + monthlyToleranceDay?: number | undefined /** * Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears */ - nonWorkingDaysMethod?: 'INCLUDED' | 'EXCLUDED' + nonWorkingDaysMethod?: 'INCLUDED' | 'EXCLUDED' | undefined /** * Defines the tolerance calculation method */ - toleranceCalculationMethod?: 'ARREARS_TOLERANCE_PERIOD' | 'MONTHLY_ARREARS_TOLERANCE_DAY' + toleranceCalculationMethod?: 'ARREARS_TOLERANCE_PERIOD' | 'MONTHLY_ARREARS_TOLERANCE_DAY' | undefined /** * The tolerance floor amount. */ - toleranceFloorAmount?: number + toleranceFloorAmount?: number | undefined /** * Defines the arrears tolerance amount. */ - tolerancePercentageOfOutstandingPrincipal?: number + tolerancePercentageOfOutstandingPrincipal?: number | undefined /** * Defines the arrears tolerance period value. */ - tolerancePeriod?: number + tolerancePeriod?: number | undefined } /** @@ -54,36 +85,36 @@ export interface AccountAuthorizationHold { /** * The key of the account linked with the authorization hold. */ - accountKey?: string + accountKey?: string | undefined /** * Whether the given request should be accepted without balance validations. */ - advice?: boolean + advice?: boolean | undefined /** * The amount of money to be held as a result of the authorization hold request. */ amount: number - cardAcceptor?: CardAcceptor + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * The organization time when the authorization hold was created */ - creationDate?: string + creationDate?: string | undefined /** * Indicates whether the authorization hold amount is credited or debited. If not provided, the default value is DBIT. */ - creditDebitIndicator?: 'DBIT' | 'CRDT' + creditDebitIndicator?: 'DBIT' | 'CRDT' | undefined /** * The ISO currency code in which the hold was created. The amounts are stored in the base currency, but the user could have enter it in a foreign currency. */ - currencyCode?: string + currencyCode?: string | undefined /** * The exchange rate for the original currency. */ - exchangeRate?: number + exchangeRate?: number | undefined /** * The external reference ID to be used to reference the account hold in subsequent requests. */ @@ -91,28 +122,27 @@ export interface AccountAuthorizationHold { /** * The original amount of money to be held as a result of the authorization hold request. */ - originalAmount?: number + originalAmount?: number | undefined /** * The original currency in which the hold was created. */ - originalCurrency?: string + originalCurrency?: string | undefined /** * Indicates the source of the authorization hold. */ - source?: 'CARD' | 'ACCOUNT' + source?: 'CARD' | 'ACCOUNT' | undefined /** * The authorization hold status. */ - status?: 'PENDING' | 'REVERSED' | 'SETTLED' | 'EXPIRED' + status?: 'PENDING' | 'REVERSED' | 'SETTLED' | 'EXPIRED' | undefined /** * The formatted time at which the user made this authorization hold. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } export const AccountAuthorizationHold = { - validate: (await import('./schemas/account-authorization-hold.schema.js')) - .validate as ValidateFunction, + validate: AccountAuthorizationHoldValidator as ValidateFunction, get schema() { return AccountAuthorizationHold.validate.schema }, @@ -120,10 +150,11 @@ export const AccountAuthorizationHold = { return AccountAuthorizationHold.validate.errors ?? undefined }, is: (o: unknown): o is AccountAuthorizationHold => AccountAuthorizationHold.validate(o) === true, - assert: (o: unknown) => { - if (!AccountAuthorizationHold.validate(o)) { - throw new ValidationError(AccountAuthorizationHold.errors ?? []) + parse: (o: unknown): { right: AccountAuthorizationHold } | { left: DefinedError[] } => { + if (AccountAuthorizationHold.is(o)) { + return { right: o } } + return { left: (AccountAuthorizationHold.errors ?? []) as DefinedError[] } }, } as const @@ -134,27 +165,27 @@ export interface AccountBalances { /** * The unique account identifier */ - accountId?: string + accountId?: string | undefined /** * The available balance of a deposit or credit account */ - availableBalance?: number + availableBalance?: number | undefined /** * The card type either DEBIT or CREDIT */ - cardType?: 'DEBIT' | 'CREDIT' + cardType?: 'DEBIT' | 'CREDIT' | undefined /** * The overdraft limit of a deposit account or the loan amount in case of a credit account */ - creditLimit?: number + creditLimit?: number | undefined /** * Currency code used for the account */ - currencyCode?: string + currencyCode?: string | undefined /** * The current balance of a deposit account or principal balance of a revolving credit */ - totalBalance?: number + totalBalance?: number | undefined } /** @@ -164,31 +195,31 @@ export interface AccountInterestRateSettings { /** * The encoded key of the interest rate settings, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Index rate source key. */ - indexSourceKey?: string + indexSourceKey?: string | undefined /** * Interest rate value. */ - interestRate?: number + interestRate?: number | undefined /** * Maximum value allowed for index based interest rate. Valid only for index interest rate. */ - interestRateCeilingValue?: number + interestRateCeilingValue?: number | undefined /** * Minimum value allowed for index based interest rate. Valid only for index interest rate. */ - interestRateFloorValue?: number + interestRateFloorValue?: number | undefined /** * Interest rate review frequency unit count. Valid only for index interest rate. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * Interest rate review frequency measurement unit. Valid only for index interest rate. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * Interest calculation method: fixed or indexed(interest spread + active organization index interest rate) */ @@ -196,7 +227,7 @@ export interface AccountInterestRateSettings { /** * Interest spread value. */ - interestSpread?: number + interestSpread?: number | undefined /** * Date since an interest rate is valid */ @@ -210,29 +241,29 @@ export interface AccountTax { /** * The date when the rate availability was created. */ - creationDate?: string + creationDate?: string | undefined /** * The date when the tax source starts to be used by the account. */ - fromDate?: string + fromDate?: string | undefined /** * The last date when the rate availability was modified. */ - lastModifiedDate?: string - rateSourceEncodedKey?: string + lastModifiedDate?: string | undefined + rateSourceEncodedKey?: string | undefined /** * The id of the source */ - rateSourceId?: string + rateSourceId?: string | undefined /** * The name of the source */ - rateSourceName?: string - savingsAccountEncodedKey?: string + rateSourceName?: string | undefined + savingsAccountEncodedKey?: string | undefined /** * The ending date of the tax source used by the account */ - toDate?: string + toDate?: string | undefined } /** @@ -242,15 +273,15 @@ export interface Amount { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined } /** @@ -260,19 +291,19 @@ export interface AmountWithReduced { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined /** * The reduced amount. */ - reduced?: number + reduced?: number | undefined } /** @@ -286,19 +317,19 @@ export interface ApplyInterestInput { /** * 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. */ - isPaymentHolidaysInterest?: boolean + isPaymentHolidaysInterest?: boolean | undefined /** * Additional information for this action */ - notes?: string + notes?: string | undefined /** * The amount of the Payment Holidays interest to apply */ - paymentHolidaysInterestAmount?: number + paymentHolidaysInterestAmount?: number | undefined } export const ApplyInterestInput = { - validate: (await import('./schemas/apply-interest-input.schema.js')).validate as ValidateFunction, + validate: ApplyInterestInputValidator as ValidateFunction, get schema() { return ApplyInterestInput.validate.schema }, @@ -306,10 +337,11 @@ export const ApplyInterestInput = { return ApplyInterestInput.validate.errors ?? undefined }, is: (o: unknown): o is ApplyInterestInput => ApplyInterestInput.validate(o) === true, - assert: (o: unknown) => { - if (!ApplyInterestInput.validate(o)) { - throw new ValidationError(ApplyInterestInput.errors ?? []) + parse: (o: unknown): { right: ApplyInterestInput } | { left: DefinedError[] } => { + if (ApplyInterestInput.is(o)) { + return { right: o } } + return { left: (ApplyInterestInput.errors ?? []) as DefinedError[] } }, } as const @@ -328,24 +360,24 @@ export interface Asset { /** * The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null. */ - depositAccountKey?: string + depositAccountKey?: string | undefined /** * The encoded key of the security, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The key of the client/group used as the guarantor. */ - guarantorKey?: string + guarantorKey?: string | undefined /** * The type of the guarantor (client/group) */ - guarantorType?: 'CLIENT' | 'GROUP' + guarantorType?: 'CLIENT' | 'GROUP' | undefined /** * The original amount used by the client for a collateral asset */ - originalAmount?: number - originalCurrency?: Currency + originalAmount?: number | undefined + originalCurrency?: Currency | undefined } /** @@ -355,71 +387,71 @@ export interface Balances { /** * The fees balance. Represents the total fees expected to be paid on this account at a given moment. */ - feesBalance?: number + feesBalance?: number | undefined /** * The fees due. Representing the total fees due for the account. */ - feesDue?: number + feesDue?: number | undefined /** * The fees paid. Represents the total fees paid for the account. */ - feesPaid?: number + feesPaid?: number | undefined /** * The sum of all the authorization hold amounts on this account. */ - holdBalance?: number + holdBalance?: number | undefined /** * Represents the total interest owed by the client (total interest applied for account minus interest paid). */ - interestBalance?: number + interestBalance?: number | undefined /** * The interest due. Indicates how much interest it's due for the account at this moment. */ - interestDue?: number + interestDue?: number | undefined /** * 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). */ - interestFromArrearsBalance?: number + interestFromArrearsBalance?: number | undefined /** * The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment. */ - interestFromArrearsDue?: number + interestFromArrearsDue?: number | undefined /** * The interest from arrears paid, indicates total interest from arrears paid into the account. */ - interestFromArrearsPaid?: number + interestFromArrearsPaid?: number | undefined /** * The interest paid, indicates total interest paid into the account. */ - interestPaid?: number + interestPaid?: number | undefined /** * The penalty balance. Represents the total penalty expected to be paid on this account at a given moment. */ - penaltyBalance?: number + penaltyBalance?: number | undefined /** * The penalty due. Represents the total penalty amount due for the account. */ - penaltyDue?: number + penaltyDue?: number | undefined /** * The Penalty paid. Represents the total penalty amount paid for the account. */ - penaltyPaid?: number + penaltyPaid?: number | undefined /** * The total principal owned by the client, from now on (principal disbursed - principal paid). */ - principalBalance?: number + principalBalance?: number | undefined /** * The principal due, indicates how much principal it's due at this moment. */ - principalDue?: number + principalDue?: number | undefined /** * The principal paid, holds the value of the total paid into the account. */ - principalPaid?: number + principalPaid?: number | undefined /** * The total redraw amount owned by the client, from now on. */ - redrawBalance?: number + redrawBalance?: number | undefined } /** @@ -429,7 +461,7 @@ export interface BillingCycleDays { /** * The billing cycle start days in case it is enabled */ - days?: number[] + days?: number[] | undefined } /** @@ -439,7 +471,7 @@ export interface BlockFund { /** * The key of the account which block fund belongs to */ - accountKey?: string + accountKey?: string | undefined /** * The amount to be blocked */ @@ -447,7 +479,7 @@ export interface BlockFund { /** * The date at which the block fund was created */ - creationDate?: string + creationDate?: string | undefined /** * The external reference ID to be used to reference the block fund in subsequent requests */ @@ -455,23 +487,23 @@ export interface BlockFund { /** * The date at which the block fund was created */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * Notes about this block fund */ - notes?: string + notes?: string | undefined /** * The amount that has been seized */ - seizedAmount?: number + seizedAmount?: number | undefined /** * The state of the block fund */ - state?: 'PENDING' | 'SEIZED' | 'REMOVED' | 'PARTIALLY_SEIZED' + state?: 'PENDING' | 'SEIZED' | 'REMOVED' | 'PARTIALLY_SEIZED' | undefined } export const BlockFund = { - validate: (await import('./schemas/block-fund.schema.js')).validate as ValidateFunction, + validate: BlockFundValidator as ValidateFunction, get schema() { return BlockFund.validate.schema }, @@ -479,10 +511,11 @@ export const BlockFund = { return BlockFund.validate.errors ?? undefined }, is: (o: unknown): o is BlockFund => BlockFund.validate(o) === true, - assert: (o: unknown) => { - if (!BlockFund.validate(o)) { - throw new ValidationError(BlockFund.errors ?? []) + parse: (o: unknown): { right: BlockFund } | { left: DefinedError[] } => { + if (BlockFund.is(o)) { + return { right: o } } + return { left: (BlockFund.errors ?? []) as DefinedError[] } }, } as const @@ -493,11 +526,11 @@ export interface BulkInterestAccountSettingsAvailabilityFilter { /** * Ids of accounts that should be processed */ - ids?: string[] + ids?: string[] | undefined /** * Product id to be used for selecting all accounts that should be processed */ - productId?: string + productId?: string | undefined } /** @@ -509,8 +542,8 @@ export interface BulkInterestAccountSettingsAvailabilityInput { } export const BulkInterestAccountSettingsAvailabilityInput = { - validate: (await import('./schemas/bulk-interest-account-settings-availability-input.schema.js')) - .validate as ValidateFunction, + validate: + BulkInterestAccountSettingsAvailabilityInputValidator as ValidateFunction, get schema() { return BulkInterestAccountSettingsAvailabilityInput.validate.schema }, @@ -519,10 +552,11 @@ export const BulkInterestAccountSettingsAvailabilityInput = { }, is: (o: unknown): o is BulkInterestAccountSettingsAvailabilityInput => BulkInterestAccountSettingsAvailabilityInput.validate(o) === true, - assert: (o: unknown) => { - if (!BulkInterestAccountSettingsAvailabilityInput.validate(o)) { - throw new ValidationError(BulkInterestAccountSettingsAvailabilityInput.errors ?? []) + parse: (o: unknown): { right: BulkInterestAccountSettingsAvailabilityInput } | { left: DefinedError[] } => { + if (BulkInterestAccountSettingsAvailabilityInput.is(o)) { + return { right: o } } + return { left: (BulkInterestAccountSettingsAvailabilityInput.errors ?? []) as DefinedError[] } }, } as const @@ -537,7 +571,7 @@ export interface Card { } export const Card = { - validate: (await import('./schemas/card.schema.js')).validate as ValidateFunction, + validate: CardValidator as ValidateFunction, get schema() { return Card.validate.schema }, @@ -545,10 +579,11 @@ export const Card = { return Card.validate.errors ?? undefined }, is: (o: unknown): o is Card => Card.validate(o) === true, - assert: (o: unknown) => { - if (!Card.validate(o)) { - throw new ValidationError(Card.errors ?? []) + parse: (o: unknown): { right: Card } | { left: DefinedError[] } => { + if (Card.is(o)) { + return { right: o } } + return { left: (Card.errors ?? []) as DefinedError[] } }, } as const @@ -559,31 +594,31 @@ export interface CardAcceptor { /** * The city in which the card acceptor has the business. */ - city?: string + city?: string | undefined /** * The country in which the card acceptor has the business. */ - country?: string + country?: string | undefined /** * The Merchant Category Code of the card acceptor. */ - mcc?: number + mcc?: number | undefined /** * The name of the card acceptor. */ - name?: string + name?: string | undefined /** * The state in which the card acceptor has the business. */ - state?: string + state?: string | undefined /** * The street in which the card acceptor has the business. */ - street?: string + street?: string | undefined /** * The ZIP code of the location in which the card acceptor has the business. */ - zip?: string + zip?: string | undefined } /** @@ -597,7 +632,7 @@ export interface ChangeInterestRateAction { /** * The notes or description attached to this object. */ - notes?: string + notes?: string | undefined /** * The date when the interest rate is changed. */ @@ -605,8 +640,7 @@ export interface ChangeInterestRateAction { } export const ChangeInterestRateAction = { - validate: (await import('./schemas/change-interest-rate-action.schema.js')) - .validate as ValidateFunction, + validate: ChangeInterestRateActionValidator as ValidateFunction, get schema() { return ChangeInterestRateAction.validate.schema }, @@ -614,10 +648,11 @@ export const ChangeInterestRateAction = { return ChangeInterestRateAction.validate.errors ?? undefined }, is: (o: unknown): o is ChangeInterestRateAction => ChangeInterestRateAction.validate(o) === true, - assert: (o: unknown) => { - if (!ChangeInterestRateAction.validate(o)) { - throw new ValidationError(ChangeInterestRateAction.errors ?? []) + parse: (o: unknown): { right: ChangeInterestRateAction } | { left: DefinedError[] } => { + if (ChangeInterestRateAction.is(o)) { + return { right: o } } + return { left: (ChangeInterestRateAction.errors ?? []) as DefinedError[] } }, } as const @@ -632,8 +667,7 @@ export interface ChangeWithholdingTaxAction { } export const ChangeWithholdingTaxAction = { - validate: (await import('./schemas/change-withholding-tax-action.schema.js')) - .validate as ValidateFunction, + validate: ChangeWithholdingTaxActionValidator as ValidateFunction, get schema() { return ChangeWithholdingTaxAction.validate.schema }, @@ -641,10 +675,11 @@ export const ChangeWithholdingTaxAction = { return ChangeWithholdingTaxAction.validate.errors ?? undefined }, is: (o: unknown): o is ChangeWithholdingTaxAction => ChangeWithholdingTaxAction.validate(o) === true, - assert: (o: unknown) => { - if (!ChangeWithholdingTaxAction.validate(o)) { - throw new ValidationError(ChangeWithholdingTaxAction.errors ?? []) + parse: (o: unknown): { right: ChangeWithholdingTaxAction } | { left: DefinedError[] } => { + if (ChangeWithholdingTaxAction.is(o)) { + return { right: o } } + return { left: (ChangeWithholdingTaxAction.errors ?? []) as DefinedError[] } }, } as const @@ -839,15 +874,17 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } /** @@ -857,19 +894,19 @@ export interface CustomPredefinedFee { /** * The amount of the custom fee. */ - amount?: number + amount?: number | undefined /** * The encoded key of the custom predefined fee, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The percentage of the custom fee. */ - percentage?: number + percentage?: number | undefined /** * The encoded key of the predefined fee */ - predefinedFeeEncodedKey?: string + predefinedFeeEncodedKey?: string | undefined } /** @@ -879,11 +916,11 @@ export interface DaysInMonth { /** * 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. */ - daysInMonth?: number[] + daysInMonth?: number[] | undefined /** * 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. */ - shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' + shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' | undefined } /** @@ -913,102 +950,103 @@ export interface DepositAccount { | 'CLOSED_WRITTEN_OFF' | 'WITHDRAWN' | 'CLOSED_REJECTED' + | undefined /** * The deposit account type and the product that it belongs to. */ - accountType?: 'CURRENT_ACCOUNT' | 'REGULAR_SAVINGS' | 'FIXED_DEPOSIT' | 'SAVINGS_PLAN' | 'INVESTOR_ACCOUNT' - accruedAmounts?: DepositAccountAccruedAmounts + accountType?: 'CURRENT_ACCOUNT' | 'REGULAR_SAVINGS' | 'FIXED_DEPOSIT' | 'SAVINGS_PLAN' | 'INVESTOR_ACCOUNT' | undefined + accruedAmounts?: DepositAccountAccruedAmounts | undefined /** * The date when the deposit account was activated, in the organization's timezone and time format. */ - activationDate?: string + activationDate?: string | undefined /** * The date when the deposit account was approved, in the organization's timezone and time format. */ - approvedDate?: string + approvedDate?: string | undefined /** * The key of the branch that this deposit account is assigned to. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * The key of the centre that this account is assigned to. */ - assignedCentreKey?: string + assignedCentreKey?: string | undefined /** * The key of the user that this deposit is assigned to. */ - assignedUserKey?: string - balances?: DepositAccountBalances + assignedUserKey?: string | undefined + balances?: DepositAccountBalances | undefined /** * The date when the deposit account was closed, in UTC. */ - closedDate?: string + closedDate?: string | undefined /** * The date this deposit account was created, in UTC. */ - creationDate?: string + creationDate?: string | undefined /** * The key to the credit arrangement where this account is registered. */ - creditArrangementKey?: string + creditArrangementKey?: string | undefined /** * The currency code. */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the deposit account, which is auto-generated and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the deposit account, which can be generated and customized - but must be unique. */ - id?: string - interestSettings?: DepositAccountInterestSettings - internalControls?: DepositAccountInternalControls + id?: string | undefined + interestSettings?: DepositAccountInterestSettings | undefined + internalControls?: DepositAccountInternalControls | undefined /** * The date when the account was last evaluated for interest calculations and maturity, in the organization's timezone and time format. */ - lastAccountAppraisalDate?: string + lastAccountAppraisalDate?: string | undefined /** * The date when interest was last calculated for the account, in the organization's timezone and time format. */ - lastInterestCalculationDate?: string + lastInterestCalculationDate?: string | undefined /** * The date when regular interest was last reviewed, in the organization's timezone and time format. */ - lastInterestReviewDate?: string + lastInterestReviewDate?: string | undefined /** * The date when interest was last applied on the account, in the organization's timezone and time format. */ - lastInterestStoredDate?: string + lastInterestStoredDate?: string | undefined /** * The last update date for the deposit account, in UTC. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The date when the overdraft interest was last reviewed, in the organization's timezone and time format. */ - lastOverdraftInterestReviewDate?: string + lastOverdraftInterestReviewDate?: string | undefined /** * 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. */ - lastSetToArrearsDate?: string + lastSetToArrearsDate?: string | undefined /** * Lists all loan account keys on which the deposit account is used as the settlement account. */ - linkedSettlementAccountKeys?: string[] + linkedSettlementAccountKeys?: string[] | undefined /** * The date when the deposit account was locked, in the organization's timezone and time format. */ - lockedDate?: string + lockedDate?: string | undefined /** * The date when the account matures, for fixed or compulsory savings plans, in the organization's timezone and time format. */ - maturityDate?: string + maturityDate?: string | undefined /** * The migration event encoded key associated with this deposit account. If this account was imported, you can track which migration event it came from. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * The deposit account name. */ @@ -1016,9 +1054,9 @@ export interface DepositAccount { /** * The notes or description attached to this object. */ - notes?: string - overdraftInterestSettings?: DepositAccountOverdraftInterestSettings - overdraftSettings?: DepositAccountOverdraftSettings + notes?: string | undefined + overdraftInterestSettings?: DepositAccountOverdraftInterestSettings | undefined + overdraftSettings?: DepositAccountOverdraftSettings | undefined /** * The key to the product type that this account is based on. */ @@ -1026,11 +1064,11 @@ export interface DepositAccount { /** * The tax source where the account withholding taxes will be updated. */ - withholdingTaxSourceKey?: string + withholdingTaxSourceKey?: string | undefined } export const DepositAccount = { - validate: (await import('./schemas/deposit-account.schema.js')).validate as ValidateFunction, + validate: DepositAccountValidator as ValidateFunction, get schema() { return DepositAccount.validate.schema }, @@ -1038,10 +1076,11 @@ export const DepositAccount = { return DepositAccount.validate.errors ?? undefined }, is: (o: unknown): o is DepositAccount => DepositAccount.validate(o) === true, - assert: (o: unknown) => { - if (!DepositAccount.validate(o)) { - throw new ValidationError(DepositAccount.errors ?? []) + parse: (o: unknown): { right: DepositAccount } | { left: DefinedError[] } => { + if (DepositAccount.is(o)) { + return { right: o } } + return { left: (DepositAccount.errors ?? []) as DefinedError[] } }, } as const @@ -1052,19 +1091,19 @@ export interface DepositAccountAccruedAmounts { /** * The amount of positive interest that has been accrued in the account. */ - interestAccrued?: number + interestAccrued?: number | undefined /** * The amount of negative interest that has been accrued in the account. */ - negativeInterestAccrued?: number + negativeInterestAccrued?: number | undefined /** * The amount of overdraft interest that has been accrued in the account. */ - overdraftInterestAccrued?: number + overdraftInterestAccrued?: number | undefined /** * The amount of technical overdraft interest that has been accrued in the account. */ - technicalOverdraftInterestAccrued?: number + technicalOverdraftInterestAccrued?: number | undefined } /** @@ -1078,11 +1117,11 @@ export interface DepositAccountAction { /** * The notes related to the action performed. */ - notes?: string + notes?: string | undefined } export const DepositAccountAction = { - validate: (await import('./schemas/deposit-account-action.schema.js')).validate as ValidateFunction, + validate: DepositAccountActionValidator as ValidateFunction, get schema() { return DepositAccountAction.validate.schema }, @@ -1090,10 +1129,11 @@ export const DepositAccountAction = { return DepositAccountAction.validate.errors ?? undefined }, is: (o: unknown): o is DepositAccountAction => DepositAccountAction.validate(o) === true, - assert: (o: unknown) => { - if (!DepositAccountAction.validate(o)) { - throw new ValidationError(DepositAccountAction.errors ?? []) + parse: (o: unknown): { right: DepositAccountAction } | { left: DefinedError[] } => { + if (DepositAccountAction.is(o)) { + return { right: o } } + return { left: (DepositAccountAction.errors ?? []) as DefinedError[] } }, } as const @@ -1104,47 +1144,47 @@ export interface DepositAccountBalances { /** * The current available balance for deposit transactions. */ - availableBalance?: number + availableBalance?: number | undefined /** * The sum of all the blocked amounts on an account. */ - blockedBalance?: number + blockedBalance?: number | undefined /** * The amount of fees due to be paid on this account. */ - feesDue?: number + feesDue?: number | undefined /** * The sum of all the authorization hold amounts that have `CRDT` as the `creditDebitIndicator` for an account. */ - forwardAvailableBalance?: number + forwardAvailableBalance?: number | undefined /** * The sum of all the authorization hold amounts that have `DBIT` as the `creditDebitIndicator` for an account. */ - holdBalance?: number + holdBalance?: number | undefined /** * 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). */ - lockedBalance?: number + lockedBalance?: number | undefined /** * 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). */ - overdraftAmount?: number + overdraftAmount?: number | undefined /** * The amount of interest due to be paid on an account as a result of an authorized overdraft. */ - overdraftInterestDue?: number + overdraftInterestDue?: number | undefined /** * 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). */ - technicalOverdraftAmount?: number + technicalOverdraftAmount?: number | undefined /** * The amount of interest due to be paid on an account as a result of a technical overdraft. */ - technicalOverdraftInterestDue?: number + technicalOverdraftInterestDue?: number | undefined /** * The current balance of the account. */ - totalBalance?: number + totalBalance?: number | undefined } /** @@ -1261,15 +1301,15 @@ export interface DepositAccountFilterCriteria { /** * The second value to match the searching criteria, when the `BETWEEN` operator is used. */ - secondValue?: string + secondValue?: string | undefined /** * The value to match the searching criteria. */ - value?: string + value?: string | undefined /** * List of values when the `IN` operator is used. */ - values?: string[] + values?: string[] | undefined } /** @@ -1279,15 +1319,15 @@ export interface DepositAccountInterestAvailabilitySettings { /** * The interest rate for the deposit account */ - interestRate?: number + interestRate?: number | undefined /** * The list of interest rate tiers. An interest rate tier holds the values to define how the interest is computed */ - interestRateTiers?: DepositAccountInterestRateTier[] + interestRateTiers?: DepositAccountInterestRateTier[] | undefined /** * The rate based on which the interest is accrued and applied for accounts with InterestRateSource#INDEX_INTEREST_RATE */ - interestSpread?: number + interestSpread?: number | undefined } /** @@ -1297,7 +1337,7 @@ export interface DepositAccountInterestPaymentSettings { /** * The list of all dates when the interest is paid into the deposit account. */ - interestPaymentDates?: MonthAndDay[] + interestPaymentDates?: MonthAndDay[] | undefined /** * The interest payment point, which specifies when the interest should be paid to the account. */ @@ -1312,6 +1352,7 @@ export interface DepositAccountInterestPaymentSettings { | 'ANNUALLY' | 'BI_ANNUALLY' | 'ON_ACCOUNT_MATURITY' + | undefined } /** @@ -1321,43 +1362,50 @@ export interface DepositAccountInterestRateSettings { /** * The encoded key for the set of interest settings, which is auto-generated and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The interest charge frequency, which shows how often interest is charged on loan or deposit accounts. */ - interestChargeFrequency?: 'ANNUALIZED' | 'EVERY_MONTH' | 'EVERY_FOUR_WEEKS' | 'EVERY_WEEK' | 'EVERY_DAY' | 'EVERY_X_DAYS' + interestChargeFrequency?: + | 'ANNUALIZED' + | 'EVERY_MONTH' + | 'EVERY_FOUR_WEEKS' + | 'EVERY_WEEK' + | 'EVERY_DAY' + | 'EVERY_X_DAYS' + | undefined /** * The number of times to apply interest in a time period. */ - interestChargeFrequencyCount?: number + interestChargeFrequencyCount?: number | undefined /** * The interest rate for the deposit account. */ - interestRate?: number + interestRate?: number | undefined /** * The number of times to review the interest rate in a time period. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * The time unit to use to determine the frequency of interest rate reviews. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * The interest calculation method used. */ - interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' + interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' | undefined /** * The terms for how interest rate is determined when accruing for an account. */ - interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' + interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' | undefined /** * The list of interest rate tiers, which hold the values to define how interest is calculated. */ - interestRateTiers?: DepositAccountInterestRateTier[] + interestRateTiers?: DepositAccountInterestRateTier[] | undefined /** * The index interest rate that is used to calculate the interest rate that is applied to accounts. */ - interestSpread?: number + interestSpread?: number | undefined } /** @@ -1367,15 +1415,15 @@ export interface DepositAccountInterestRateTier { /** * The encoded key of the interest rate tier, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The top-limit value for the account balance in order to determine if this tier is used or not */ - endingBalance?: number + endingBalance?: number | undefined /** * The end date for the account period. Used to determine if this interest rate tier is used or not. */ - endingDay?: number + endingDay?: number | undefined /** * The rate used for computing the interest for an account which has the balance less than the ending balance */ @@ -1386,8 +1434,8 @@ export interface DepositAccountInterestRateTier { * Represents information about the deposit account's interest settings. */ export interface DepositAccountInterestSettings { - interestPaymentSettings?: DepositAccountInterestPaymentSettings - interestRateSettings?: DepositAccountInterestRateSettings + interestPaymentSettings?: DepositAccountInterestPaymentSettings | undefined + interestRateSettings?: DepositAccountInterestRateSettings | undefined } /** @@ -1397,19 +1445,19 @@ export interface DepositAccountInternalControls { /** * The maximum deposit balance of the account. */ - maxDepositBalance?: number + maxDepositBalance?: number | undefined /** * The maximum amount allowed for a withdrawal. */ - maxWithdrawalAmount?: number + maxWithdrawalAmount?: number | undefined /** * The recommended amount for a deposit. */ - recommendedDepositAmount?: number + recommendedDepositAmount?: number | undefined /** * The target amount for a deposit made towards a savings goal. */ - targetAmount?: number + targetAmount?: number | undefined } /** @@ -1419,50 +1467,57 @@ export interface DepositAccountOverdraftInterestRateSettings { /** * The encoded key for the set of interest settings, which is auto-generated and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The interest charge frequency, which shows how often interest is charged on loan or deposit accounts. */ - interestChargeFrequency?: 'ANNUALIZED' | 'EVERY_MONTH' | 'EVERY_FOUR_WEEKS' | 'EVERY_WEEK' | 'EVERY_DAY' | 'EVERY_X_DAYS' + interestChargeFrequency?: + | 'ANNUALIZED' + | 'EVERY_MONTH' + | 'EVERY_FOUR_WEEKS' + | 'EVERY_WEEK' + | 'EVERY_DAY' + | 'EVERY_X_DAYS' + | undefined /** * The number of times to apply interest in a time period. */ - interestChargeFrequencyCount?: number + interestChargeFrequencyCount?: number | undefined /** * The interest rate for the deposit account. */ - interestRate?: number + interestRate?: number | undefined /** * The number of times to review the interest rate in a time period. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * The time unit to use to determine the frequency of interest rate reviews. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * The interest calculation method used. */ - interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' + interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' | undefined /** * The terms for how interest rate is determined when accruing for an account. */ - interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' + interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' | undefined /** * The list of interest rate tiers, which hold the values to define how interest is calculated. */ - interestRateTiers?: DepositAccountInterestRateTier[] + interestRateTiers?: DepositAccountInterestRateTier[] | undefined /** * The index interest rate that is used to calculate the interest rate that is applied to accounts. */ - interestSpread?: number + interestSpread?: number | undefined } /** * Represents information about a deposit account's overdraft interest settings. */ export interface DepositAccountOverdraftInterestSettings { - interestRateSettings?: DepositAccountOverdraftInterestRateSettings + interestRateSettings?: DepositAccountOverdraftInterestRateSettings | undefined } /** @@ -1472,15 +1527,15 @@ export interface DepositAccountOverdraftSettings { /** * `TRUE` if this account supports overdraft, `FALSE` otherwise. */ - allowOverdraft?: boolean + allowOverdraft?: boolean | undefined /** * The expiration date of an overdraft. */ - overdraftExpiryDate?: string + overdraftExpiryDate?: string | undefined /** * The limit amount that may be taken out as overdraft, where null means 0. */ - overdraftLimit?: number + overdraftLimit?: number | undefined } /** @@ -1490,13 +1545,12 @@ export interface DepositAccountSearchCriteria { /** * The list of filtering criteria. */ - filterCriteria?: DepositAccountFilterCriteria[] - sortingCriteria?: DepositAccountSortingCriteria + filterCriteria?: DepositAccountFilterCriteria[] | undefined + sortingCriteria?: DepositAccountSortingCriteria | undefined } export const DepositAccountSearchCriteria = { - validate: (await import('./schemas/deposit-account-search-criteria.schema.js')) - .validate as ValidateFunction, + validate: DepositAccountSearchCriteriaValidator as ValidateFunction, get schema() { return DepositAccountSearchCriteria.validate.schema }, @@ -1504,10 +1558,11 @@ export const DepositAccountSearchCriteria = { return DepositAccountSearchCriteria.validate.errors ?? undefined }, is: (o: unknown): o is DepositAccountSearchCriteria => DepositAccountSearchCriteria.validate(o) === true, - assert: (o: unknown) => { - if (!DepositAccountSearchCriteria.validate(o)) { - throw new ValidationError(DepositAccountSearchCriteria.errors ?? []) + parse: (o: unknown): { right: DepositAccountSearchCriteria } | { left: DefinedError[] } => { + if (DepositAccountSearchCriteria.is(o)) { + return { right: o } } + return { left: (DepositAccountSearchCriteria.errors ?? []) as DefinedError[] } }, } as const @@ -1575,7 +1630,7 @@ export interface DepositAccountSortingCriteria { /** * The sorting order: `ASC` or `DESC`. The default order is `DESC`. */ - order?: 'ASC' | 'DESC' + order?: 'ASC' | 'DESC' | undefined } /** @@ -1585,32 +1640,32 @@ export interface DisbursementDetails { /** * The activation date, the date when the disbursement actually took place. */ - disbursementDate?: string + disbursementDate?: string | undefined /** * The encoded key of the disbursement details, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The date of the expected disbursement.Stored as Organization Time. */ - expectedDisbursementDate?: string + expectedDisbursementDate?: string | undefined /** * List of fees that should be applied at the disbursement time. */ - fees?: CustomPredefinedFee[] + fees?: CustomPredefinedFee[] | undefined /** * The date of the expected first repayment. Stored as Organization Time. */ - firstRepaymentDate?: string - transactionDetails?: LoanTransactionDetails + firstRepaymentDate?: string | undefined + transactionDetails?: LoanTransactionDetails | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -1618,10 +1673,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -1632,26 +1688,25 @@ export interface FeeAmount { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The expected amount, which is the sum of unapplied fee and planned fee due amounts. */ - expectedUnapplied?: number + expectedUnapplied?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined } export type GetAllAuthorizationHoldsResponse = GetAuthorizationHold[] export const GetAllAuthorizationHoldsResponse = { - validate: (await import('./schemas/get-all-authorization-holds-response.schema.js')) - .validate as ValidateFunction, + validate: GetAllAuthorizationHoldsResponseValidator as ValidateFunction, get schema() { return GetAllAuthorizationHoldsResponse.validate.schema }, @@ -1659,12 +1714,18 @@ export const GetAllAuthorizationHoldsResponse = { return GetAllAuthorizationHoldsResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllAuthorizationHoldsResponse => GetAllAuthorizationHoldsResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllAuthorizationHoldsResponse } | { left: DefinedError[] } => { + if (GetAllAuthorizationHoldsResponse.is(o)) { + return { right: o } + } + return { left: (GetAllAuthorizationHoldsResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetAllBlocksResponse = BlockFund[] export const GetAllBlocksResponse = { - validate: (await import('./schemas/get-all-blocks-response.schema.js')).validate as ValidateFunction, + validate: GetAllBlocksResponseValidator as ValidateFunction, get schema() { return GetAllBlocksResponse.validate.schema }, @@ -1672,12 +1733,18 @@ export const GetAllBlocksResponse = { return GetAllBlocksResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllBlocksResponse => GetAllBlocksResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllBlocksResponse } | { left: DefinedError[] } => { + if (GetAllBlocksResponse.is(o)) { + return { right: o } + } + return { left: (GetAllBlocksResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetAllCardsResponse = Card[] export const GetAllCardsResponse = { - validate: (await import('./schemas/get-all-cards-response.schema.js')).validate as ValidateFunction, + validate: GetAllCardsResponseValidator as ValidateFunction, get schema() { return GetAllCardsResponse.validate.schema }, @@ -1685,12 +1752,18 @@ export const GetAllCardsResponse = { return GetAllCardsResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllCardsResponse => GetAllCardsResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllCardsResponse } | { left: DefinedError[] } => { + if (GetAllCardsResponse.is(o)) { + return { right: o } + } + return { left: (GetAllCardsResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetAllResponse = DepositAccount[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -1698,6 +1771,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -1707,7 +1786,7 @@ export interface GetAuthorizationHold { /** * The key of the account linked with the authorization hold. */ - accountKey?: string + accountKey?: string | undefined /** * Whether the given request should be accepted without balance validations. */ @@ -1716,36 +1795,36 @@ export interface GetAuthorizationHold { * The amount of money to be held as a result of the authorization hold request. */ amount: number - balances?: AccountBalances - cardAcceptor?: CardAcceptor + balances?: AccountBalances | undefined + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * The organization time when the authorization hold was created */ - creationDate?: string + creationDate?: string | undefined /** * Indicates whether the authorization hold amount is credited or debited.If not provided, the default values is DBIT. */ - creditDebitIndicator?: 'DBIT' | 'CRDT' + creditDebitIndicator?: 'DBIT' | 'CRDT' | undefined /** * The ISO currency code in which the hold was created. The amounts are stored in the base currency, but the user could have enter it in a foreign currency. */ - currencyCode?: string + currencyCode?: string | undefined /** * The custom expiration period for the hold which overwrites mcc and default expiration periods */ - customExpirationPeriod?: number + customExpirationPeriod?: number | undefined /** * The internal ID of the authorization hold, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The exchange rate for the original currency. */ - exchangeRate?: number + exchangeRate?: number | undefined /** * The external reference ID to be used to reference the account hold in subsequent requests. */ @@ -1753,38 +1832,37 @@ export interface GetAuthorizationHold { /** * The original amount of money to be held as a result of the authorization hold request. */ - originalAmount?: number + originalAmount?: number | undefined /** * The original currency in which the hold was created. */ - originalCurrency?: string + originalCurrency?: string | undefined /** * Indicates whether the authorization is partial or not */ - partial?: boolean + partial?: boolean | undefined /** * The date to consider as start date when calculating the number of days passed until expiration */ - referenceDateForExpiration?: string + referenceDateForExpiration?: string | undefined /** * Indicates the source of the authorization hold, the default values is CARD. */ - source?: 'CARD' | 'ACCOUNT' + source?: 'CARD' | 'ACCOUNT' | undefined /** * The authorization hold status. */ - status?: 'PENDING' | 'REVERSED' | 'SETTLED' | 'EXPIRED' + status?: 'PENDING' | 'REVERSED' | 'SETTLED' | 'EXPIRED' | undefined /** * The formatted time at which the user made this authorization hold. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } export type GetDepositAccountDocumentResponse = string export const GetDepositAccountDocumentResponse = { - validate: (await import('./schemas/get-deposit-account-document-response.schema.js')) - .validate as ValidateFunction, + validate: GetDepositAccountDocumentResponseValidator as ValidateFunction, get schema() { return GetDepositAccountDocumentResponse.validate.schema }, @@ -1792,13 +1870,18 @@ export const GetDepositAccountDocumentResponse = { return GetDepositAccountDocumentResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetDepositAccountDocumentResponse => GetDepositAccountDocumentResponse.validate(o) === true, + parse: (o: unknown): { right: GetDepositAccountDocumentResponse } | { left: DefinedError[] } => { + if (GetDepositAccountDocumentResponse.is(o)) { + return { right: o } + } + return { left: (GetDepositAccountDocumentResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetFundedLoansResponse = LoanAccount[] export const GetFundedLoansResponse = { - validate: (await import('./schemas/get-funded-loans-response.schema.js')) - .validate as ValidateFunction, + validate: GetFundedLoansResponseValidator as ValidateFunction, get schema() { return GetFundedLoansResponse.validate.schema }, @@ -1806,13 +1889,37 @@ export const GetFundedLoansResponse = { return GetFundedLoansResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetFundedLoansResponse => GetFundedLoansResponse.validate(o) === true, + parse: (o: unknown): { right: GetFundedLoansResponse } | { left: DefinedError[] } => { + if (GetFundedLoansResponse.is(o)) { + return { right: o } + } + return { left: (GetFundedLoansResponse.errors ?? []) as DefinedError[] } + }, +} as const + +export type GetInterestAvailabilitiesListResponse = InterestAccountSettingsAvailabilityResponse[] + +export const GetInterestAvailabilitiesListResponse = { + validate: GetInterestAvailabilitiesListResponseValidator as ValidateFunction, + get schema() { + return GetInterestAvailabilitiesListResponse.validate.schema + }, + get errors() { + return GetInterestAvailabilitiesListResponse.validate.errors ?? undefined + }, + is: (o: unknown): o is GetInterestAvailabilitiesListResponse => GetInterestAvailabilitiesListResponse.validate(o) === true, + parse: (o: unknown): { right: GetInterestAvailabilitiesListResponse } | { left: DefinedError[] } => { + if (GetInterestAvailabilitiesListResponse.is(o)) { + return { right: o } + } + return { left: (GetInterestAvailabilitiesListResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetWithholdingTaxHistoryResponse = AccountTax[] export const GetWithholdingTaxHistoryResponse = { - validate: (await import('./schemas/get-withholding-tax-history-response.schema.js')) - .validate as ValidateFunction, + validate: GetWithholdingTaxHistoryResponseValidator as ValidateFunction, get schema() { return GetWithholdingTaxHistoryResponse.validate.schema }, @@ -1820,6 +1927,12 @@ export const GetWithholdingTaxHistoryResponse = { return GetWithholdingTaxHistoryResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetWithholdingTaxHistoryResponse => GetWithholdingTaxHistoryResponse.validate(o) === true, + parse: (o: unknown): { right: GetWithholdingTaxHistoryResponse } | { left: DefinedError[] } => { + if (GetWithholdingTaxHistoryResponse.is(o)) { + return { right: o } + } + return { left: (GetWithholdingTaxHistoryResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -1833,15 +1946,15 @@ export interface Guarantor { /** * The name of a value the client guarantees with (populated when the guaranty type is ASSET) */ - assetName?: string + assetName?: string | undefined /** * The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null. */ - depositAccountKey?: string + depositAccountKey?: string | undefined /** * The encoded key of the security, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The key of the client/group used as the guarantor. */ @@ -1859,94 +1972,94 @@ export interface Installment { /** * The installment due date. */ - dueDate?: string + dueDate?: string | undefined /** * The encoded key of the installment, which is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The expected closing balance is the remaining amount per installment only applicable for interest only equal installment products. */ - expectedClosingBalance?: number - fee?: InstallmentFee + expectedClosingBalance?: number | undefined + fee?: InstallmentFee | undefined /** * The breakdown of the fee amounts that have been applied to the loan account. */ - feeDetails?: InstallmentFeeDetails[] - interest?: InstallmentAllocationElementTaxableAmount + feeDetails?: InstallmentFeeDetails[] | undefined + interest?: InstallmentAllocationElementTaxableAmount | undefined /** * The interest accrued calculated on previous repayment closing balance only applicable interest only equal installment products. */ - interestAccrued?: number + interestAccrued?: number | undefined /** * `TRUE` if a payment holiday is offered for the installment, `FALSE` otherwise. */ - isPaymentHoliday?: boolean + isPaymentHoliday?: boolean | undefined /** * The installment last paid date. */ - lastPaidDate?: string + lastPaidDate?: string | undefined /** * The order number of an installment among all the installments generated for a loan. Loan installments are put in ascending order by due date. The order number only applies to the content of a particular JSON response therefore it is not unique. */ - number?: string + number?: string | undefined /** * The parent account key of the installment. */ - parentAccountKey?: string - penalty?: InstallmentAllocationElementTaxableAmount - principal?: InstallmentAllocationElementAmount + parentAccountKey?: string | undefined + penalty?: InstallmentAllocationElementTaxableAmount | undefined + principal?: InstallmentAllocationElementAmount | undefined /** * The installment repaid date. */ - repaidDate?: string + repaidDate?: string | undefined /** * The installment state. */ - state?: 'PENDING' | 'LATE' | 'PAID' | 'PARTIALLY_PAID' | 'GRACE' + state?: 'PENDING' | 'LATE' | 'PAID' | 'PARTIALLY_PAID' | 'GRACE' | undefined } /** * Represents an installment allocation element amount structure. */ export interface InstallmentAllocationElementAmount { - amount?: Amount + amount?: Amount | undefined } /** * Represents an installment allocation element taxable amount structure. */ export interface InstallmentAllocationElementTaxableAmount { - amount?: Amount - tax?: Amount + amount?: Amount | undefined + tax?: Amount | undefined } /** * Represents an installment fee structure. */ export interface InstallmentFee { - amount?: FeeAmount - tax?: Amount + amount?: FeeAmount | undefined + tax?: Amount | undefined } /** * Represents fee details for an installment. */ export interface InstallmentFeeDetails { - amount?: AmountWithReduced + amount?: AmountWithReduced | undefined /** * The encoded key of the predefined fee, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The id of the fee, provided by the client */ - id?: string + id?: string | undefined /** * The name of the fee */ - name?: string - tax?: AmountWithReduced + name?: string | undefined + tax?: AmountWithReduced | undefined } /** @@ -1956,7 +2069,7 @@ export interface InterestAccountSettingsAvailability { /** * The encoded key of the Interest Availability, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined interestRateSettings: DepositAccountInterestAvailabilitySettings /** * Start date of the Interest Availability. @@ -1968,20 +2081,90 @@ export interface InterestAccountSettingsAvailability { type: 'INTEREST' | 'OVERDRAFT' | 'TECHNICAL_OVERDRAFT' } +export const InterestAccountSettingsAvailability = { + validate: InterestAccountSettingsAvailabilityValidator as ValidateFunction, + get schema() { + return InterestAccountSettingsAvailability.validate.schema + }, + get errors() { + return InterestAccountSettingsAvailability.validate.errors ?? undefined + }, + is: (o: unknown): o is InterestAccountSettingsAvailability => InterestAccountSettingsAvailability.validate(o) === true, + parse: (o: unknown): { right: InterestAccountSettingsAvailability } | { left: DefinedError[] } => { + if (InterestAccountSettingsAvailability.is(o)) { + return { right: o } + } + return { left: (InterestAccountSettingsAvailability.errors ?? []) as DefinedError[] } + }, +} as const + /** - * Represents interest rate change threshold settings for loan accounts and loan products. + * Interest Availability of a Deposit Account */ -export interface InterestRateChangePMTAdjustmentThreshold { +export interface InterestAccountSettingsAvailabilityResponse { + /** + * The encoded key of the Interest Availability, auto generated, unique. + */ + encodedKey?: string | undefined + interestRateSettings?: DepositAccountInterestRateSettings | undefined + /** + * Start date of the Interest Availability. + */ + startDate?: string | undefined /** - * The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS + * Type of the interest. */ - method?: 'WORKING_DAYS' | 'CALENDAR_DAYS' + type?: 'INTEREST' | 'OVERDRAFT' | 'TECHNICAL_OVERDRAFT' | undefined +} + +export const InterestAccountSettingsAvailabilityResponse = { + validate: + InterestAccountSettingsAvailabilityResponseValidator as ValidateFunction, + get schema() { + return InterestAccountSettingsAvailabilityResponse.validate.schema + }, + get errors() { + return InterestAccountSettingsAvailabilityResponse.validate.errors ?? undefined + }, + is: (o: unknown): o is InterestAccountSettingsAvailabilityResponse => + InterestAccountSettingsAvailabilityResponse.validate(o) === true, + parse: (o: unknown): { right: InterestAccountSettingsAvailabilityResponse } | { left: DefinedError[] } => { + if (InterestAccountSettingsAvailabilityResponse.is(o)) { + return { right: o } + } + return { left: (InterestAccountSettingsAvailabilityResponse.errors ?? []) as DefinedError[] } + }, +} as const + +/** + * Interest Availability of a Deposit Account + */ +export interface InterestAccountSettingsAvailabilityUpdate { /** - * The number of days that trigger an interest rate change. + * The encoded key of the Interest Availability, auto generated, unique. */ - numberOfDays?: number + encodedKey?: string | undefined + interestRateSettings: DepositAccountInterestAvailabilitySettings } +export const InterestAccountSettingsAvailabilityUpdate = { + validate: InterestAccountSettingsAvailabilityUpdateValidator as ValidateFunction, + get schema() { + return InterestAccountSettingsAvailabilityUpdate.validate.schema + }, + get errors() { + return InterestAccountSettingsAvailabilityUpdate.validate.errors ?? undefined + }, + is: (o: unknown): o is InterestAccountSettingsAvailabilityUpdate => + InterestAccountSettingsAvailabilityUpdate.validate(o) === true, + parse: (o: unknown): { right: InterestAccountSettingsAvailabilityUpdate } | { left: DefinedError[] } => { + if (InterestAccountSettingsAvailabilityUpdate.is(o)) { + return { right: o } + } + return { left: (InterestAccountSettingsAvailabilityUpdate.errors ?? []) as DefinedError[] } + }, +} as const + /** * The interest settings, holds all the properties regarding interests for the loan account. */ @@ -1989,57 +2172,64 @@ export interface InterestSettings { /** * Adjustable interest rates settings for loan account */ - accountInterestRateSettings?: AccountInterestRateSettings[] + accountInterestRateSettings?: AccountInterestRateSettings[] | undefined /** * The accrue interest after maturity. If the product support this option, specify if the interest should be accrued after the account maturity date. */ - accrueInterestAfterMaturity?: boolean + accrueInterestAfterMaturity?: boolean | undefined /** * Indicates whether late interest is accrued for this loan account */ - accrueLateInterest?: boolean - interestApplicationDays?: DaysInMonth + accrueLateInterest?: boolean | 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. */ - interestApplicationMethod?: 'AFTER_DISBURSEMENT' | 'REPAYMENT_DUE_DATE' | 'FIXED_DAYS_OF_MONTH' + interestApplicationMethod?: 'AFTER_DISBURSEMENT' | 'REPAYMENT_DUE_DATE' | 'FIXED_DAYS_OF_MONTH' | undefined /** * The interest balance calculation method. Represents the option which determines the way the balance for the account's interest is computed. */ - interestBalanceCalculationMethod?: 'ONLY_PRINCIPAL' | 'PRINCIPAL_AND_INTEREST' + interestBalanceCalculationMethod?: 'ONLY_PRINCIPAL' | 'PRINCIPAL_AND_INTEREST' | undefined /** * The interest calculation method. Holds the type of interest calculation method. */ - interestCalculationMethod?: 'FLAT' | 'DECLINING_BALANCE' | 'DECLINING_BALANCE_DISCOUNTED' | 'EQUAL_INSTALLMENTS' + interestCalculationMethod?: 'FLAT' | 'DECLINING_BALANCE' | 'DECLINING_BALANCE_DISCOUNTED' | 'EQUAL_INSTALLMENTS' | undefined /** * The interest change frequency. Holds the possible values for how often is interest charged on loan or deposit accounts */ - interestChargeFrequency?: 'ANNUALIZED' | 'EVERY_MONTH' | 'EVERY_FOUR_WEEKS' | 'EVERY_WEEK' | 'EVERY_DAY' | 'EVERY_X_DAYS' + interestChargeFrequency?: + | 'ANNUALIZED' + | 'EVERY_MONTH' + | 'EVERY_FOUR_WEEKS' + | 'EVERY_WEEK' + | 'EVERY_DAY' + | 'EVERY_X_DAYS' + | undefined /** * 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. */ - interestRate?: number - interestRateChangePMTAdjustmentThreshold?: InterestRateChangePMTAdjustmentThreshold + interestRate?: number | undefined /** * Interest rate update frequency unit count. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * The interest rate review unit. Defines the interest rate update frequency measurement unit. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * The interest rate source. Represents the interest calculation method: fixed or (interest spread + active organization index interest rate) */ - interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' + interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' | undefined /** * Interest to be added to active organization index interest rate in order to find out actual interest rate */ - interestSpread?: number + interestSpread?: number | undefined /** * The possible values for how we compute and apply the interest */ - interestType?: 'SIMPLE_INTEREST' | 'CAPITALIZED_INTEREST' | 'COMPOUNDING_INTEREST' + interestType?: 'SIMPLE_INTEREST' | 'CAPITALIZED_INTEREST' | 'COMPOUNDING_INTEREST' | undefined + pmtAdjustmentThreshold?: PMTAdjustmentThreshold | undefined } /** @@ -2053,15 +2243,15 @@ export interface InvestorFund { /** * The name of a value the client guarantees with (populated when the guaranty type is ASSET) */ - assetName?: string + assetName?: string | undefined /** * The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null. */ - depositAccountKey?: string + depositAccountKey?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The key of the client/group used as the guarantor. */ @@ -2073,22 +2263,22 @@ export interface InvestorFund { /** * Investor fund unique identifier. All versions of an investor fund will have same id. */ - id?: string + id?: string | undefined /** * The constraint minimum value */ - interestCommission?: number + interestCommission?: number | undefined /** * Percentage of loan shares this investor owns */ - sharePercentage?: number + sharePercentage?: number | undefined } /** * 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. */ export interface LoanAccount { - accountArrearsSettings?: AccountArrearsSettings + accountArrearsSettings?: AccountArrearsSettings | undefined /** * The encoded key of the account holder. */ @@ -2100,7 +2290,7 @@ export interface LoanAccount { /** * The state of the loan account. */ - accountState?: 'PARTIAL_APPLICATION' | 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'ACTIVE_IN_ARREARS' | 'CLOSED' + accountState?: 'PARTIAL_APPLICATION' | 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'ACTIVE_IN_ARREARS' | 'CLOSED' | undefined /** * 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`. */ @@ -2115,134 +2305,139 @@ export interface LoanAccount { | 'REJECTED' | 'WRITTEN_OFF' | 'TERMINATED' + | undefined /** * The amount of interest that has been accrued in the loan account. */ - accruedInterest?: number + accruedInterest?: number | undefined /** * The accrued penalty, represents the amount of penalty that has been accrued in the loan account. */ - accruedPenalty?: number + accruedPenalty?: number | undefined /** * The encoded key of the transaction that activated the loan account. */ - activationTransactionKey?: string + activationTransactionKey?: string | undefined /** * DEPRECATED - Will always be false. */ - allowOffset?: boolean + allowOffset?: boolean | undefined /** * The date the loan account was approved. */ - approvedDate?: string + approvedDate?: string | undefined /** * The arrears tolerance (period or day of month) depending on the product settings. */ - arrearsTolerancePeriod?: number + arrearsTolerancePeriod?: number | undefined /** * The list of assets associated with the current loan account. */ - assets?: Asset[] + assets?: Asset[] | undefined /** * The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * The key of the centre this account is assigned to. */ - assignedCentreKey?: string + assignedCentreKey?: string | undefined /** * The key of the user this loan account is assigned to. */ - assignedUserKey?: string - balances?: Balances + assignedUserKey?: string | undefined + balances?: Balances | undefined /** * The date the loan was closed. */ - closedDate?: string + closedDate?: string | undefined /** * The date the loan account was created. */ - creationDate?: string + creationDate?: string | undefined /** * The key to the line of credit where this account is registered to. */ - creditArrangementKey?: string - currency?: Currency + creditArrangementKey?: string | undefined + currency?: Currency | undefined /** * The number of days the loan account is in arrears. */ - daysInArrears?: number + daysInArrears?: number | undefined /** * The number of days a repayment for the loan account is late. */ - daysLate?: number - disbursementDetails?: DisbursementDetails + daysLate?: number | undefined + disbursementDetails?: DisbursementDetails | undefined /** * The encoded key of the loan account, it is auto generated, and must be unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The list of funds associated with the loan account. */ - fundingSources?: InvestorFund[] + fundingSources?: InvestorFund[] | undefined /** * Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account. */ - futurePaymentsAcceptance?: 'NO_FUTURE_PAYMENTS' | 'ACCEPT_FUTURE_PAYMENTS' | 'ACCEPT_OVERPAYMENTS' + futurePaymentsAcceptance?: 'NO_FUTURE_PAYMENTS' | 'ACCEPT_FUTURE_PAYMENTS' | 'ACCEPT_OVERPAYMENTS' | undefined /** * The list of guarantees associated with the loan account. */ - guarantors?: Guarantor[] + guarantors?: Guarantor[] | undefined /** * The ID of the loan account, it can be generated and customized, and must be unique. */ - id?: string + id?: string | undefined /** * The interest that is accrued in the current billing cycle. */ - interestAccruedInBillingCycle?: number + interestAccruedInBillingCycle?: number | undefined /** * The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled. */ - interestCommission?: number + interestCommission?: number | undefined /** * The amount of interest from arrears that has been accrued in the loan account. */ - interestFromArrearsAccrued?: number - interestSettings?: InterestSettings + interestFromArrearsAccrued?: number | undefined + interestSettings?: InterestSettings | undefined /** * 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. */ - lastAccountAppraisalDate?: string + lastAccountAppraisalDate?: string | undefined /** * 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. */ - lastInterestAppliedDate?: string + lastInterestAppliedDate?: string | undefined /** * The date the interest was reviewed last time, stored in the organization time format and time zone. */ - lastInterestReviewDate?: string + lastInterestReviewDate?: string | undefined /** * 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. */ - lastLockedDate?: string + lastLockedDate?: string | undefined /** * The last date the loan was updated. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * 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. */ - lastSetToArrearsDate?: string + lastSetToArrearsDate?: string | undefined /** * The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone. */ - lastTaxRateReviewDate?: string + lastTaxRateReviewDate?: string | undefined /** * The overdue payments recalculation method inherited from the loan product on which this loan account is based. */ - latePaymentsRecalculationMethod?: 'OVERDUE_INSTALLMENTS_INCREASE' | 'LAST_INSTALLMENT_INCREASE' + latePaymentsRecalculationMethod?: + | 'OVERDUE_INSTALLMENTS_INCREASE' + | 'LAST_INSTALLMENT_INCREASE' + | 'NO_RECALCULATION' + | undefined /** * The loan amount. */ @@ -2250,72 +2445,72 @@ export interface LoanAccount { /** * The name of the loan account. */ - loanName?: string + loanName?: string | undefined /** * The locked account total due type. */ - lockedAccountTotalDueType?: 'BALANCE_AMOUNT' | 'DUE_AMOUNT_ON_LATE_INSTALLMENTS' + lockedAccountTotalDueType?: 'BALANCE_AMOUNT' | 'DUE_AMOUNT_ON_LATE_INSTALLMENTS' | undefined /** * A list with operations which are locked when the account is in the AccountState.LOCKED substate. */ - lockedOperations?: ('APPLY_INTEREST' | 'APPLY_FEES' | 'APPLY_PENALTIES')[] + lockedOperations?: ('APPLY_INTEREST' | 'APPLY_FEES' | 'APPLY_PENALTIES')[] | undefined /** * The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency */ - modifyInterestForFirstInstallment?: boolean + modifyInterestForFirstInstallment?: boolean | undefined /** * The notes about this loan account. */ - notes?: string + notes?: string | undefined /** * The key of the original rescheduled or refinanced loan account. */ - originalAccountKey?: string + originalAccountKey?: string | undefined /** * The amount of interest that has been accrued during payment holidays in the loan account. */ - paymentHolidaysAccruedInterest?: number + paymentHolidaysAccruedInterest?: number | undefined /** * The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account). */ - paymentMethod?: 'HORIZONTAL' | 'VERTICAL' - penaltySettings?: PenaltySettings + paymentMethod?: 'HORIZONTAL' | 'VERTICAL' | undefined + penaltySettings?: PenaltySettings | undefined /** * The list with manual fees planned on the installments of the loan account. */ - plannedInstallmentFees?: PlannedInstallmentFee[] - prepaymentSettings?: PrepaymentSettings - principalPaymentSettings?: PrincipalPaymentAccountSettings + plannedInstallmentFees?: PlannedInstallmentFee[] | undefined + prepaymentSettings?: PrepaymentSettings | undefined + principalPaymentSettings?: PrincipalPaymentAccountSettings | undefined /** * The key for the type of loan product that this loan account is based on. */ productTypeKey: string - redrawSettings?: LoanAccountRedrawSettings + redrawSettings?: LoanAccountRedrawSettings | undefined /** * The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled. */ - rescheduledAccountKey?: string + rescheduledAccountKey?: string | undefined scheduleSettings: ScheduleSettings /** * The encoded key of the settlement account. */ - settlementAccountKey?: string + settlementAccountKey?: string | undefined /** * The tax rate. */ - taxRate?: number + taxRate?: number | undefined /** * The date this loan account was terminated. */ - terminationDate?: string + terminationDate?: string | undefined /** * The list of disbursement tranches available for the loan account. */ - tranches?: LoanTranche[] + tranches?: LoanTranche[] | undefined } /** @@ -2332,15 +2527,15 @@ export interface LoanAccountRedrawSettings { * Represents a single loan account schedule structure. */ export interface LoanAccountSchedule { - currency?: Currency + currency?: Currency | undefined /** * The loan account schedule installments list. */ - installments?: Installment[] + installments?: Installment[] | undefined } export const LoanAccountSchedule = { - validate: (await import('./schemas/loan-account-schedule.schema.js')).validate as ValidateFunction, + validate: LoanAccountScheduleValidator as ValidateFunction, get schema() { return LoanAccountSchedule.validate.schema }, @@ -2348,6 +2543,12 @@ export const LoanAccountSchedule = { return LoanAccountSchedule.validate.errors ?? undefined }, is: (o: unknown): o is LoanAccountSchedule => LoanAccountSchedule.validate(o) === true, + parse: (o: unknown): { right: LoanAccountSchedule } | { left: DefinedError[] } => { + if (LoanAccountSchedule.is(o)) { + return { right: o } + } + return { left: (LoanAccountSchedule.errors ?? []) as DefinedError[] } + }, } as const /** @@ -2358,19 +2559,19 @@ export interface LoanTranche { * The amount this tranche has available for disburse */ amount: number - disbursementDetails?: TrancheDisbursementDetails + disbursementDetails?: TrancheDisbursementDetails | undefined /** * The encoded key of the transaction details , auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Fees that are associated with this tranche */ - fees?: CustomPredefinedFee[] + fees?: CustomPredefinedFee[] | undefined /** * Index indicating the tranche number */ - trancheNumber?: number + trancheNumber?: number | undefined } /** @@ -2380,23 +2581,23 @@ export interface LoanTransactionDetails { /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Whether the transaction was transferred between loans or deposit accounts */ - internalTransfer?: boolean + internalTransfer?: boolean | undefined /** * In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made. */ - targetDepositAccountKey?: string + targetDepositAccountKey?: string | undefined /** * The ID of the transaction channel associated with the transaction details. */ - transactionChannelId?: string + transactionChannelId?: string | undefined /** * The encoded key of the transaction channel associated with the transaction details. */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } /** @@ -2406,17 +2607,17 @@ export interface MonthAndDay { /** * The day in the month */ - day?: number + day?: number | undefined /** * The month of the year */ - month?: number + month?: number | undefined } export type PatchBlockFundRequest = PatchOperation[] export const PatchBlockFundRequest = { - validate: (await import('./schemas/patch-block-fund-request.schema.js')).validate as ValidateFunction, + validate: PatchBlockFundRequestValidator as ValidateFunction, get schema() { return PatchBlockFundRequest.validate.schema }, @@ -2424,10 +2625,11 @@ export const PatchBlockFundRequest = { return PatchBlockFundRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchBlockFundRequest => PatchBlockFundRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchBlockFundRequest.validate(o)) { - throw new ValidationError(PatchBlockFundRequest.errors ?? []) + parse: (o: unknown): { right: PatchBlockFundRequest } | { left: DefinedError[] } => { + if (PatchBlockFundRequest.is(o)) { + return { right: o } } + return { left: (PatchBlockFundRequest.errors ?? []) as DefinedError[] } }, } as const @@ -2438,7 +2640,7 @@ export interface PatchOperation { /** * The field from where a value should be moved, when using move */ - from?: string + from?: string | undefined /** * The change to perform */ @@ -2450,15 +2652,13 @@ export interface PatchOperation { /** * The value of the field, can be null */ - value?: { - [k: string]: unknown | undefined - } + value?: unknown } export type PatchRequest = PatchOperation[] export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, + validate: PatchRequestValidator as ValidateFunction, get schema() { return PatchRequest.validate.schema }, @@ -2466,10 +2666,11 @@ export const PatchRequest = { return PatchRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } }, } as const @@ -2480,11 +2681,16 @@ export interface PenaltySettings { /** * The last penalty calculation method, represents on what amount are the penalties calculated. */ - loanPenaltyCalculationMethod?: 'NONE' | 'OVERDUE_BALANCE' | 'OVERDUE_BALANCE_AND_INTEREST' | 'OUTSTANDING_PRINCIPAL' + loanPenaltyCalculationMethod?: + | 'NONE' + | 'OVERDUE_BALANCE' + | 'OVERDUE_BALANCE_AND_INTEREST' + | 'OUTSTANDING_PRINCIPAL' + | undefined /** * The penalty rate, represents the rate (in percent) which is charged as a penalty. */ - penaltyRate?: number + penaltyRate?: number | undefined } /** @@ -2498,7 +2704,7 @@ export interface PeriodicPayment { /** * The encoded key of the periodic payment, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The installment's position up to which the PMT will be used */ @@ -2512,29 +2718,43 @@ export interface PlannedInstallmentFee { /** * The amount of the planned fee. */ - amount?: number + amount?: number | undefined /** * 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. */ - applyOnDate?: string + applyOnDate?: string | undefined /** * The encoded key of the planned installment fee, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The encoded key of the installment on which the predefined fee is planned. */ - installmentKey?: string + installmentKey?: string | undefined /** * 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. */ - installmentNumber?: number + installmentNumber?: number | undefined /** * The encoded key of the predefined fee which is planned. */ predefinedFeeKey: string } +/** + * Represents PMT Adjustment threshold settings for loan accounts and loan products. + */ +export interface PMTAdjustmentThreshold { + /** + * The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS + */ + method?: 'WORKING_DAYS' | 'CALENDAR_DAYS' | undefined + /** + * The number of days that trigger a PMT Adjustment. + */ + numberOfDays?: number | undefined +} + /** * The prepayment settings, holds all prepayment properties. */ @@ -2542,16 +2762,16 @@ export interface PrepaymentSettings { /** * Apply interest on prepayment method copied from loan product on which this account is based. */ - applyInterestOnPrepaymentMethod?: 'AUTOMATIC' | 'MANUAL' + applyInterestOnPrepaymentMethod?: 'AUTOMATIC' | 'MANUAL' | undefined /** * The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated. */ - elementsRecalculationMethod?: 'PRINCIPAL_EXPECTED_FIXED' | 'TOTAL_EXPECTED_FIXED' - ercFreeAllowanceAmount?: number + elementsRecalculationMethod?: 'PRINCIPAL_EXPECTED_FIXED' | 'TOTAL_EXPECTED_FIXED' | undefined + ercFreeAllowanceAmount?: number | undefined /** * Early repayment charge fee free allowance in percentage per year */ - ercFreeAllowancePercentage?: number + ercFreeAllowancePercentage?: number | undefined /** * Prepayment recalculation method copied from the loan product on which this account is based. */ @@ -2564,10 +2784,11 @@ export interface PrepaymentSettings { | 'REDUCE_AMOUNT_PER_INSTALLMENT' | 'REDUCE_NUMBER_OF_INSTALLMENTS' | 'REDUCE_NUMBER_OF_INSTALLMENTS_NEW' + | undefined /** * Installment status for the case when principal is paid off (copied from loan product). */ - principalPaidInstallmentStatus?: 'PARTIALLY_PAID' | 'PAID' | 'ORIGINAL_TOTAL_EXPECTED_PAID' + principalPaidInstallmentStatus?: 'PARTIALLY_PAID' | 'PAID' | 'ORIGINAL_TOTAL_EXPECTED_PAID' | undefined } /** @@ -2577,31 +2798,31 @@ export interface PrincipalPaymentAccountSettings { /** * Fixed amount for being used for the repayments principal due. */ - amount?: number + amount?: number | undefined /** * The encoded key of the principal payment base settings, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account */ - includeFeesInFloorAmount?: boolean + includeFeesInFloorAmount?: boolean | undefined /** * Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account */ - includeInterestInFloorAmount?: boolean + includeInterestInFloorAmount?: boolean | undefined /** * Percentage of principal amount used for the repayments principal due. */ - percentage?: number + percentage?: number | undefined /** * The maximum principal due amount a repayment made with this settings can have */ - principalCeilingValue?: number + principalCeilingValue?: number | undefined /** * The minimum principal due amount a repayment made with this settings can have */ - principalFloorValue?: number + principalFloorValue?: number | undefined /** * The method of principal payment for revolving credit. */ @@ -2612,10 +2833,11 @@ export interface PrincipalPaymentAccountSettings { | 'TOTAL_BALANCE_PERCENTAGE' | 'TOTAL_BALANCE_FLAT' | 'TOTAL_PRINCIPAL_PERCENTAGE' + | undefined /** * The minimum total due amount a repayment made with this settings can have */ - totalDueAmountFloor?: number + totalDueAmountFloor?: number | undefined /** * The method of total due payment for revolving credit */ @@ -2626,6 +2848,7 @@ export interface PrincipalPaymentAccountSettings { | 'TOTAL_BALANCE_PERCENTAGE' | 'TOTAL_BALANCE_FLAT' | 'TOTAL_PRINCIPAL_PERCENTAGE' + | undefined } /** @@ -2635,11 +2858,11 @@ export interface ReopenDepositAction { /** * The notes or description attached to this object. */ - notes?: string + notes?: string | undefined } export const ReopenDepositAction = { - validate: (await import('./schemas/reopen-deposit-action.schema.js')).validate as ValidateFunction, + validate: ReopenDepositActionValidator as ValidateFunction, get schema() { return ReopenDepositAction.validate.schema }, @@ -2647,17 +2870,18 @@ export const ReopenDepositAction = { return ReopenDepositAction.validate.errors ?? undefined }, is: (o: unknown): o is ReopenDepositAction => ReopenDepositAction.validate(o) === true, - assert: (o: unknown) => { - if (!ReopenDepositAction.validate(o)) { - throw new ValidationError(ReopenDepositAction.errors ?? []) + parse: (o: unknown): { right: ReopenDepositAction } | { left: DefinedError[] } => { + if (ReopenDepositAction.is(o)) { + return { right: o } } + return { left: (ReopenDepositAction.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -2667,7 +2891,7 @@ export interface RevolvingAccountSettings { /** * The number of previewed instalments */ - numberOfPreviewedInstalments?: number + numberOfPreviewedInstalments?: number | undefined } /** @@ -2677,16 +2901,16 @@ export interface ScheduleSettings { /** * The PMT is calculated as the loan would have [amortizationPeriod] installments. */ - amortizationPeriod?: number - billingCycle?: BillingCycleDays + amortizationPeriod?: number | undefined + billingCycle?: BillingCycleDays | undefined /** * 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) */ - defaultFirstRepaymentDueDateOffset?: number + defaultFirstRepaymentDueDateOffset?: number | undefined /** * Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH. */ - fixedDaysOfMonth?: number[] + fixedDaysOfMonth?: number[] | undefined /** * The grace period. Represents the grace period for loan repayment - in number of installments. */ @@ -2694,54 +2918,54 @@ export interface ScheduleSettings { /** * The grace period type. Representing the type of grace period which is possible for a loan account. */ - gracePeriodType?: 'NONE' | 'PAY_INTEREST_ONLY' | 'INTEREST_FORGIVENESS' + gracePeriodType?: 'NONE' | 'PAY_INTEREST_ONLY' | 'INTEREST_FORGIVENESS' | undefined /** * Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due */ - hasCustomSchedule?: boolean + hasCustomSchedule?: boolean | undefined /** * A list of periodic payments for the current loan account. */ - paymentPlan?: PeriodicPayment[] + paymentPlan?: PeriodicPayment[] | undefined /** * The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments */ - periodicPayment?: number - previewSchedule?: RevolvingAccountSettings + periodicPayment?: number | undefined + previewSchedule?: RevolvingAccountSettings | undefined /** * The principal repayment interval. Indicates the interval of repayments that the principal has to be paid. */ - principalRepaymentInterval?: number + principalRepaymentInterval?: number | undefined /** * The repayment installments. Represents how many installments are required to pay back the loan. */ - repaymentInstallments?: number + repaymentInstallments?: number | undefined /** * The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option. */ - repaymentPeriodCount?: number + repaymentPeriodCount?: number | undefined /** * The repayment period unit. Represents the frequency of loan repayment. */ - repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' + repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' | undefined /** * 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. */ - repaymentScheduleMethod?: 'NONE' | 'FIXED' | 'DYNAMIC' + repaymentScheduleMethod?: 'NONE' | 'FIXED' | 'DYNAMIC' | undefined /** * The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments. */ - scheduleDueDatesMethod?: 'INTERVAL' | 'FIXED_DAYS_OF_MONTH' + scheduleDueDatesMethod?: 'INTERVAL' | 'FIXED_DAYS_OF_MONTH' | undefined /** * 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. */ - shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' + shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' | undefined } export type SearchResponse = DepositAccount[] export const SearchResponse = { - validate: (await import('./schemas/search-response.schema.js')).validate as ValidateFunction, + validate: SearchResponseValidator as ValidateFunction, get schema() { return SearchResponse.validate.schema }, @@ -2749,6 +2973,12 @@ export const SearchResponse = { return SearchResponse.validate.errors ?? undefined }, is: (o: unknown): o is SearchResponse => SearchResponse.validate(o) === true, + parse: (o: unknown): { right: SearchResponse } | { left: DefinedError[] } => { + if (SearchResponse.is(o)) { + return { right: o } + } + return { left: (SearchResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -2758,15 +2988,15 @@ export interface StartMaturityAction { /** * The date when the maturity period starts. */ - maturityDate?: string + maturityDate?: string | undefined /** * The notes or description attached to this object. */ - notes?: string + notes?: string | undefined } export const StartMaturityAction = { - validate: (await import('./schemas/start-maturity-action.schema.js')).validate as ValidateFunction, + validate: StartMaturityActionValidator as ValidateFunction, get schema() { return StartMaturityAction.validate.schema }, @@ -2774,10 +3004,11 @@ export const StartMaturityAction = { return StartMaturityAction.validate.errors ?? undefined }, is: (o: unknown): o is StartMaturityAction => StartMaturityAction.validate(o) === true, - assert: (o: unknown) => { - if (!StartMaturityAction.validate(o)) { - throw new ValidationError(StartMaturityAction.errors ?? []) + parse: (o: unknown): { right: StartMaturityAction } | { left: DefinedError[] } => { + if (StartMaturityAction.is(o)) { + return { right: o } } + return { left: (StartMaturityAction.errors ?? []) as DefinedError[] } }, } as const @@ -2788,11 +3019,11 @@ export interface TrancheDisbursementDetails { /** * The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement */ - disbursementTransactionKey?: string + disbursementTransactionKey?: string | undefined /** * The date when this tranche is supposed to be disbursed (as Organization Time) */ - expectedDisbursementDate?: string + expectedDisbursementDate?: string | undefined } /** @@ -2802,11 +3033,11 @@ export interface UndoMaturityAction { /** * The notes or description attached to this object. */ - notes?: string + notes?: string | undefined } export const UndoMaturityAction = { - validate: (await import('./schemas/undo-maturity-action.schema.js')).validate as ValidateFunction, + validate: UndoMaturityActionValidator as ValidateFunction, get schema() { return UndoMaturityAction.validate.schema }, @@ -2814,9 +3045,10 @@ export const UndoMaturityAction = { return UndoMaturityAction.validate.errors ?? undefined }, is: (o: unknown): o is UndoMaturityAction => UndoMaturityAction.validate(o) === true, - assert: (o: unknown) => { - if (!UndoMaturityAction.validate(o)) { - throw new ValidationError(UndoMaturityAction.errors ?? []) + parse: (o: unknown): { right: UndoMaturityAction } | { left: DefinedError[] } => { + if (UndoMaturityAction.is(o)) { + return { right: o } } + return { left: (UndoMaturityAction.errors ?? []) as DefinedError[] } }, } as const diff --git a/src/deposit-accounts/schemas/account-authorization-hold.schema.js b/src/deposit-accounts/schemas/account-authorization-hold.schema.js index a998887..8d6e667 100644 --- a/src/deposit-accounts/schemas/account-authorization-hold.schema.js +++ b/src/deposit-accounts/schemas/account-authorization-hold.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AccountAuthorizationHold","type":"object","description":"The account authorization hold corresponding to a deposit account","properties":{"accountKey":{"type":"string","title":"accountKey","description":"The key of the account linked with the authorization hold."},"advice":{"type":"boolean","title":"advice","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","title":"amount","description":"The amount of money to be held as a result of the authorization hold request."},"cardAcceptor":{"title":"cardAcceptor","$ref":"#/$defs/CardAcceptoraf30"},"cardToken":{"type":"string","title":"cardToken","description":"The reference token of the card."},"creationDate":{"type":"string","title":"creationDate","description":"The organization time when the authorization hold was created","format":"date-time"},"creditDebitIndicator":{"title":"creditDebitIndicator","description":"Indicates whether the authorization hold amount is credited or debited. If not provided, the default value is DBIT.","enum":["DBIT","CRDT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"The ISO currency code in which the hold was created. The amounts are stored in the base currency, but the user could have enter it in a foreign currency."},"exchangeRate":{"type":"number","title":"exchangeRate","description":"The exchange rate for the original currency."},"externalReferenceId":{"type":"string","title":"externalReferenceId","description":"The external reference ID to be used to reference the account hold in subsequent requests."},"originalAmount":{"type":"number","title":"originalAmount","description":"The original amount of money to be held as a result of the authorization hold request."},"originalCurrency":{"type":"string","title":"originalCurrency","description":"The original currency in which the hold was created."},"source":{"title":"source","description":"Indicates the source of the authorization hold.","enum":["CARD","ACCOUNT"]},"status":{"title":"status","description":"The authorization hold status.","enum":["PENDING","REVERSED","SETTLED","EXPIRED"]},"userTransactionTime":{"type":"string","title":"userTransactionTime","description":"The formatted time at which the user made this authorization hold."}},"required":["amount","externalReferenceId"],"additionalProperties":true,"$defs":{"CardAcceptoraf30":{"type":"object","title":"CardAcceptoraf30","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","title":"city","description":"The city in which the card acceptor has the business."},"country":{"type":"string","title":"country","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","title":"mcc","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","title":"name","description":"The name of the card acceptor."},"state":{"type":"string","title":"state","description":"The state in which the card acceptor has the business."},"street":{"type":"string","title":"street","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","title":"zip","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"CardAcceptoraf30","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","title":"city","description":"The city in which the card acceptor has the business."},"country":{"type":"string","title":"country","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","title":"mcc","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","title":"name","description":"The name of the card acceptor."},"state":{"type":"string","title":"state","description":"The state in which the card acceptor has the business."},"street":{"type":"string","title":"street","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","title":"zip","description":"The ZIP code of the location in which the card acceptor has the business."}},"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.amount === undefined) && (missing0 = "amount")) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountKey !== undefined){const _errs2 = errors;if(typeof data.accountKey !== "string"){validate10.errors = [{instancePath:instancePath+"/accountKey",schemaPath:"#/properties/accountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.advice !== undefined){const _errs4 = errors;if(typeof data.advice !== "boolean"){validate10.errors = [{instancePath:instancePath+"/advice",schemaPath:"#/properties/advice/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data2 = data.amount;const _errs6 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate10.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.cardAcceptor !== undefined){let data3 = data.cardAcceptor;const _errs8 = errors;const _errs9 = errors;if(errors === _errs9){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){if(data3.city !== undefined){const _errs12 = errors;if(typeof data3.city !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptoraf30/properties/city/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data3.country !== undefined){const _errs14 = errors;if(typeof data3.country !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptoraf30/properties/country/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data3.mcc !== undefined){let data6 = data3.mcc;const _errs16 = errors;if(!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptoraf30/properties/mcc/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}if(valid2){if(data3.name !== undefined){const _errs18 = errors;if(typeof data3.name !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptoraf30/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs18 === errors;}else {var valid2 = true;}if(valid2){if(data3.state !== undefined){const _errs20 = errors;if(typeof data3.state !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptoraf30/properties/state/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}if(valid2){if(data3.street !== undefined){const _errs22 = errors;if(typeof data3.street !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptoraf30/properties/street/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs22 === errors;}else {var valid2 = true;}if(valid2){if(data3.zip !== undefined){const _errs24 = errors;if(typeof data3.zip !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptoraf30/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs24 === errors;}else {var valid2 = true;}}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptoraf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.cardToken !== undefined){const _errs26 = errors;if(typeof data.cardToken !== "string"){validate10.errors = [{instancePath:instancePath+"/cardToken",schemaPath:"#/properties/cardToken/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs28 = errors;if(errors === _errs28){if(errors === _errs28){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 = _errs28 === errors;}else {var valid0 = true;}if(valid0){if(data.creditDebitIndicator !== undefined){let data13 = data.creditDebitIndicator;const _errs30 = errors;if(!((data13 === "DBIT") || (data13 === "CRDT"))){validate10.errors = [{instancePath:instancePath+"/creditDebitIndicator",schemaPath:"#/properties/creditDebitIndicator/enum",keyword:"enum",params:{allowedValues: schema11.properties.creditDebitIndicator.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.currencyCode !== undefined){const _errs31 = 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 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.exchangeRate !== undefined){let data15 = data.exchangeRate;const _errs33 = errors;if(!((typeof data15 == "number") && (isFinite(data15)))){validate10.errors = [{instancePath:instancePath+"/exchangeRate",schemaPath:"#/properties/exchangeRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs33 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs35 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs35 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data17 = data.originalAmount;const _errs37 = errors;if(!((typeof data17 == "number") && (isFinite(data17)))){validate10.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs37 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){const _errs39 = errors;if(typeof data.originalCurrency !== "string"){validate10.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/properties/originalCurrency/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs39 === errors;}else {var valid0 = true;}if(valid0){if(data.source !== undefined){let data19 = data.source;const _errs41 = errors;if(!((data19 === "CARD") || (data19 === "ACCOUNT"))){validate10.errors = [{instancePath:instancePath+"/source",schemaPath:"#/properties/source/enum",keyword:"enum",params:{allowedValues: schema11.properties.source.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.status !== undefined){let data20 = data.status;const _errs42 = errors;if(!((((data20 === "PENDING") || (data20 === "REVERSED")) || (data20 === "SETTLED")) || (data20 === "EXPIRED"))){validate10.errors = [{instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema11.properties.status.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs42 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs43 = errors;if(typeof data.userTransactionTime !== "string"){validate10.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs43 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"AccountAuthorizationHold","type":"object","description":"The account authorization hold corresponding to a deposit account","properties":{"accountKey":{"type":"string","description":"The key of the account linked with the authorization hold."},"advice":{"type":"boolean","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","description":"The amount of money to be held as a result of the authorization hold request."},"cardAcceptor":{"$ref":"#/$defs/CardAcceptor"},"cardToken":{"type":"string","description":"The reference token of the card."},"creationDate":{"type":"string","description":"The organization time when the authorization hold was created","format":"date-time"},"creditDebitIndicator":{"description":"Indicates whether the authorization hold amount is credited or debited. If not provided, the default value is DBIT.","enum":["DBIT","CRDT"]},"currencyCode":{"type":"string","description":"The ISO currency code in which the hold was created. The amounts are stored in the base currency, but the user could have enter it in a foreign currency."},"exchangeRate":{"type":"number","description":"The exchange rate for the original currency."},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the account hold in subsequent requests."},"originalAmount":{"type":"number","description":"The original amount of money to be held as a result of the authorization hold request."},"originalCurrency":{"type":"string","description":"The original currency in which the hold was created."},"source":{"description":"Indicates the source of the authorization hold.","enum":["CARD","ACCOUNT"]},"status":{"description":"The authorization hold status.","enum":["PENDING","REVERSED","SETTLED","EXPIRED"]},"userTransactionTime":{"type":"string","description":"The formatted time at which the user made this authorization hold."}},"required":["amount","externalReferenceId"],"additionalProperties":true,"$defs":{"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}}};const schema12 = {"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};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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.amount === undefined) && (missing0 = "amount")) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountKey !== undefined){const _errs2 = errors;if(typeof data.accountKey !== "string"){validate10.errors = [{instancePath:instancePath+"/accountKey",schemaPath:"#/properties/accountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.advice !== undefined){const _errs4 = errors;if(typeof data.advice !== "boolean"){validate10.errors = [{instancePath:instancePath+"/advice",schemaPath:"#/properties/advice/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data2 = data.amount;const _errs6 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate10.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.cardAcceptor !== undefined){let data3 = data.cardAcceptor;const _errs8 = errors;const _errs9 = errors;if(errors === _errs9){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){if(data3.city !== undefined){const _errs12 = errors;if(typeof data3.city !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/city",schemaPath:"#/$defs/CardAcceptor/properties/city/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data3.country !== undefined){const _errs14 = errors;if(typeof data3.country !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/country",schemaPath:"#/$defs/CardAcceptor/properties/country/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data3.mcc !== undefined){let data6 = data3.mcc;const _errs16 = errors;if(!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/mcc",schemaPath:"#/$defs/CardAcceptor/properties/mcc/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}if(valid2){if(data3.name !== undefined){const _errs18 = errors;if(typeof data3.name !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/name",schemaPath:"#/$defs/CardAcceptor/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs18 === errors;}else {var valid2 = true;}if(valid2){if(data3.state !== undefined){const _errs20 = errors;if(typeof data3.state !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/state",schemaPath:"#/$defs/CardAcceptor/properties/state/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs20 === errors;}else {var valid2 = true;}if(valid2){if(data3.street !== undefined){const _errs22 = errors;if(typeof data3.street !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/street",schemaPath:"#/$defs/CardAcceptor/properties/street/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs22 === errors;}else {var valid2 = true;}if(valid2){if(data3.zip !== undefined){const _errs24 = errors;if(typeof data3.zip !== "string"){validate10.errors = [{instancePath:instancePath+"/cardAcceptor/zip",schemaPath:"#/$defs/CardAcceptor/properties/zip/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs24 === errors;}else {var valid2 = true;}}}}}}}}else {validate10.errors = [{instancePath:instancePath+"/cardAcceptor",schemaPath:"#/$defs/CardAcceptor/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.cardToken !== undefined){const _errs26 = errors;if(typeof data.cardToken !== "string"){validate10.errors = [{instancePath:instancePath+"/cardToken",schemaPath:"#/properties/cardToken/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){let data12 = data.creationDate;const _errs28 = errors;if(errors === _errs28){if(errors === _errs28){if(typeof data12 === "string"){if(!(formats0.validate(data12))){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs28 === errors;}else {var valid0 = true;}if(valid0){if(data.creditDebitIndicator !== undefined){let data13 = data.creditDebitIndicator;const _errs30 = errors;if(!((data13 === "DBIT") || (data13 === "CRDT"))){validate10.errors = [{instancePath:instancePath+"/creditDebitIndicator",schemaPath:"#/properties/creditDebitIndicator/enum",keyword:"enum",params:{allowedValues: schema11.properties.creditDebitIndicator.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.currencyCode !== undefined){const _errs31 = 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 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.exchangeRate !== undefined){let data15 = data.exchangeRate;const _errs33 = errors;if(!((typeof data15 == "number") && (isFinite(data15)))){validate10.errors = [{instancePath:instancePath+"/exchangeRate",schemaPath:"#/properties/exchangeRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs33 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs35 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs35 === errors;}else {var valid0 = true;}if(valid0){if(data.originalAmount !== undefined){let data17 = data.originalAmount;const _errs37 = errors;if(!((typeof data17 == "number") && (isFinite(data17)))){validate10.errors = [{instancePath:instancePath+"/originalAmount",schemaPath:"#/properties/originalAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs37 === errors;}else {var valid0 = true;}if(valid0){if(data.originalCurrency !== undefined){const _errs39 = errors;if(typeof data.originalCurrency !== "string"){validate10.errors = [{instancePath:instancePath+"/originalCurrency",schemaPath:"#/properties/originalCurrency/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs39 === errors;}else {var valid0 = true;}if(valid0){if(data.source !== undefined){let data19 = data.source;const _errs41 = errors;if(!((data19 === "CARD") || (data19 === "ACCOUNT"))){validate10.errors = [{instancePath:instancePath+"/source",schemaPath:"#/properties/source/enum",keyword:"enum",params:{allowedValues: schema11.properties.source.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs41 === errors;}else {var valid0 = true;}if(valid0){if(data.status !== undefined){let data20 = data.status;const _errs42 = errors;if(!((((data20 === "PENDING") || (data20 === "REVERSED")) || (data20 === "SETTLED")) || (data20 === "EXPIRED"))){validate10.errors = [{instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema11.properties.status.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs42 === errors;}else {var valid0 = true;}if(valid0){if(data.userTransactionTime !== undefined){const _errs43 = errors;if(typeof data.userTransactionTime !== "string"){validate10.errors = [{instancePath:instancePath+"/userTransactionTime",schemaPath:"#/properties/userTransactionTime/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs43 === 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/apply-interest-input.schema.js b/src/deposit-accounts/schemas/apply-interest-input.schema.js index f0a86c4..29f88b4 100644 --- a/src/deposit-accounts/schemas/apply-interest-input.schema.js +++ b/src/deposit-accounts/schemas/apply-interest-input.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";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","title":"interestApplicationDate","description":"The date up to which interest is to be posted","format":"date-time"},"isPaymentHolidaysInterest":{"type":"boolean","title":"isPaymentHolidaysInterest","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","title":"notes","description":"Additional information for this action"},"paymentHolidaysInterestAmount":{"type":"number","title":"paymentHolidaysInterestAmount","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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"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};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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){let data0 = data.interestApplicationDate;const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(typeof data0 === "string"){if(!(formats0.validate(data0))){validate10.errors = [{instancePath:instancePath+"/interestApplicationDate",schemaPath:"#/properties/interestApplicationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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 diff --git a/src/deposit-accounts/schemas/block-fund.schema.js b/src/deposit-accounts/schemas/block-fund.schema.js index ab50afe..faef1e3 100644 --- a/src/deposit-accounts/schemas/block-fund.schema.js +++ b/src/deposit-accounts/schemas/block-fund.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"BlockFund","type":"object","description":"Represents the block fund amount that can be later seized on the account","properties":{"accountKey":{"type":"string","title":"accountKey","description":"The key of the account which block fund belongs to"},"amount":{"type":"number","title":"amount","description":"The amount to be blocked"},"creationDate":{"type":"string","title":"creationDate","description":"The date at which the block fund was created","format":"date-time"},"externalReferenceId":{"type":"string","title":"externalReferenceId","description":"The external reference ID to be used to reference the block fund in subsequent requests"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The date at which the block fund was created","format":"date-time"},"notes":{"type":"string","title":"notes","description":"Notes about this block fund"},"seizedAmount":{"type":"number","title":"seizedAmount","description":"The amount that has been seized"},"state":{"title":"state","description":"The state of the block fund","enum":["PENDING","SEIZED","REMOVED","PARTIALLY_SEIZED"]}},"required":["amount","externalReferenceId"],"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.amount === undefined) && (missing0 = "amount")) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountKey !== undefined){const _errs2 = errors;if(typeof data.accountKey !== "string"){validate10.errors = [{instancePath:instancePath+"/accountKey",schemaPath:"#/properties/accountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];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)))){validate10.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.creationDate !== undefined){const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){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 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs8 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){const _errs10 = errors;if(errors === _errs10){if(errors === _errs10){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 = _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.seizedAmount !== undefined){let data6 = data.seizedAmount;const _errs14 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate10.errors = [{instancePath:instancePath+"/seizedAmount",schemaPath:"#/properties/seizedAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.state !== undefined){let data7 = data.state;const _errs16 = errors;if(!((((data7 === "PENDING") || (data7 === "SEIZED")) || (data7 === "REMOVED")) || (data7 === "PARTIALLY_SEIZED"))){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 = _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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"BlockFund","type":"object","description":"Represents the block fund amount that can be later seized on the account","properties":{"accountKey":{"type":"string","description":"The key of the account which block fund belongs to"},"amount":{"type":"number","description":"The amount to be blocked"},"creationDate":{"type":"string","description":"The date at which the block fund was created","format":"date-time"},"externalReferenceId":{"type":"string","description":"The external reference ID to be used to reference the block fund in subsequent requests"},"lastModifiedDate":{"type":"string","description":"The date at which the block fund was created","format":"date-time"},"notes":{"type":"string","description":"Notes about this block fund"},"seizedAmount":{"type":"number","description":"The amount that has been seized"},"state":{"description":"The state of the block fund","enum":["PENDING","SEIZED","REMOVED","PARTIALLY_SEIZED"]}},"required":["amount","externalReferenceId"],"additionalProperties":true};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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.amount === undefined) && (missing0 = "amount")) || ((data.externalReferenceId === undefined) && (missing0 = "externalReferenceId"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountKey !== undefined){const _errs2 = errors;if(typeof data.accountKey !== "string"){validate10.errors = [{instancePath:instancePath+"/accountKey",schemaPath:"#/properties/accountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];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)))){validate10.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.creationDate !== undefined){let data2 = data.creationDate;const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(typeof data2 === "string"){if(!(formats0.validate(data2))){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.externalReferenceId !== undefined){const _errs8 = errors;if(typeof data.externalReferenceId !== "string"){validate10.errors = [{instancePath:instancePath+"/externalReferenceId",schemaPath:"#/properties/externalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){let data4 = data.lastModifiedDate;const _errs10 = errors;if(errors === _errs10){if(errors === _errs10){if(typeof data4 === "string"){if(!(formats0.validate(data4))){validate10.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];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.seizedAmount !== undefined){let data6 = data.seizedAmount;const _errs14 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate10.errors = [{instancePath:instancePath+"/seizedAmount",schemaPath:"#/properties/seizedAmount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.state !== undefined){let data7 = data.state;const _errs16 = errors;if(!((((data7 === "PENDING") || (data7 === "SEIZED")) || (data7 === "REMOVED")) || (data7 === "PARTIALLY_SEIZED"))){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 = _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 diff --git a/src/deposit-accounts/schemas/bulk-interest-account-settings-availability-input.schema.js b/src/deposit-accounts/schemas/bulk-interest-account-settings-availability-input.schema.js index 1900c3f..257b109 100644 --- a/src/deposit-accounts/schemas/bulk-interest-account-settings-availability-input.schema.js +++ b/src/deposit-accounts/schemas/bulk-interest-account-settings-availability-input.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"BulkInterestAccountSettingsAvailabilityInput","type":"object","description":"Represents the bulk payload for storing interest availabilities to a group of accounts","properties":{"accountFilter":{"title":"accountFilter","$ref":"#/$defs/BulkInterestAccountSettingsAvailabilityFilteraf30"},"interestAvailability":{"title":"interestAvailability","$ref":"#/$defs/InterestAccountSettingsAvailabilityaf30"}},"required":["accountFilter","interestAvailability"],"additionalProperties":true,"$defs":{"BulkInterestAccountSettingsAvailabilityFilteraf30":{"type":"object","title":"BulkInterestAccountSettingsAvailabilityFilteraf30","description":"Represents the filter to be used for selecting the accounts to which new interest availability settings will be pushed. One of the 2 fields: productId or ids should be supplied ","properties":{"ids":{"type":"array","title":"ids","description":"Ids of accounts that should be processed","items":{"type":"string"}},"productId":{"type":"string","title":"productId","description":"Product id to be used for selecting all accounts that should be processed"}},"additionalProperties":true},"InterestAccountSettingsAvailabilityaf30":{"type":"object","title":"InterestAccountSettingsAvailabilityaf30","description":"Interest Availability of a Deposit Account","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the Interest Availability, auto generated, unique."},"interestRateSettings":{"title":"interestRateSettings","$ref":"#/$defs/DepositAccountInterestAvailabilitySettingsaf30"},"startDate":{"type":"string","title":"startDate","description":"Start date of the Interest Availability.","format":"date"},"type":{"title":"type","description":"Type of the interest.","enum":["INTEREST","OVERDRAFT","TECHNICAL_OVERDRAFT"]}},"required":["interestRateSettings","startDate","type"],"additionalProperties":true},"DepositAccountInterestAvailabilitySettingsaf30":{"type":"object","title":"DepositAccountInterestAvailabilitySettingsaf30","description":"Interest Rate Settings for Deposit Account Interest Availability","properties":{"interestRate":{"type":"number","title":"interestRate","description":"The interest rate for the deposit account"},"interestRateTiers":{"type":"array","title":"interestRateTiers","description":"The list of interest rate tiers. An interest rate tier holds the values to define how the interest is computed","items":{"$ref":"#/$defs/DepositAccountInterestRateTieraf30"}},"interestSpread":{"type":"number","title":"interestSpread","description":"The rate based on which the interest is accrued and applied for accounts with InterestRateSource#INDEX_INTEREST_RATE"}},"additionalProperties":true},"DepositAccountInterestRateTieraf30":{"type":"object","title":"DepositAccountInterestRateTieraf30","description":"Represents information about how interest rate is calculated.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","title":"endingBalance","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"endingDay":{"type":"integer","title":"endingDay","description":"The end date for the account period. Used to determine if this interest rate tier is used or not."},"interestRate":{"type":"number","title":"interestRate","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true}}};const schema12 = {"type":"object","title":"BulkInterestAccountSettingsAvailabilityFilteraf30","description":"Represents the filter to be used for selecting the accounts to which new interest availability settings will be pushed. One of the 2 fields: productId or ids should be supplied ","properties":{"ids":{"type":"array","title":"ids","description":"Ids of accounts that should be processed","items":{"type":"string"}},"productId":{"type":"string","title":"productId","description":"Product id to be used for selecting all accounts that should be processed"}},"additionalProperties":true};const schema13 = {"type":"object","title":"InterestAccountSettingsAvailabilityaf30","description":"Interest Availability of a Deposit Account","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the Interest Availability, auto generated, unique."},"interestRateSettings":{"title":"interestRateSettings","$ref":"#/$defs/DepositAccountInterestAvailabilitySettingsaf30"},"startDate":{"type":"string","title":"startDate","description":"Start date of the Interest Availability.","format":"date"},"type":{"title":"type","description":"Type of the interest.","enum":["INTEREST","OVERDRAFT","TECHNICAL_OVERDRAFT"]}},"required":["interestRateSettings","startDate","type"],"additionalProperties":true};const schema14 = {"type":"object","title":"DepositAccountInterestAvailabilitySettingsaf30","description":"Interest Rate Settings for Deposit Account Interest Availability","properties":{"interestRate":{"type":"number","title":"interestRate","description":"The interest rate for the deposit account"},"interestRateTiers":{"type":"array","title":"interestRateTiers","description":"The list of interest rate tiers. An interest rate tier holds the values to define how the interest is computed","items":{"$ref":"#/$defs/DepositAccountInterestRateTieraf30"}},"interestSpread":{"type":"number","title":"interestSpread","description":"The rate based on which the interest is accrued and applied for accounts with InterestRateSource#INDEX_INTEREST_RATE"}},"additionalProperties":true};const schema15 = {"type":"object","title":"DepositAccountInterestRateTieraf30","description":"Represents information about how interest rate is calculated.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","title":"endingBalance","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"endingDay":{"type":"integer","title":"endingDay","description":"The end date for the account period. Used to determine if this interest rate tier is used or not."},"interestRate":{"type":"number","title":"interestRate","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 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.interestRate !== undefined){let data0 = data.interestRate;const _errs2 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){validate12.errors = [{instancePath:instancePath+"/interestRate",schemaPath:"#/properties/interestRate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.interestRateTiers !== undefined){let data1 = data.interestRateTiers;const _errs4 = errors;if(errors === _errs4){if(Array.isArray(data1)){var valid1 = true;const len0 = data1.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},"InterestRateChangePMTAdjustmentThresholdaf30":{"type":"object","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"additionalProperties":true},"PenaltySettingsaf30":{"type":"object","title":"PenaltySettingsaf30","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"title":"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","title":"penaltyRate","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFeeaf30":{"type":"object","title":"PlannedInstallmentFeeaf30","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","title":"applyOnDate","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","title":"encodedKey","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","title":"installmentKey","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","title":"installmentNumber","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","title":"predefinedFeeKey","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettingsaf30":{"type":"object","title":"PrepaymentSettingsaf30","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowanceAmount"},"ercFreeAllowancePercentage":{"type":"number","title":"ercFreeAllowancePercentage","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"title":"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":{"title":"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},"PrincipalPaymentAccountSettingsaf30":{"type":"object","title":"PrincipalPaymentAccountSettingsaf30","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","title":"amount","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","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","title":"percentage","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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},"LoanAccountRedrawSettingsaf30":{"type":"object","title":"LoanAccountRedrawSettingsaf30","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","title":"restrictNextDueWithdrawal","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettingsaf30":{"type":"object","title":"ScheduleSettingsaf30","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","title":"amortizationPeriod","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"title":"billingCycle","$ref":"#/$defs/BillingCycleDaysaf30"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","title":"defaultFirstRepaymentDueDateOffset","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","title":"fixedDaysOfMonth","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","title":"gracePeriod","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"title":"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","title":"hasCustomSchedule","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","title":"paymentPlan","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPaymentaf30"}},"periodicPayment":{"type":"number","title":"periodicPayment","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"title":"previewSchedule","$ref":"#/$defs/RevolvingAccountSettingsaf30"},"principalRepaymentInterval":{"type":"integer","title":"principalRepaymentInterval","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","title":"repaymentInstallments","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","title":"repaymentPeriodCount","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"title":"repaymentPeriodUnit","description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"title":"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":{"title":"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":{"title":"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},"BillingCycleDaysaf30":{"type":"object","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPaymentaf30":{"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettingsaf30":{"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTrancheaf30":{"type":"object","title":"LoanTrancheaf30","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","title":"amount","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/TrancheDisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","title":"fees","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"trancheNumber":{"type":"integer","title":"trancheNumber","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetailsaf30":{"type":"object","title":"TrancheDisbursementDetailsaf30","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","title":"disbursementTransactionKey","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","title":"expectedDisbursementDate","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"LoanAccountaf30","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":{"title":"accountArrearsSettings","$ref":"#/$defs/AccountArrearsSettingsaf30"},"accountHolderKey":{"type":"string","title":"accountHolderKey","description":"The encoded key of the account holder."},"accountHolderType":{"title":"accountHolderType","description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"title":"accountState","description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"title":"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","title":"accruedInterest","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","title":"accruedPenalty","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","title":"activationTransactionKey","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","title":"allowOffset","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","title":"approvedDate","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","title":"arrearsTolerancePeriod","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","title":"assets","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Assetaf30"}},"assignedBranchKey":{"type":"string","title":"assignedBranchKey","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","title":"assignedCentreKey","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","title":"assignedUserKey","description":"The key of the user this loan account is assigned to."},"balances":{"title":"balances","$ref":"#/$defs/Balancesaf30"},"closedDate":{"type":"string","title":"closedDate","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","title":"creationDate","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","title":"creditArrangementKey","description":"The key to the line of credit where this account is registered to."},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"daysInArrears":{"type":"integer","title":"daysInArrears","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","title":"daysLate","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/DisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","title":"fundingSources","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFundaf30"}},"futurePaymentsAcceptance":{"title":"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","title":"guarantors","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantoraf30"}},"id":{"type":"string","title":"id","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","title":"interestAccruedInBillingCycle","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","title":"interestCommission","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","title":"interestFromArrearsAccrued","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"title":"interestSettings","$ref":"#/$defs/InterestSettingsaf30"},"lastAccountAppraisalDate":{"type":"string","title":"lastAccountAppraisalDate","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","title":"lastInterestAppliedDate","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","title":"lastInterestReviewDate","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","title":"lastLockedDate","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","title":"lastModifiedDate","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","title":"lastSetToArrearsDate","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","title":"lastTaxRateReviewDate","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":{"title":"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"]},"loanAmount":{"type":"number","title":"loanAmount","description":"The loan amount."},"loanName":{"type":"string","title":"loanName","description":"The name of the loan account."},"lockedAccountTotalDueType":{"title":"lockedAccountTotalDueType","description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","title":"lockedOperations","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","title":"migrationEventKey","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","title":"modifyInterestForFirstInstallment","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","title":"notes","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","title":"originalAccountKey","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","title":"paymentHolidaysAccruedInterest","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"title":"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":{"title":"penaltySettings","$ref":"#/$defs/PenaltySettingsaf30"},"plannedInstallmentFees":{"type":"array","title":"plannedInstallmentFees","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFeeaf30"}},"prepaymentSettings":{"title":"prepaymentSettings","$ref":"#/$defs/PrepaymentSettingsaf30"},"principalPaymentSettings":{"title":"principalPaymentSettings","$ref":"#/$defs/PrincipalPaymentAccountSettingsaf30"},"productTypeKey":{"type":"string","title":"productTypeKey","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"title":"redrawSettings","$ref":"#/$defs/LoanAccountRedrawSettingsaf30"},"rescheduledAccountKey":{"type":"string","title":"rescheduledAccountKey","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"title":"scheduleSettings","$ref":"#/$defs/ScheduleSettingsaf30"},"settlementAccountKey":{"type":"string","title":"settlementAccountKey","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","title":"taxRate","description":"The tax rate."},"terminationDate":{"type":"string","title":"terminationDate","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","title":"tranches","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTrancheaf30"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","title":"AccountArrearsSettingsaf30","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"title":"dateCalculationMethod","description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","title":"monthlyToleranceDay","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"title":"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":{"title":"toleranceCalculationMethod","description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","title":"toleranceFloorAmount","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","title":"tolerancePercentageOfOutstandingPrincipal","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","title":"tolerancePeriod","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","title":"Balancesaf30","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","title":"feesBalance","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","title":"feesDue","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","title":"feesPaid","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","title":"holdBalance","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","title":"interestBalance","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","title":"interestDue","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","title":"interestFromArrearsBalance","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","title":"interestFromArrearsDue","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","title":"interestFromArrearsPaid","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","title":"interestPaid","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","title":"penaltyBalance","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","title":"penaltyDue","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","title":"penaltyPaid","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","title":"principalBalance","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","title":"principalDue","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","title":"principalPaid","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","title":"redrawBalance","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","title":"InvestorFundaf30","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","title":"id","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","title":"interestCommission","description":"The constraint minimum value"},"sharePercentage":{"type":"number","title":"sharePercentage","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","title":"Guarantoraf30","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","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","title":"PenaltySettingsaf30","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"title":"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","title":"penaltyRate","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","title":"PlannedInstallmentFeeaf30","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","title":"applyOnDate","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","title":"encodedKey","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","title":"installmentKey","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","title":"installmentNumber","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","title":"predefinedFeeKey","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","title":"PrepaymentSettingsaf30","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowanceAmount"},"ercFreeAllowancePercentage":{"type":"number","title":"ercFreeAllowancePercentage","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"title":"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":{"title":"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","title":"PrincipalPaymentAccountSettingsaf30","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","title":"amount","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","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","title":"percentage","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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","title":"LoanAccountRedrawSettingsaf30","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","title":"restrictNextDueWithdrawal","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;const schema14 = {"type":"object","title":"Assetaf30","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","title":"originalAmount","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"title":"originalCurrency","$ref":"#/$defs/Currencyaf30"}},"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/Currencyaf30/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/Currencyaf30/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/Currencyaf30/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","title":"DisbursementDetailsaf30","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","title":"disbursementDate","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","title":"expectedDisbursementDate","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","title":"fees","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"firstRepaymentDate":{"type":"string","title":"firstRepaymentDate","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"title":"transactionDetails","$ref":"#/$defs/LoanTransactionDetailsaf30"}},"additionalProperties":true};const schema19 = {"type":"object","title":"CustomPredefinedFeeaf30","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","title":"amount","description":"The amount of the custom fee."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","title":"percentage","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","title":"predefinedFeeEncodedKey","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","title":"LoanTransactionDetailsaf30","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","title":"internalTransfer","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","title":"targetDepositAccountKey","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","title":"transactionChannelId","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","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","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"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","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","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/BillingCycleDaysaf30/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/BillingCycleDaysaf30/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDaysaf30/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 = require("ajv/dist/runtime/equal").default;const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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){let data0 = data.disbursementDate;const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(typeof data0 === "string"){if(!(formats0.validate(data0))){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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){let data2 = data.expectedDisbursementDate;const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(typeof data2 === "string"){if(!(formats0.validate(data2))){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/depositproducts.yaml`, { + this.buildClient(auth).get('configuration/depositproducts.yaml', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update all deposit products configuration */ - public async update({ + public update({ headers, auth = [['apiKey'], ['basic']], - }: { headers?: { ['X-Mambu-Async']?: string; ['X-Mambu-Callback']?: string }; auth?: string[][] | string[] } = {}) { + }: { headers?: { 'X-Mambu-Async'?: string; 'X-Mambu-Callback'?: string }; auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | SuccessResponse<'202', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/depositproducts.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml', ...headers }, + this.buildClient(auth).put('configuration/depositproducts.yaml', { + headers: headers ?? {}, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 202: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 202: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -142,24 +172,52 @@ export class MambuDepositProductsConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/deposit-products/index.ts b/src/deposit-products/index.ts index 6c45bfa..e628039 100644 --- a/src/deposit-products/index.ts +++ b/src/deposit-products/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuDepositProducts } from './rest.client.js' export * as depositProducts from './rest.type.js' diff --git a/src/deposit-products/rest.client.ts b/src/deposit-products/rest.client.ts index a58c911..4319f0a 100644 --- a/src/deposit-products/rest.client.ts +++ b/src/deposit-products/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { DepositProduct, DepositProductAction, @@ -53,7 +56,7 @@ export class MambuDepositProducts { /** * Perform a batch update action on the specified deposit product */ - public async batchUpdate({ + public batchUpdate({ body, path, headers, @@ -61,10 +64,28 @@ export class MambuDepositProducts { }: { body: DepositProductAction path: { depositProductId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(DepositProductAction, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'202', DepositProductActionResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DepositProductAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`depositproducts/${path.depositProductId}:batchUpdate`, { @@ -73,84 +94,119 @@ export class MambuDepositProducts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 202: DepositProductActionResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create deposit product */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: DepositProduct - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(DepositProduct, body) + }: { body: DepositProduct; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', DepositProduct> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DepositProduct, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`depositproducts`, { + this.buildClient(auth).post('depositproducts', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: DepositProduct, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete deposit product */ - public async delete({ + public delete({ path, auth = [['apiKey'], ['basic']], - }: { - path: { depositProductId: string } - auth?: string[][] | string[] - }) { + }: { path: { depositProductId: string }; auth?: string[][] | string[] }): Promise< + | 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, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`depositproducts/${path.depositProductId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get deposit products */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string; branchId?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`depositproducts`, { + this.buildClient(auth).get('depositproducts', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -160,22 +216,31 @@ export class MambuDepositProducts { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get deposit product */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { depositProductId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { depositProductId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', DepositProduct> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`depositproducts/${path.depositProductId}`, { searchParams: query ?? {}, @@ -188,54 +253,81 @@ export class MambuDepositProducts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update deposit product */ - public async patch({ + public patch({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: PatchRequest - path: { depositProductId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }: { body: PatchRequest; path: { depositProductId: string }; auth?: string[][] | string[] }): Promise< + | 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, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`depositproducts/${path.depositProductId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update deposit product */ - public async update({ + public update({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: DepositProduct - path: { depositProductId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(DepositProduct, body) + }: { body: DepositProduct; path: { depositProductId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', DepositProduct> + | 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, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DepositProduct, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`depositproducts/${path.depositProductId}`, { @@ -250,45 +342,66 @@ export class MambuDepositProducts { 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -315,24 +428,52 @@ export class MambuDepositProducts { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/deposit-products/rest.type.ts b/src/deposit-products/rest.type.ts index 8328a9f..2d47bc9 100644 --- a/src/deposit-products/rest.type.ts +++ b/src/deposit-products/rest.type.ts @@ -3,8 +3,15 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as DepositProductActionResponseValidator } from './schemas/deposit-product-action-response.schema.js' +import { validate as DepositProductActionValidator } from './schemas/deposit-product-action.schema.js' +import { validate as DepositProductValidator } from './schemas/deposit-product.schema.js' +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' /** * Decimal constraints, like min/max/default. @@ -13,15 +20,15 @@ export interface AmountDecimalInterval { /** * The default value, will be used in case no other value was filled in by the user. */ - defaultValue?: number + defaultValue?: number | undefined /** * The maximum value. */ - maxValue?: number + maxValue?: number | undefined /** * The minimum value. */ - minValue?: number + minValue?: number | undefined } /** @@ -31,11 +38,11 @@ export interface BranchSettings { /** * Holds the encoded keys of the branches this product should be available for. */ - availableProductBranches?: string[] + availableProductBranches?: string[] | undefined /** * Indicates if this product should be available for all branches */ - forAllBranches?: boolean + forAllBranches?: boolean | undefined } /** @@ -45,7 +52,7 @@ export interface CreditArrangementSettings { /** * Shows whether accounts created after this product can/should be part of a line of credit. */ - creditArrangementRequirement?: 'OPTIONAL' | 'REQUIRED' | 'NOT_REQUIRED' + creditArrangementRequirement?: 'OPTIONAL' | 'REQUIRED' | 'NOT_REQUIRED' | undefined } /** @@ -239,15 +246,17 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } /** @@ -257,15 +266,15 @@ export interface DecimalInterval { /** * The default value, will be used in case no other value was filled in by the user. */ - defaultValue?: number + defaultValue?: number | undefined /** * The maximum value. */ - maxValue?: number + maxValue?: number | undefined /** * The minimum value. */ - minValue?: number + minValue?: number | undefined } /** @@ -275,7 +284,7 @@ export interface DepositGLAccountingRule { /** * The encoded key of the accounting rule, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * General Ledger Financial Resources used to setup the product accounting rules and determine the credit and debit accounts when logging journal entries */ @@ -317,11 +326,11 @@ export interface DepositGLAccountingRule { * The maturity settings for the product. */ export interface DepositMaturitySettings { - maturityPeriod?: IntegerInterval + maturityPeriod?: IntegerInterval | undefined /** * maturity period measurement unit */ - maturityPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + maturityPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined } /** @@ -343,7 +352,7 @@ export interface DepositNewAccountSettings { */ export interface DepositProduct { accountingSettings: DepositProductAccountingSettings - availabilitySettings?: DepositProductAvailabilitySettings + availabilitySettings?: DepositProductAvailabilitySettings | undefined /** * Indicates the category that the product belongs to */ @@ -354,28 +363,29 @@ export interface DepositProduct { | 'BUSINESS_BANKING_ACCOUNTS' | 'STORED_VALUE_ACCOUNTS' | 'UNCATEGORIZED' + | undefined /** * The date this product was created */ - creationDate?: string - creditArrangementSettings?: CreditArrangementSettings - currencySettings?: DepositProductCurrencySettings + creationDate?: string | undefined + creditArrangementSettings?: CreditArrangementSettings | undefined + currencySettings?: DepositProductCurrencySettings | undefined /** * The encoded key of the deposit product, auto generated, unique */ - encodedKey?: string - feesSettings?: DepositProductFeeSettings + encodedKey?: string | undefined + feesSettings?: DepositProductFeeSettings | undefined /** * The id of the product, can be generated and customized, unique */ id: string - interestSettings?: DepositProductInterestSettings - internalControls?: DepositProductInternalControls + interestSettings?: DepositProductInterestSettings | undefined + internalControls?: DepositProductInternalControls | undefined /** * The last date the product was updated */ - lastModifiedDate?: string - maturitySettings?: DepositMaturitySettings + lastModifiedDate?: string | undefined + maturitySettings?: DepositMaturitySettings | undefined /** * The name of the product */ @@ -384,19 +394,19 @@ export interface DepositProduct { /** * Some notes/a description about the product */ - notes?: string - offsetSettings?: DepositProductOffsetSettings - overdraftInterestSettings?: OverdraftInterestSettings - overdraftSettings?: DepositProductOverdraftSettings + notes?: string | undefined + offsetSettings?: DepositProductOffsetSettings | undefined + overdraftInterestSettings?: OverdraftInterestSettings | undefined + overdraftSettings?: DepositProductOverdraftSettings | undefined /** * Indicates the current state of the product */ state: 'ACTIVE' | 'INACTIVE' - taxSettings?: DepositProductTaxSettings + taxSettings?: DepositProductTaxSettings | undefined /** * Template documents of the product. */ - templates?: DocumentTemplate[] + templates?: DocumentTemplate[] | undefined /** * Indicates the type of product. */ @@ -404,7 +414,7 @@ export interface DepositProduct { } export const DepositProduct = { - validate: (await import('./schemas/deposit-product.schema.js')).validate as ValidateFunction, + validate: DepositProductValidator as ValidateFunction, get schema() { return DepositProduct.validate.schema }, @@ -412,10 +422,11 @@ export const DepositProduct = { return DepositProduct.validate.errors ?? undefined }, is: (o: unknown): o is DepositProduct => DepositProduct.validate(o) === true, - assert: (o: unknown) => { - if (!DepositProduct.validate(o)) { - throw new ValidationError(DepositProduct.errors ?? []) + parse: (o: unknown): { right: DepositProduct } | { left: DefinedError[] } => { + if (DepositProduct.is(o)) { + return { right: o } } + return { left: (DepositProduct.errors ?? []) as DefinedError[] } }, } as const @@ -430,11 +441,11 @@ export interface DepositProductAccountingSettings { /** * A list of accounting rules for the product. */ - accountingRules?: DepositGLAccountingRule[] + accountingRules?: DepositGLAccountingRule[] | undefined /** * A list of accounting rules for a product. */ - interestAccruedAccountingMethod?: 'NONE' | 'DAILY' | 'END_OF_MONTH' + interestAccruedAccountingMethod?: 'NONE' | 'DAILY' | 'END_OF_MONTH' | undefined } /** @@ -448,7 +459,7 @@ export interface DepositProductAction { } export const DepositProductAction = { - validate: (await import('./schemas/deposit-product-action.schema.js')).validate as ValidateFunction, + validate: DepositProductActionValidator as ValidateFunction, get schema() { return DepositProductAction.validate.schema }, @@ -456,10 +467,11 @@ export const DepositProductAction = { return DepositProductAction.validate.errors ?? undefined }, is: (o: unknown): o is DepositProductAction => DepositProductAction.validate(o) === true, - assert: (o: unknown) => { - if (!DepositProductAction.validate(o)) { - throw new ValidationError(DepositProductAction.errors ?? []) + parse: (o: unknown): { right: DepositProductAction } | { left: DefinedError[] } => { + if (DepositProductAction.is(o)) { + return { right: o } } + return { left: (DepositProductAction.errors ?? []) as DefinedError[] } }, } as const @@ -470,12 +482,11 @@ export interface DepositProductActionResponse { /** * The state of the deposit product action */ - state?: 'QUEUED' + state?: 'QUEUED' | undefined } export const DepositProductActionResponse = { - validate: (await import('./schemas/deposit-product-action-response.schema.js')) - .validate as ValidateFunction, + validate: DepositProductActionResponseValidator as ValidateFunction, get schema() { return DepositProductActionResponse.validate.schema }, @@ -483,6 +494,12 @@ export const DepositProductActionResponse = { return DepositProductActionResponse.validate.errors ?? undefined }, is: (o: unknown): o is DepositProductActionResponse => DepositProductActionResponse.validate(o) === true, + parse: (o: unknown): { right: DepositProductActionResponse } | { left: DefinedError[] } => { + if (DepositProductActionResponse.is(o)) { + return { right: o } + } + return { left: (DepositProductActionResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -492,8 +509,8 @@ export interface DepositProductAvailabilitySettings { /** * Holds the entities this product is available for. i.e Individuals */ - availableFor?: ('INDIVIDUALS' | 'PURE_GROUPS')[] - branchSettings?: BranchSettings + availableFor?: ('INDIVIDUALS' | 'PURE_GROUPS')[] | undefined + branchSettings?: BranchSettings | undefined } /** @@ -503,7 +520,7 @@ export interface DepositProductCurrencySettings { /** * Currencies that can be used by accounts of this product */ - currencies?: Currency[] + currencies?: Currency[] | undefined } /** @@ -513,11 +530,11 @@ export interface DepositProductFeeSettings { /** * Only if true users will be able to apply fees, for current object, of type 'Other'; these fees can have any amount. */ - allowArbitraryFees?: boolean + allowArbitraryFees?: boolean | undefined /** * List of all fees that can be applied for accounts of this loan product. */ - fees?: DepositProductPredefinedFee[] + fees?: DepositProductPredefinedFee[] | undefined } /** @@ -527,48 +544,55 @@ export interface DepositProductInterestRateSettings { /** * If the product supports this option, specify if the interest should be accrued after the account maturity date */ - accrueInterestAfterMaturity?: boolean + accrueInterestAfterMaturity?: boolean | undefined /** * Indicator whether the deposit product allows negative values for interest rate */ - allowNegativeInterestRate?: boolean + allowNegativeInterestRate?: boolean | undefined /** * The encoded key of the interest rate tier, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Index rate source key. */ - indexSourceKey?: string + indexSourceKey?: string | undefined /** * The interval used for determining how often is interest charged */ - interestChargeFrequency?: 'ANNUALIZED' | 'EVERY_MONTH' | 'EVERY_FOUR_WEEKS' | 'EVERY_WEEK' | 'EVERY_DAY' | 'EVERY_X_DAYS' + interestChargeFrequency?: + | 'ANNUALIZED' + | 'EVERY_MONTH' + | 'EVERY_FOUR_WEEKS' + | 'EVERY_WEEK' + | 'EVERY_DAY' + | 'EVERY_X_DAYS' + | undefined /** * the count of units to apply over the interval */ - interestChargeFrequencyCount?: number - interestRate?: DecimalInterval + interestChargeFrequencyCount?: number | undefined + interestRate?: DecimalInterval | undefined /** * Interest rate review frequency unit count */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * Interest rate review frequency measurement unit */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * Interest calculation method: fixed or (interest spread + active organization index interest rate) */ - interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' + interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' | undefined /** * The option for how is the interest rate determined when being accrued for an account */ - interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' + interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' | undefined /** * The list of interest rate tiers available for the current settings instance */ - interestRateTiers?: DepositProductInterestRateTier[] + interestRateTiers?: DepositProductInterestRateTier[] | undefined } /** @@ -578,15 +602,15 @@ export interface DepositProductInterestRateTier { /** * The encoded key of the interest rate tier, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The top-limit value for the account balance in order to determine if this tier is used or not */ - endingBalance?: number + endingBalance?: number | undefined /** * The top-limit value for the account period since activation in order to determine if this tier is used or not */ - endingDay?: number + endingDay?: number | undefined /** * The rate used for computing the interest for an account which has the balance less than the ending balance */ @@ -600,33 +624,39 @@ export interface DepositProductInterestSettings { /** * Whether locked accounts still collect Interest or not */ - collectInterestWhenLocked?: boolean + collectInterestWhenLocked?: boolean | undefined /** * How many days in a year should be used for interest calculations */ - daysInYear?: 'ACTUAL_365_FIXED' | 'ACTUAL_360' | 'ACTUAL_ACTUAL_ISDA' | 'E30_360' | 'E30_42_365' | 'BUS_252' + daysInYear?: 'ACTUAL_365_FIXED' | 'ACTUAL_360' | 'ACTUAL_ACTUAL_ISDA' | 'E30_360' | 'E30_42_365' | 'BUS_252' | undefined /** * The balance which is used for the Interest calculation */ - interestCalculationBalance?: 'MINIMUM' | 'AVERAGE' | 'END_OF_DAY' | 'MINIMUM_TO_END_OF_DAY' | 'FRENCH_INTEREST_ACCRUAL' + interestCalculationBalance?: + | 'MINIMUM' + | 'AVERAGE' + | 'END_OF_DAY' + | 'MINIMUM_TO_END_OF_DAY' + | 'FRENCH_INTEREST_ACCRUAL' + | undefined /** * The date when the accounts under this product, will no longer have interest gains provided */ - interestGainsProvidedEndDate?: string + interestGainsProvidedEndDate?: string | undefined /** * 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. */ - interestGainsProvidedStartDate?: string + interestGainsProvidedStartDate?: string | undefined /** * If interest should be payed into the deposit account */ - interestPaidIntoAccount?: boolean - interestPaymentSettings?: InterestPaymentSettings - interestRateSettings?: DepositProductInterestRateSettings + interestPaidIntoAccount?: boolean | undefined + interestPaymentSettings?: InterestPaymentSettings | undefined + interestRateSettings?: DepositProductInterestRateSettings | undefined /** * The maximum balance used for Interest calculation */ - maximumBalance?: number + maximumBalance?: number | undefined } /** @@ -636,16 +666,16 @@ export interface DepositProductInternalControls { /** * Specifies the number of days for an account to be fully paid in order to auto close it. */ - dormancyPeriodDays?: number + dormancyPeriodDays?: number | undefined /** * Max amount per withdrawal */ - maxWithdrawalAmount?: number - openingBalance?: AmountDecimalInterval + maxWithdrawalAmount?: number | undefined + openingBalance?: AmountDecimalInterval | undefined /** * Recommended amount for a deposit */ - recommendedDepositAmount?: number + recommendedDepositAmount?: number | undefined } /** @@ -655,7 +685,7 @@ export interface DepositProductOffsetSettings { /** * Specify if the product allow to create accounts which can be used as offset for loans */ - allowOffset?: boolean + allowOffset?: boolean | undefined } /** @@ -665,36 +695,43 @@ export interface DepositProductOverdraftInterestRateSettings { /** * Index rate source key. */ - indexSourceKey?: string + indexSourceKey?: string | undefined /** * The interval used for determining how often is interest charged */ - interestChargeFrequency?: 'ANNUALIZED' | 'EVERY_MONTH' | 'EVERY_FOUR_WEEKS' | 'EVERY_WEEK' | 'EVERY_DAY' | 'EVERY_X_DAYS' + interestChargeFrequency?: + | 'ANNUALIZED' + | 'EVERY_MONTH' + | 'EVERY_FOUR_WEEKS' + | 'EVERY_WEEK' + | 'EVERY_DAY' + | 'EVERY_X_DAYS' + | undefined /** * the count of units to apply over the interval */ - interestChargeFrequencyCount?: number - interestRate?: DecimalInterval + interestChargeFrequencyCount?: number | undefined + interestRate?: DecimalInterval | undefined /** * Interest rate review frequency unit count */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * Interest rate review frequency measurement unit */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * Interest calculation method: fixed or (interest spread + active organization index interest rate) */ - interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' + interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' | undefined /** * The option for how is the interest rate determined when being accrued for an account */ - interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' + interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' | undefined /** * The list of interest rate tiers available for the current settings instance */ - interestRateTiers?: DepositProductOverdraftInterestRateTier[] + interestRateTiers?: DepositProductOverdraftInterestRateTier[] | undefined } /** @@ -704,11 +741,11 @@ export interface DepositProductOverdraftInterestRateTier { /** * The encoded key of the interest rate tier, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The top-limit value for the account balance in order to determine if this tier is used or not */ - endingBalance?: number + endingBalance?: number | undefined /** * The rate used for computing the interest for an account which has the balance less than the ending balance */ @@ -722,15 +759,15 @@ export interface DepositProductOverdraftSettings { /** * Whether the accounts for this product may have overdraft */ - allowOverdraft?: boolean + allowOverdraft?: boolean | undefined /** * Whether the accounts for this product may have technical overdraft */ - allowTechnicalOverdraft?: boolean + allowTechnicalOverdraft?: boolean | undefined /** * How much money may be taken out for the account to go negative */ - maxOverdraftLimit?: number + maxOverdraftLimit?: number | undefined } /** @@ -740,31 +777,31 @@ export interface DepositProductPredefinedFee { /** * A list of accounting rules defined for this fee. If null, product default rules are selected. */ - accountingRules?: DepositGLAccountingRule[] + accountingRules?: DepositGLAccountingRule[] | undefined /** * The amount of the fee */ - amount?: number + amount?: number | undefined /** * External function */ - amountCalculationFunctionName?: string + amountCalculationFunctionName?: string | undefined /** * The amount from which the fee is calculated using percentageAmount */ - amountCalculationMethod?: 'FLAT' | 'MAMBU_FUNCTION' + amountCalculationMethod?: 'FLAT' | 'MAMBU_FUNCTION' | undefined /** * Shows when a fee should be applied; to be used with monthly deposit fees */ - applyDateMethod?: 'MONTHLY_FROM_ACTIVATION' | 'FIRST_OF_EVERY_MONTH' + applyDateMethod?: 'MONTHLY_FROM_ACTIVATION' | 'FIRST_OF_EVERY_MONTH' | undefined /** * Shows the creation date of the fee */ - creationDate?: string + creationDate?: string | undefined /** * The encoded key of the predefined fee, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The type of fee application when disbursement is applied */ @@ -772,15 +809,15 @@ export interface DepositProductPredefinedFee { /** * The id of the fee */ - id?: string + id?: string | undefined /** * Shows the last modified date of the fee */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The name of the fee */ - name?: string + name?: string | undefined /** * Indicates the state of the fee */ @@ -798,7 +835,7 @@ export interface DepositProductTaxSettings { /** * Whether withholding taxes are enabled for this product or not */ - withholdingTaxEnabled?: boolean + withholdingTaxEnabled?: boolean | undefined } /** @@ -808,31 +845,31 @@ export interface DocumentTemplate { /** * The creation date of the document */ - creationDate?: string + creationDate?: string | undefined /** * The document encodedKey */ - encodedKey?: string + encodedKey?: string | undefined /** * The last modified date of the document */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The name the document */ - name?: string + name?: string | undefined /** * The type of the template */ - type?: 'ACCOUNT' | 'TRANSACTION' | 'ACCOUNT_WITH_TRANSACTIONS' + type?: 'ACCOUNT' | 'TRANSACTION' | 'ACCOUNT_WITH_TRANSACTIONS' | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -840,17 +877,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = DepositProduct[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -858,6 +896,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -867,15 +911,15 @@ export interface IntegerInterval { /** * The default value, will be used in case no other value was filled in by the user. */ - defaultValue?: number + defaultValue?: number | undefined /** * The maximum value. */ - maxValue?: number + maxValue?: number | undefined /** * The minimum value. */ - minValue?: number + minValue?: number | undefined } /** @@ -885,7 +929,7 @@ export interface InterestPaymentSettings { /** * List of all dates on which the interest is payed into deposit account */ - interestPaymentDates?: MonthAndDay[] + interestPaymentDates?: MonthAndDay[] | undefined /** * Specifies when the interest should be paid to the deposit account */ @@ -900,6 +944,7 @@ export interface InterestPaymentSettings { | 'ANNUALLY' | 'BI_ANNUALLY' | 'ON_ACCOUNT_MATURITY' + | undefined } /** @@ -909,11 +954,11 @@ export interface MonthAndDay { /** * The day in the month */ - day?: number + day?: number | undefined /** * The month of the year */ - month?: number + month?: number | undefined } /** @@ -923,12 +968,18 @@ export interface OverdraftInterestSettings { /** * How many days in a year should be used for interest calculations */ - daysInYear?: 'ACTUAL_365_FIXED' | 'ACTUAL_360' | 'ACTUAL_ACTUAL_ISDA' | 'E30_360' | 'E30_42_365' | 'BUS_252' + daysInYear?: 'ACTUAL_365_FIXED' | 'ACTUAL_360' | 'ACTUAL_ACTUAL_ISDA' | 'E30_360' | 'E30_42_365' | 'BUS_252' | undefined /** * 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. */ - interestCalculationBalance?: 'MINIMUM' | 'AVERAGE' | 'END_OF_DAY' | 'MINIMUM_TO_END_OF_DAY' | 'FRENCH_INTEREST_ACCRUAL' - interestRateSettings?: DepositProductOverdraftInterestRateSettings + interestCalculationBalance?: + | 'MINIMUM' + | 'AVERAGE' + | 'END_OF_DAY' + | 'MINIMUM_TO_END_OF_DAY' + | 'FRENCH_INTEREST_ACCRUAL' + | undefined + interestRateSettings?: DepositProductOverdraftInterestRateSettings | undefined } /** @@ -938,7 +989,7 @@ export interface PatchOperation { /** * The field from where a value should be moved, when using move */ - from?: string + from?: string | undefined /** * The change to perform */ @@ -950,15 +1001,13 @@ export interface PatchOperation { /** * The value of the field, can be null */ - value?: { - [k: string]: unknown | undefined - } + value?: unknown } export type PatchRequest = PatchOperation[] export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, + validate: PatchRequestValidator as ValidateFunction, get schema() { return PatchRequest.validate.schema }, @@ -966,15 +1015,16 @@ export const PatchRequest = { return PatchRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/deposit-products/schemas/deposit-product-action-response.schema.js b/src/deposit-products/schemas/deposit-product-action-response.schema.js index c0b3321..9142998 100644 --- a/src/deposit-products/schemas/deposit-product-action-response.schema.js +++ b/src/deposit-products/schemas/deposit-product-action-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DepositProductActionResponse","type":"object","description":"Represents the response returned after a batch update action for a deposit product.","properties":{"state":{"title":"state","description":"The state of the deposit product action","const":"QUEUED"}},"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.state !== undefined){if("QUEUED" !== data.state){validate10.errors = [{instancePath:instancePath+"/state",schemaPath:"#/properties/state/const",keyword:"const",params:{allowedValue: "QUEUED"},message:"must be equal to constant"}];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 +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DepositProductActionResponse","type":"object","description":"Represents the response returned after a batch update action for a deposit product.","properties":{"state":{"description":"The state of the deposit product action","const":"QUEUED"}},"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.state !== undefined){if("QUEUED" !== data.state){validate10.errors = [{instancePath:instancePath+"/state",schemaPath:"#/properties/state/const",keyword:"const",params:{allowedValue: "QUEUED"},message:"must be equal to constant"}];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/deposit-products/schemas/deposit-product-action.schema.js b/src/deposit-products/schemas/deposit-product-action.schema.js index f108db4..791154a 100644 --- a/src/deposit-products/schemas/deposit-product-action.schema.js +++ b/src/deposit-products/schemas/deposit-product-action.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DepositProductAction","type":"object","description":"Specify the batch update action details for a deposit product.","properties":{"action":{"title":"action","description":"The action type to be applied. When UPDATE_INTEREST_SETTINGS action type is used, all the existing deposit accounts will be updated with the latest interest-related fields at the end of day job execution","const":"UPDATE_INTEREST_SETTINGS"}},"required":["action"],"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.action === undefined) && (missing0 = "action")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.action !== undefined){if("UPDATE_INTEREST_SETTINGS" !== data.action){validate10.errors = [{instancePath:instancePath+"/action",schemaPath:"#/properties/action/const",keyword:"const",params:{allowedValue: "UPDATE_INTEREST_SETTINGS"},message:"must be equal to constant"}];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 +"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DepositProductAction","type":"object","description":"Specify the batch update action details for a deposit product.","properties":{"action":{"description":"The action type to be applied. When UPDATE_INTEREST_SETTINGS action type is used, all the existing deposit accounts will be updated with the latest interest-related fields at the end of day job execution","const":"UPDATE_INTEREST_SETTINGS"}},"required":["action"],"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.action === undefined) && (missing0 = "action")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.action !== undefined){if("UPDATE_INTEREST_SETTINGS" !== data.action){validate10.errors = [{instancePath:instancePath+"/action",schemaPath:"#/properties/action/const",keyword:"const",params:{allowedValue: "UPDATE_INTEREST_SETTINGS"},message:"must be equal to constant"}];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/deposit-products/schemas/deposit-product.schema.js b/src/deposit-products/schemas/deposit-product.schema.js index f519636..61bbb3a 100644 --- a/src/deposit-products/schemas/deposit-product.schema.js +++ b/src/deposit-products/schemas/deposit-product.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";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":{"title":"accountingSettings","$ref":"#/$defs/DepositProductAccountingSettingsaf30"},"availabilitySettings":{"title":"availabilitySettings","$ref":"#/$defs/DepositProductAvailabilitySettingsaf30"},"category":{"title":"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","title":"creationDate","description":"The date this product was created","format":"date-time"},"creditArrangementSettings":{"title":"creditArrangementSettings","$ref":"#/$defs/CreditArrangementSettingsaf30"},"currencySettings":{"title":"currencySettings","$ref":"#/$defs/DepositProductCurrencySettingsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the deposit product, auto generated, unique"},"feesSettings":{"title":"feesSettings","$ref":"#/$defs/DepositProductFeeSettingsaf30"},"id":{"type":"string","title":"id","description":"The id of the product, can be generated and customized, unique"},"interestSettings":{"title":"interestSettings","$ref":"#/$defs/DepositProductInterestSettingsaf30"},"internalControls":{"title":"internalControls","$ref":"#/$defs/DepositProductInternalControlsaf30"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last date the product was updated","format":"date-time"},"maturitySettings":{"title":"maturitySettings","$ref":"#/$defs/DepositMaturitySettingsaf30"},"name":{"type":"string","title":"name","description":"The name of the product"},"newAccountSettings":{"title":"newAccountSettings","$ref":"#/$defs/DepositNewAccountSettingsaf30"},"notes":{"type":"string","title":"notes","description":"Some notes/a description about the product"},"offsetSettings":{"title":"offsetSettings","$ref":"#/$defs/DepositProductOffsetSettingsaf30"},"overdraftInterestSettings":{"title":"overdraftInterestSettings","$ref":"#/$defs/OverdraftInterestSettingsaf30"},"overdraftSettings":{"title":"overdraftSettings","$ref":"#/$defs/DepositProductOverdraftSettingsaf30"},"state":{"title":"state","description":"Indicates the current state of the product","enum":["ACTIVE","INACTIVE"]},"taxSettings":{"title":"taxSettings","$ref":"#/$defs/DepositProductTaxSettingsaf30"},"templates":{"type":"array","title":"templates","description":"Template documents of the product.","items":{"$ref":"#/$defs/DocumentTemplateaf30"}},"type":{"title":"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":{"DepositProductAccountingSettingsaf30":{"type":"object","title":"DepositProductAccountingSettingsaf30","description":"Accounting settings, defines the accounting settings for the product.","properties":{"accountingMethod":{"title":"accountingMethod","description":"A list of accounting rules for a product.","enum":["NONE","CASH","ACCRUAL"]},"accountingRules":{"type":"array","title":"accountingRules","description":"A list of accounting rules for the product.","items":{"$ref":"#/$defs/DepositGLAccountingRuleaf30"}},"interestAccruedAccountingMethod":{"title":"interestAccruedAccountingMethod","description":"A list of accounting rules for a product.","enum":["NONE","DAILY","END_OF_MONTH"]}},"required":["accountingMethod"],"additionalProperties":true},"DepositGLAccountingRuleaf30":{"type":"object","title":"DepositGLAccountingRuleaf30","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","title":"encodedKey","description":"The encoded key of the accounting rule, auto generated, unique."},"financialResource":{"title":"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","title":"glAccountKey","description":"The encoded key of the account that is mapped to the financialResource"}},"required":["financialResource","glAccountKey"],"additionalProperties":true},"DepositProductAvailabilitySettingsaf30":{"type":"object","title":"DepositProductAvailabilitySettingsaf30","description":"Holds information about product availability.","properties":{"availableFor":{"type":"array","title":"availableFor","description":"Holds the entities this product is available for. i.e Individuals","items":{"enum":["INDIVIDUALS","PURE_GROUPS"]},"uniqueItems":true},"branchSettings":{"title":"branchSettings","$ref":"#/$defs/BranchSettingsaf30"}},"additionalProperties":true},"BranchSettingsaf30":{"type":"object","title":"BranchSettingsaf30","description":"Holds information about branch availability for the product.","properties":{"availableProductBranches":{"type":"array","title":"availableProductBranches","description":"Holds the encoded keys of the branches this product should be available for.","items":{"type":"string"}},"forAllBranches":{"type":"boolean","title":"forAllBranches","description":"Indicates if this product should be available for all branches"}},"additionalProperties":true},"CreditArrangementSettingsaf30":{"type":"object","title":"CreditArrangementSettingsaf30","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"creditArrangementRequirement":{"title":"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},"DepositProductCurrencySettingsaf30":{"type":"object","title":"DepositProductCurrencySettingsaf30","description":"Currency settings for the product.","properties":{"currencies":{"type":"array","title":"currencies","description":"Currencies that can be used by accounts of this product","items":{"$ref":"#/$defs/Currencyaf30"}}},"additionalProperties":true},"Currencyaf30":{"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true},"DepositProductFeeSettingsaf30":{"type":"object","title":"DepositProductFeeSettingsaf30","description":"Defines fees settings for the product.","properties":{"allowArbitraryFees":{"type":"boolean","title":"allowArbitraryFees","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","title":"fees","description":"List of all fees that can be applied for accounts of this loan product.","items":{"$ref":"#/$defs/DepositProductPredefinedFeeaf30"}}},"additionalProperties":true},"DepositProductPredefinedFeeaf30":{"type":"object","title":"DepositProductPredefinedFeeaf30","description":"The response representation of the PredefinedFee. Represents a fee with a defined name and a fixed value.","properties":{"accountingRules":{"type":"array","title":"accountingRules","description":"A list of accounting rules defined for this fee. If null, product default rules are selected.","items":{"$ref":"#/$defs/DepositGLAccountingRuleaf30"}},"amount":{"type":"number","title":"amount","description":"The amount of the fee"},"amountCalculationFunctionName":{"type":"string","title":"amountCalculationFunctionName","description":"External function"},"amountCalculationMethod":{"title":"amountCalculationMethod","description":"The amount from which the fee is calculated using percentageAmount","enum":["FLAT","MAMBU_FUNCTION"]},"applyDateMethod":{"title":"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","title":"creationDate","description":"Shows the creation date of the fee","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the predefined fee, auto generated, unique"},"feeApplication":{"title":"feeApplication","description":"The type of fee application when disbursement is applied","enum":["REQUIRED","OPTIONAL"]},"id":{"type":"string","title":"id","description":"The id of the fee"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"Shows the last modified date of the fee","format":"date-time"},"name":{"type":"string","title":"name","description":"The name of the fee"},"state":{"title":"state","description":"Indicates the state of the fee","enum":["ACTIVE","INACTIVE"]},"trigger":{"title":"trigger","description":"Shows the event that will trigger a fee","enum":["MANUAL","MONTHLY_FEE","ARBITRARY"]}},"required":["feeApplication","state","trigger"],"additionalProperties":true},"DepositProductInterestSettingsaf30":{"type":"object","title":"DepositProductInterestSettingsaf30","description":"The interest settings, defines constraints regarding interest that will be used on the deposit account based on this product.","properties":{"collectInterestWhenLocked":{"type":"boolean","title":"collectInterestWhenLocked","description":"Whether locked accounts still collect Interest or not"},"daysInYear":{"title":"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":{"title":"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","title":"interestGainsProvidedEndDate","description":"The date when the accounts under this product, will no longer have interest gains provided","format":"date"},"interestGainsProvidedStartDate":{"type":"string","title":"interestGainsProvidedStartDate","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","title":"interestPaidIntoAccount","description":"If interest should be payed into the deposit account"},"interestPaymentSettings":{"title":"interestPaymentSettings","$ref":"#/$defs/InterestPaymentSettingsaf30"},"interestRateSettings":{"title":"interestRateSettings","$ref":"#/$defs/DepositProductInterestRateSettingsaf30"},"maximumBalance":{"type":"number","title":"maximumBalance","description":"The maximum balance used for Interest calculation"}},"additionalProperties":true},"InterestPaymentSettingsaf30":{"type":"object","title":"InterestPaymentSettingsaf30","description":"Defines the interest payment settings for the deposit product and for deposits created based on this product","properties":{"interestPaymentDates":{"type":"array","title":"interestPaymentDates","description":"List of all dates on which the interest is payed into deposit account","items":{"$ref":"#/$defs/MonthAndDayaf30"}},"interestPaymentPoint":{"title":"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},"MonthAndDayaf30":{"type":"object","title":"MonthAndDayaf30","description":"Wrapper for month and day for instances where the year isn't needed","properties":{"day":{"type":"integer","title":"day","description":"The day in the month"},"month":{"type":"integer","title":"month","description":"The month of the year"}},"additionalProperties":true},"DepositProductInterestRateSettingsaf30":{"type":"object","title":"DepositProductInterestRateSettingsaf30","description":"The interest settings, defines constraints regarding interest that will be used on the deposit created based on this product.","properties":{"accrueInterestAfterMaturity":{"type":"boolean","title":"accrueInterestAfterMaturity","description":"If the product supports this option, specify if the interest should be accrued after the account maturity date"},"allowNegativeInterestRate":{"type":"boolean","title":"allowNegativeInterestRate","description":"Indicator whether the deposit product allows negative values for interest rate"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate tier, auto generated, unique"},"indexSourceKey":{"type":"string","title":"indexSourceKey","description":"Index rate source key."},"interestChargeFrequency":{"title":"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","title":"interestChargeFrequencyCount","description":"the count of units to apply over the interval"},"interestRate":{"title":"interestRate","$ref":"#/$defs/DecimalIntervalaf30"},"interestRateReviewCount":{"type":"integer","title":"interestRateReviewCount","description":"Interest rate review frequency unit count"},"interestRateReviewUnit":{"title":"interestRateReviewUnit","description":"Interest rate review frequency measurement unit","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"title":"interestRateSource","description":"Interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"title":"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","title":"interestRateTiers","description":"The list of interest rate tiers available for the current settings instance","items":{"$ref":"#/$defs/DepositProductInterestRateTieraf30"}}},"additionalProperties":true},"DecimalIntervalaf30":{"type":"object","title":"DecimalIntervalaf30","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","title":"defaultValue","description":"The default value, will be used in case no other value was filled in by the user."},"maxValue":{"type":"number","title":"maxValue","description":"The maximum value."},"minValue":{"type":"number","title":"minValue","description":"The minimum value."}},"additionalProperties":true},"DepositProductInterestRateTieraf30":{"type":"object","title":"DepositProductInterestRateTieraf30","description":"Used or TIERED interest rates, holds the values to define how the interest is computed","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","title":"endingBalance","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"endingDay":{"type":"integer","title":"endingDay","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","title":"interestRate","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true},"DepositProductInternalControlsaf30":{"type":"object","title":"DepositProductInternalControlsaf30","description":"Constraints and automated actions and that will be applied on the accounts.","properties":{"dormancyPeriodDays":{"type":"integer","title":"dormancyPeriodDays","description":"Specifies the number of days for an account to be fully paid in order to auto close it."},"maxWithdrawalAmount":{"type":"number","title":"maxWithdrawalAmount","description":"Max amount per withdrawal"},"openingBalance":{"title":"openingBalance","$ref":"#/$defs/AmountDecimalIntervalaf30"},"recommendedDepositAmount":{"type":"number","title":"recommendedDepositAmount","description":"Recommended amount for a deposit"}},"additionalProperties":true},"AmountDecimalIntervalaf30":{"type":"object","title":"AmountDecimalIntervalaf30","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","title":"defaultValue","description":"The default value, will be used in case no other value was filled in by the user."},"maxValue":{"type":"number","title":"maxValue","description":"The maximum value."},"minValue":{"type":"number","title":"minValue","description":"The minimum value."}},"additionalProperties":true},"DepositMaturitySettingsaf30":{"type":"object","title":"DepositMaturitySettingsaf30","description":"The maturity settings for the product.","properties":{"maturityPeriod":{"title":"maturityPeriod","$ref":"#/$defs/IntegerIntervalaf30"},"maturityPeriodUnit":{"title":"maturityPeriodUnit","description":"maturity period measurement unit","enum":["DAYS","WEEKS","MONTHS"]}},"additionalProperties":true},"IntegerIntervalaf30":{"type":"object","title":"IntegerIntervalaf30","description":"Decimal integer, like min/max/default.","properties":{"defaultValue":{"type":"integer","title":"defaultValue","description":"The default value, will be used in case no other value was filled in by the user."},"maxValue":{"type":"integer","title":"maxValue","description":"The maximum value."},"minValue":{"type":"integer","title":"minValue","description":"The minimum value."}},"additionalProperties":true},"DepositNewAccountSettingsaf30":{"type":"object","title":"DepositNewAccountSettingsaf30","description":"New Account settings for deposit accounts","properties":{"idGeneratorType":{"title":"idGeneratorType","description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","title":"idPattern","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["idGeneratorType","idPattern"],"additionalProperties":true},"DepositProductOffsetSettingsaf30":{"type":"object","title":"DepositProductOffsetSettingsaf30","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","title":"allowOffset","description":"Specify if the product allow to create accounts which can be used as offset for loans"}},"additionalProperties":true},"OverdraftInterestSettingsaf30":{"type":"object","title":"OverdraftInterestSettingsaf30","description":"Overdraft settings for the product","properties":{"daysInYear":{"title":"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":{"title":"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":{"title":"interestRateSettings","$ref":"#/$defs/DepositProductOverdraftInterestRateSettingsaf30"}},"additionalProperties":true},"DepositProductOverdraftInterestRateSettingsaf30":{"type":"object","title":"DepositProductOverdraftInterestRateSettingsaf30","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","title":"indexSourceKey","description":"Index rate source key."},"interestChargeFrequency":{"title":"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","title":"interestChargeFrequencyCount","description":"the count of units to apply over the interval"},"interestRate":{"title":"interestRate","$ref":"#/$defs/DecimalIntervalaf30"},"interestRateReviewCount":{"type":"integer","title":"interestRateReviewCount","description":"Interest rate review frequency unit count"},"interestRateReviewUnit":{"title":"interestRateReviewUnit","description":"Interest rate review frequency measurement unit","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"title":"interestRateSource","description":"Interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"title":"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","title":"interestRateTiers","description":"The list of interest rate tiers available for the current settings instance","items":{"$ref":"#/$defs/DepositProductOverdraftInterestRateTieraf30"}}},"additionalProperties":true},"DepositProductOverdraftInterestRateTieraf30":{"type":"object","title":"DepositProductOverdraftInterestRateTieraf30","description":"Used for TIERED interest rates, holds the values to define how the interest is computed","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","title":"endingBalance","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"interestRate":{"type":"number","title":"interestRate","description":"The rate used for computing the interest for an account which has the balance less than the ending balance"}},"required":["interestRate"],"additionalProperties":true},"DepositProductOverdraftSettingsaf30":{"type":"object","title":"DepositProductOverdraftSettingsaf30","description":"The overdraft settings of the deposit product","properties":{"allowOverdraft":{"type":"boolean","title":"allowOverdraft","description":"Whether the accounts for this product may have overdraft"},"allowTechnicalOverdraft":{"type":"boolean","title":"allowTechnicalOverdraft","description":"Whether the accounts for this product may have technical overdraft"},"maxOverdraftLimit":{"type":"number","title":"maxOverdraftLimit","description":"How much money may be taken out for the account to go negative"}},"additionalProperties":true},"DepositProductTaxSettingsaf30":{"type":"object","title":"DepositProductTaxSettingsaf30","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"withholdingTaxEnabled":{"type":"boolean","title":"withholdingTaxEnabled","description":"Whether withholding taxes are enabled for this product or not"}},"additionalProperties":true},"DocumentTemplateaf30":{"type":"object","title":"DocumentTemplateaf30","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","title":"name","description":"The name the document"},"type":{"title":"type","description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true}}};const schema16 = {"type":"object","title":"CreditArrangementSettingsaf30","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"creditArrangementRequirement":{"title":"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","title":"DepositNewAccountSettingsaf30","description":"New Account settings for deposit accounts","properties":{"idGeneratorType":{"title":"idGeneratorType","description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","title":"idPattern","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","title":"DepositProductOffsetSettingsaf30","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","title":"allowOffset","description":"Specify if the product allow to create accounts which can be used as offset for loans"}},"additionalProperties":true};const schema38 = {"type":"object","title":"DepositProductOverdraftSettingsaf30","description":"The overdraft settings of the deposit product","properties":{"allowOverdraft":{"type":"boolean","title":"allowOverdraft","description":"Whether the accounts for this product may have overdraft"},"allowTechnicalOverdraft":{"type":"boolean","title":"allowTechnicalOverdraft","description":"Whether the accounts for this product may have technical overdraft"},"maxOverdraftLimit":{"type":"number","title":"maxOverdraftLimit","description":"How much money may be taken out for the account to go negative"}},"additionalProperties":true};const schema39 = {"type":"object","title":"DepositProductTaxSettingsaf30","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"withholdingTaxEnabled":{"type":"boolean","title":"withholdingTaxEnabled","description":"Whether withholding taxes are enabled for this product or not"}},"additionalProperties":true};const schema40 = {"type":"object","title":"DocumentTemplateaf30","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","title":"name","description":"The name the document"},"type":{"title":"type","description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true};const schema12 = {"type":"object","title":"DepositProductAccountingSettingsaf30","description":"Accounting settings, defines the accounting settings for the product.","properties":{"accountingMethod":{"title":"accountingMethod","description":"A list of accounting rules for a product.","enum":["NONE","CASH","ACCRUAL"]},"accountingRules":{"type":"array","title":"accountingRules","description":"A list of accounting rules for the product.","items":{"$ref":"#/$defs/DepositGLAccountingRuleaf30"}},"interestAccruedAccountingMethod":{"title":"interestAccruedAccountingMethod","description":"A list of accounting rules for a product.","enum":["NONE","DAILY","END_OF_MONTH"]}},"required":["accountingMethod"],"additionalProperties":true};const schema13 = {"type":"object","title":"DepositGLAccountingRuleaf30","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","title":"encodedKey","description":"The encoded key of the accounting rule, auto generated, unique."},"financialResource":{"title":"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","title":"glAccountKey","description":"The encoded key of the account that is mapped to the financialResource"}},"required":["financialResource","glAccountKey"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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 + | SuccessResponse<'200', DepositTransaction> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DepositTransactionAdjustmentDetails, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/transactions/${path.depositTransactionId}:adjust`, { @@ -81,21 +103,21 @@ export class MambuDepositTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: DepositTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Apply a fee on a deposit account */ - public async applyFee({ + public applyFee({ body, path, headers, @@ -103,10 +125,29 @@ export class MambuDepositTransactions { }: { body: FeeAppliedDepositTransactionInput path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(FeeAppliedDepositTransactionInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', DepositTransaction> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(FeeAppliedDepositTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/fee-transactions`, { @@ -115,51 +156,63 @@ export class MambuDepositTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: DepositTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Edit custom information or notes for deposit transaction */ - public async editTransactionDetails({ + public editTransactionDetails({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: EditTransactionDetailsRequest - path: { depositTransactionId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(EditTransactionDetailsRequest, body) + }: { body: EditTransactionDetailsRequest; path: { depositTransactionId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(EditTransactionDetailsRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`deposits/transactions/${path.depositTransactionId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get deposit transactions */ - public async getAll({ + public getAll({ path, query, auth = [['apiKey'], ['basic']], @@ -167,7 +220,19 @@ export class MambuDepositTransactions { path: { depositAccountId: string } query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`deposits/${path.depositAccountId}/transactions`, { searchParams: query ?? {}, @@ -179,22 +244,31 @@ export class MambuDepositTransactions { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get deposit transaction */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { depositTransactionId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { depositTransactionId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', DepositTransaction> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`deposits/transactions/${path.depositTransactionId}`, { searchParams: query ?? {}, @@ -207,20 +281,30 @@ export class MambuDepositTransactions { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get deposit transaction document */ - public async getDepositTransactionDocument({ + public getDepositTransactionDocument({ path, auth = [['apiKey'], ['basic']], - }: { - path: { depositTransactionId: string; templateId: string } - auth?: string[][] | string[] - }) { + }: { path: { depositTransactionId: string; templateId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', GetDepositTransactionDocumentResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`deposits/transactions/${path.depositTransactionId}/templates/${path.templateId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -232,44 +316,57 @@ export class MambuDepositTransactions { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create bulk deposit transactions. */ - public async makeBulkDeposits({ + public makeBulkDeposits({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: BulkDepositTransactionsInput - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(BulkDepositTransactionsInput, body) + }: { body: BulkDepositTransactionsInput; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'202', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(BulkDepositTransactionsInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`deposits/deposit-transactions:bulk`, { + this.buildClient(auth).post('deposits/deposit-transactions:bulk', { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 202: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 202: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create deposit transaction */ - public async makeDeposit({ + public makeDeposit({ body, path, headers, @@ -277,10 +374,29 @@ export class MambuDepositTransactions { }: { body: DepositTransactionInput path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(DepositTransactionInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', DepositTransaction> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DepositTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/deposit-transactions`, { @@ -289,21 +405,21 @@ export class MambuDepositTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: DepositTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create deposit transaction */ - public async makeDepositAsync({ + public makeDepositAsync({ body, path, headers, @@ -311,32 +427,50 @@ export class MambuDepositTransactions { }: { body: DepositTransactionInput path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(DepositTransactionInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'202', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DepositTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/transactions/deposits`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 202: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 202: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Seize a block amount on a deposit account */ - public async makeSeizure({ + public makeSeizure({ body, path, headers, @@ -344,10 +478,29 @@ export class MambuDepositTransactions { }: { body: SeizeBlockAmount path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(SeizeBlockAmount, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', DepositTransaction> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(SeizeBlockAmount, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/seizure-transactions`, { @@ -356,21 +509,21 @@ export class MambuDepositTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: DepositTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create transfer transaction */ - public async makeTransfer({ + public makeTransfer({ body, path, headers, @@ -378,10 +531,29 @@ export class MambuDepositTransactions { }: { body: TransferDepositTransactionInput path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(TransferDepositTransactionInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', DepositTransaction> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(TransferDepositTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/transfer-transactions`, { @@ -390,21 +562,21 @@ export class MambuDepositTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: DepositTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create withdrawal transaction */ - public async makeWithdrawal({ + public makeWithdrawal({ body, path, headers, @@ -412,10 +584,29 @@ export class MambuDepositTransactions { }: { body: WithdrawalDepositTransactionInput path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(WithdrawalDepositTransactionInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', DepositTransaction> + | 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(WithdrawalDepositTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/withdrawal-transactions`, { @@ -424,21 +615,21 @@ export class MambuDepositTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: DepositTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create withdrawal transaction */ - public async makeWithdrawalAsync({ + public makeWithdrawalAsync({ body, path, headers, @@ -446,32 +637,50 @@ export class MambuDepositTransactions { }: { body: WithdrawalDepositTransactionInput path: { depositAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(WithdrawalDepositTransactionInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'202', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(WithdrawalDepositTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`deposits/${path.depositAccountId}/transactions/withdrawals`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 202: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 202: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Search deposit transactions for deposit accounts by various criteria */ - public async search({ + public search({ body, query, auth = [['apiKey'], ['basic']], @@ -479,11 +688,27 @@ export class MambuDepositTransactions { body: DepositTransactionSearchCriteria query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(DepositTransactionSearchCriteria, body) + }): Promise< + | SuccessResponse<'200', SearchResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DepositTransactionSearchCriteria, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`deposits/transactions:search`, { + this.buildClient(auth).post('deposits/transactions:search', { json: body, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -494,45 +719,66 @@ export class MambuDepositTransactions { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -559,24 +805,52 @@ export class MambuDepositTransactions { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/deposit-transactions/rest.type.ts b/src/deposit-transactions/rest.type.ts index 89c1a3a..a0ad23a 100644 --- a/src/deposit-transactions/rest.type.ts +++ b/src/deposit-transactions/rest.type.ts @@ -3,8 +3,23 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as BulkDepositTransactionsInputValidator } from './schemas/bulk-deposit-transactions-input.schema.js' +import { validate as DepositTransactionAdjustmentDetailsValidator } from './schemas/deposit-transaction-adjustment-details.schema.js' +import { validate as DepositTransactionInputValidator } from './schemas/deposit-transaction-input.schema.js' +import { validate as DepositTransactionSearchCriteriaValidator } from './schemas/deposit-transaction-search-criteria.schema.js' +import { validate as DepositTransactionValidator } from './schemas/deposit-transaction.schema.js' +import { validate as EditTransactionDetailsRequestValidator } from './schemas/edit-transaction-details-request.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as FeeAppliedDepositTransactionInputValidator } from './schemas/fee-applied-deposit-transaction-input.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' +import { validate as GetDepositTransactionDocumentResponseValidator } from './schemas/get-deposit-transaction-document-response.schema.js' +import { validate as SearchResponseValidator } from './schemas/search-response.schema.js' +import { validate as SeizeBlockAmountValidator } from './schemas/seize-block-amount.schema.js' +import { validate as TransferDepositTransactionInputValidator } from './schemas/transfer-deposit-transaction-input.schema.js' +import { validate as WithdrawalDepositTransactionInputValidator } from './schemas/withdrawal-deposit-transaction-input.schema.js' /** * The account currency and identification @@ -13,8 +28,8 @@ export interface AccountDetails { /** * The currency of the account */ - currency?: string - identification?: AccountIdentification + currency?: string | undefined + identification?: AccountIdentification | undefined } /** @@ -24,15 +39,15 @@ export interface AccountIdentification { /** * The account unique identifier */ - iban?: string - other?: OtherAccountIdentification + iban?: string | undefined + other?: OtherAccountIdentification | undefined } /** * The agent details for a party */ export interface Agent { - financialInstitutionIdentification?: FinancialInstitutionIdentification + financialInstitutionIdentification?: FinancialInstitutionIdentification | undefined } /** @@ -42,12 +57,11 @@ export interface BulkDepositTransactionsInput { /** * The list of transactions */ - transactions?: DepositTransactionBulkableInputDTO[] + transactions?: DepositTransactionBulkableInputDTO[] | undefined } export const BulkDepositTransactionsInput = { - validate: (await import('./schemas/bulk-deposit-transactions-input.schema.js')) - .validate as ValidateFunction, + validate: BulkDepositTransactionsInputValidator as ValidateFunction, get schema() { return BulkDepositTransactionsInput.validate.schema }, @@ -55,10 +69,11 @@ export const BulkDepositTransactionsInput = { return BulkDepositTransactionsInput.validate.errors ?? undefined }, is: (o: unknown): o is BulkDepositTransactionsInput => BulkDepositTransactionsInput.validate(o) === true, - assert: (o: unknown) => { - if (!BulkDepositTransactionsInput.validate(o)) { - throw new ValidationError(BulkDepositTransactionsInput.errors ?? []) + parse: (o: unknown): { right: BulkDepositTransactionsInput } | { left: DefinedError[] } => { + if (BulkDepositTransactionsInput.is(o)) { + return { right: o } } + return { left: (BulkDepositTransactionsInput.errors ?? []) as DefinedError[] } }, } as const @@ -69,31 +84,31 @@ export interface CardAcceptor { /** * The city in which the card acceptor has the business. */ - city?: string + city?: string | undefined /** * The country in which the card acceptor has the business. */ - country?: string + country?: string | undefined /** * The Merchant Category Code of the card acceptor. */ - mcc?: number + mcc?: number | undefined /** * The name of the card acceptor. */ - name?: string + name?: string | undefined /** * The state in which the card acceptor has the business. */ - state?: string + state?: string | undefined /** * The street in which the card acceptor has the business. */ - street?: string + street?: string | undefined /** * The ZIP code of the location in which the card acceptor has the business. */ - zip?: string + zip?: string | undefined } /** @@ -108,23 +123,23 @@ export interface CardTransaction { * The amount of money to be withdrawn in the financial transaction. */ amount: number - cardAcceptor?: CardAcceptor + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * 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. */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external authorization hold reference ID, which relates this card transaction to a previous authorization hold. */ - externalAuthorizationReferenceId?: string + externalAuthorizationReferenceId?: string | undefined /** * The external reference ID to be used to reference the card transaction in subsequent requests. */ @@ -132,7 +147,7 @@ export interface CardTransaction { /** * The formatted time at which the user made this card transaction. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } /** @@ -142,15 +157,15 @@ export interface CreditorReferenceInformation { /** * The reference information of the creditor's underlying documents */ - reference?: string + reference?: string | undefined /** * The entity that assigns the reference type */ - referenceIssuer?: string + referenceIssuer?: string | undefined /** * The type of creditor reference */ - referenceType?: string + referenceType?: string | undefined } /** @@ -160,39 +175,39 @@ export interface DepositAffectedAmounts { /** * Amount of fees involved in a transaction that affects an account with positive balance */ - feesAmount?: number + feesAmount?: number | undefined /** * In the case of an LOAN_FRACTION_BOUGHT this represent the fraction amount which was bought from another investor */ - fractionAmount?: number + fractionAmount?: number | undefined /** * Balance change amount involved in a transaction that affects an account with positive balance */ - fundsAmount?: number + fundsAmount?: number | undefined /** * Amount of interest involved in a transaction that affects an account with positive balance */ - interestAmount?: number + interestAmount?: number | undefined /** * The amount of money that was added/subtracted from the account by this transaction as overdraft */ - overdraftAmount?: number + overdraftAmount?: number | undefined /** * Fees amount involved in a transaction that affects an overdraft */ - overdraftFeesAmount?: number + overdraftFeesAmount?: number | undefined /** * Interest amount involved in a transaction that affects an overdraft */ - overdraftInterestAmount?: number + overdraftInterestAmount?: number | undefined /** * The amount of money that was added/subtracted from the account by this transaction as technical overdraft */ - technicalOverdraftAmount?: number + technicalOverdraftAmount?: number | undefined /** * The amount of money that was added/subtracted from the account by this transaction as technical overdraft interest */ - technicalOverdraftInterestAmount?: number + technicalOverdraftInterestAmount?: number | undefined } /** @@ -202,11 +217,11 @@ export interface DepositFee { /** * The amount of the fee that was applied/paid in the transaction for the given predefined fee. */ - amount?: number + amount?: number | undefined /** * The name of the predefined fee */ - name?: string + name?: string | undefined /** * The encoded key of the predefined fee, auto generated, unique */ @@ -214,11 +229,11 @@ export interface DepositFee { /** * The amount of the taxes on fee that was applied/paid in the transaction. */ - taxAmount?: number + taxAmount?: number | undefined /** * Shows the event that will trigger a fee */ - trigger?: 'MANUAL' | 'MONTHLY_FEE' | 'ARBITRARY' + trigger?: 'MANUAL' | 'MONTHLY_FEE' | 'ARBITRARY' | undefined } /** @@ -228,19 +243,19 @@ export interface DepositInterestAccruedAmounts { /** * The amount of positive interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - interestAccrued?: number + interestAccrued?: number | undefined /** * The amount of negative interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - negativeInterestAccrued?: number + negativeInterestAccrued?: number | undefined /** * The amount of overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - overdraftInterestAccrued?: number + overdraftInterestAccrued?: number | undefined /** * The amount of technical overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - technicalOverdraftInterestAccrued?: number + technicalOverdraftInterestAccrued?: number | undefined } /** @@ -250,11 +265,11 @@ export interface DepositOverdraftInterestSettings { /** * The value of the index interest rate set or changed in this transaction */ - indexInterestRate?: number + indexInterestRate?: number | undefined /** * The interest rate that was set or changed in this transaction. Used on product interest rate changes or interest tier switches */ - interestRate?: number + interestRate?: number | undefined } /** @@ -264,7 +279,7 @@ export interface DepositOverdraftSettings { /** * The overdraft limit that was set or changed in this transaction */ - overdraftLimit?: number + overdraftLimit?: number | undefined } /** @@ -274,107 +289,107 @@ export interface DepositTaxes { /** * The tax rate that was set or changed in this transaction */ - taxRate?: number + taxRate?: number | undefined } /** * The deposit transaction terms */ export interface DepositTerms { - interestSettings?: DepositTransactionInterestSettings - overdraftInterestSettings?: DepositOverdraftInterestSettings - overdraftSettings?: DepositOverdraftSettings + interestSettings?: DepositTransactionInterestSettings | undefined + overdraftInterestSettings?: DepositOverdraftInterestSettings | undefined + overdraftSettings?: DepositOverdraftSettings | undefined } /** * Represents the action performed on an Deposit Account after which the account's amount changes its value. */ export interface DepositTransaction { - accountBalances?: DepositTransactionBalances + accountBalances?: DepositTransactionBalances | undefined /** * The key of the deposit transaction where the adjustment for this transaction was made (if any adjustment was involved) */ - adjustmentTransactionKey?: string - affectedAmounts?: DepositAffectedAmounts + adjustmentTransactionKey?: string | undefined + affectedAmounts?: DepositAffectedAmounts | undefined /** * How much was added/removed in account */ - amount?: number + amount?: number | undefined /** * The block fund id associated with the transaction */ - blockId?: string + blockId?: string | undefined /** * The date when corresponding JE is booked (as Organization Time) */ - bookingDate?: string + bookingDate?: string | undefined /** * The branch where the transaction was performed */ - branchKey?: string - cardTransaction?: CardTransaction + branchKey?: string | undefined + cardTransaction?: CardTransaction | undefined /** * The center where the transaction was performed */ - centreKey?: string + centreKey?: string | undefined /** * The date when this deposit transaction was created */ - creationDate?: string + creationDate?: string | undefined /** * The currency in which this transaction was posted */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the deposit transaction, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external id of the deposit transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * All the amounts that have been applied or paid within this transaction and involved predefined fees */ - fees?: DepositFee[] + fees?: DepositFee[] | undefined /** * The external id of an account authorization hold */ - holdExternalReferenceId?: string + holdExternalReferenceId?: string | undefined /** * The id of the deposit transaction, auto generated, unique */ - id?: string - interestAccruedAmounts?: DepositInterestAccruedAmounts + id?: string | undefined + interestAccruedAmounts?: DepositInterestAccruedAmounts | undefined /** * The migration event encoded key associated with this deposit account. If this account was imported, track which 'migration event' they came from */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * Extra notes about this deposit transaction */ - notes?: string + notes?: string | undefined /** * The encodedKey of the transaction that was adjusted as part of this one. Available only for adjustment transactions */ - originalTransactionKey?: string + originalTransactionKey?: string | undefined /** * The key of the parent deposit account */ - parentAccountKey?: string - paymentDetails?: PaymentDetails + parentAccountKey?: string | undefined + paymentDetails?: PaymentDetails | undefined /** * The payment order id of the deposit transaction, customizable */ - paymentOrderId?: string - taxes?: DepositTaxes - terms?: DepositTerms + paymentOrderId?: string | undefined + taxes?: DepositTaxes | undefined + terms?: DepositTerms | undefined /** * The till key associated with this transaction */ - tillKey?: string - transactionDetails?: TransactionDetails - transferDetails?: TransferDetails + tillKey?: string | undefined + transactionDetails?: TransactionDetails | undefined + transferDetails?: TransferDetails | undefined /** * The type of the deposit transaction */ @@ -412,18 +427,19 @@ export interface DepositTransaction { | 'LOAN_FRACTION_SOLD' | 'LOAN_FRACTION_SOLD_ADJUSTMENT' | 'SEIZED_AMOUNT' + | undefined /** * The person that performed the transaction */ - userKey?: string + userKey?: string | undefined /** * Date of the entry (eg date of repayment or disbursal, etc.) (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } export const DepositTransaction = { - validate: (await import('./schemas/deposit-transaction.schema.js')).validate as ValidateFunction, + validate: DepositTransactionValidator as ValidateFunction, get schema() { return DepositTransaction.validate.schema }, @@ -431,10 +447,11 @@ export const DepositTransaction = { return DepositTransaction.validate.errors ?? undefined }, is: (o: unknown): o is DepositTransaction => DepositTransaction.validate(o) === true, - assert: (o: unknown) => { - if (!DepositTransaction.validate(o)) { - throw new ValidationError(DepositTransaction.errors ?? []) + parse: (o: unknown): { right: DepositTransaction } | { left: DefinedError[] } => { + if (DepositTransaction.is(o)) { + return { right: o } } + return { left: (DepositTransaction.errors ?? []) as DefinedError[] } }, } as const @@ -445,16 +462,15 @@ export interface DepositTransactionAdjustmentDetails { /** * Date when the adjustment transaction is logged into accounting. Can be null. Available only for DEPOSIT and WITHDRAWAL */ - bookingDate?: string + bookingDate?: string | undefined /** * Notes detailing why the transaction is adjusted */ - notes?: string + notes?: string | undefined } export const DepositTransactionAdjustmentDetails = { - validate: (await import('./schemas/deposit-transaction-adjustment-details.schema.js')) - .validate as ValidateFunction, + validate: DepositTransactionAdjustmentDetailsValidator as ValidateFunction, get schema() { return DepositTransactionAdjustmentDetails.validate.schema }, @@ -462,10 +478,11 @@ export const DepositTransactionAdjustmentDetails = { return DepositTransactionAdjustmentDetails.validate.errors ?? undefined }, is: (o: unknown): o is DepositTransactionAdjustmentDetails => DepositTransactionAdjustmentDetails.validate(o) === true, - assert: (o: unknown) => { - if (!DepositTransactionAdjustmentDetails.validate(o)) { - throw new ValidationError(DepositTransactionAdjustmentDetails.errors ?? []) + parse: (o: unknown): { right: DepositTransactionAdjustmentDetails } | { left: DefinedError[] } => { + if (DepositTransactionAdjustmentDetails.is(o)) { + return { right: o } } + return { left: (DepositTransactionAdjustmentDetails.errors ?? []) as DefinedError[] } }, } as const @@ -476,7 +493,7 @@ export interface DepositTransactionBalances { /** * The running balance owed by deposit */ - totalBalance?: number + totalBalance?: number | undefined } /** @@ -494,25 +511,25 @@ export interface DepositTransactionBulkableInputDTO { /** * The external id of the deposit transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * The external id of an account authorization hold */ - holdExternalReferenceId?: string + holdExternalReferenceId?: string | undefined /** * Extra notes about this deposit transaction */ - notes?: string - paymentDetails?: PaymentDetails + notes?: string | undefined + paymentDetails?: PaymentDetails | undefined /** * The payment order id of the deposit transaction, customizable */ - paymentOrderId?: string + paymentOrderId?: string | undefined /** * Flag indicating that a maximum balance validation should be skipped */ - skipMaximumBalanceValidation?: boolean - transactionDetails?: TransactionDetailsInput + skipMaximumBalanceValidation?: boolean | undefined + transactionDetails?: TransactionDetailsInput | undefined } /** @@ -614,15 +631,15 @@ export interface DepositTransactionFilterCriteria { /** * The second value to match the searching criteria, when the `BETWEEN` operator is used. */ - secondValue?: string + secondValue?: string | undefined /** * The value to match the searching criteria. */ - value?: string + value?: string | undefined /** * List of values when the `IN` operator is used. */ - values?: string[] + values?: string[] | undefined } /** @@ -636,38 +653,37 @@ export interface DepositTransactionInput { /** * The date of Journal Entry (as Organization Time) */ - bookingDate?: string + bookingDate?: string | undefined /** * The external id of the deposit transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * The external id of an account authorization hold */ - holdExternalReferenceId?: string + holdExternalReferenceId?: string | undefined /** * Extra notes about this deposit transaction */ - notes?: string - paymentDetails?: PaymentDetails + notes?: string | undefined + paymentDetails?: PaymentDetails | undefined /** * The payment order id of the deposit transaction, customizable */ - paymentOrderId?: string + paymentOrderId?: string | undefined /** * Flag indicating that a maximum balance validation should be skipped */ - skipMaximumBalanceValidation?: boolean - transactionDetails?: TransactionDetailsInput + skipMaximumBalanceValidation?: boolean | undefined + transactionDetails?: TransactionDetailsInput | undefined /** * The entry date of the deposit (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } export const DepositTransactionInput = { - validate: (await import('./schemas/deposit-transaction-input.schema.js')) - .validate as ValidateFunction, + validate: DepositTransactionInputValidator as ValidateFunction, get schema() { return DepositTransactionInput.validate.schema }, @@ -675,10 +691,11 @@ export const DepositTransactionInput = { return DepositTransactionInput.validate.errors ?? undefined }, is: (o: unknown): o is DepositTransactionInput => DepositTransactionInput.validate(o) === true, - assert: (o: unknown) => { - if (!DepositTransactionInput.validate(o)) { - throw new ValidationError(DepositTransactionInput.errors ?? []) + parse: (o: unknown): { right: DepositTransactionInput } | { left: DefinedError[] } => { + if (DepositTransactionInput.is(o)) { + return { right: o } } + return { left: (DepositTransactionInput.errors ?? []) as DefinedError[] } }, } as const @@ -689,11 +706,11 @@ export interface DepositTransactionInterestSettings { /** * The value of the index interest rate set or changed in this transaction */ - indexInterestRate?: number + indexInterestRate?: number | undefined /** * The interest rate for the deposit account */ - interestRate?: number + interestRate?: number | undefined } /** @@ -704,12 +721,11 @@ export interface DepositTransactionSearchCriteria { * The list of filtering criteria */ filterCriteria: DepositTransactionFilterCriteria[] - sortingCriteria?: DepositTransactionSortingCriteria + sortingCriteria?: DepositTransactionSortingCriteria | undefined } export const DepositTransactionSearchCriteria = { - validate: (await import('./schemas/deposit-transaction-search-criteria.schema.js')) - .validate as ValidateFunction, + validate: DepositTransactionSearchCriteriaValidator as ValidateFunction, get schema() { return DepositTransactionSearchCriteria.validate.schema }, @@ -717,10 +733,11 @@ export const DepositTransactionSearchCriteria = { return DepositTransactionSearchCriteria.validate.errors ?? undefined }, is: (o: unknown): o is DepositTransactionSearchCriteria => DepositTransactionSearchCriteria.validate(o) === true, - assert: (o: unknown) => { - if (!DepositTransactionSearchCriteria.validate(o)) { - throw new ValidationError(DepositTransactionSearchCriteria.errors ?? []) + parse: (o: unknown): { right: DepositTransactionSearchCriteria } | { left: DefinedError[] } => { + if (DepositTransactionSearchCriteria.is(o)) { + return { right: o } } + return { left: (DepositTransactionSearchCriteria.errors ?? []) as DefinedError[] } }, } as const @@ -754,14 +771,13 @@ export interface DepositTransactionSortingCriteria { /** * The sorting order: `ASC` or `DESC`. The default order is `DESC`. */ - order?: 'ASC' | 'DESC' + order?: 'ASC' | 'DESC' | undefined } export type EditTransactionDetailsRequest = PatchOperation[] export const EditTransactionDetailsRequest = { - validate: (await import('./schemas/edit-transaction-details-request.schema.js')) - .validate as ValidateFunction, + validate: EditTransactionDetailsRequestValidator as ValidateFunction, get schema() { return EditTransactionDetailsRequest.validate.schema }, @@ -769,19 +785,20 @@ export const EditTransactionDetailsRequest = { return EditTransactionDetailsRequest.validate.errors ?? undefined }, is: (o: unknown): o is EditTransactionDetailsRequest => EditTransactionDetailsRequest.validate(o) === true, - assert: (o: unknown) => { - if (!EditTransactionDetailsRequest.validate(o)) { - throw new ValidationError(EditTransactionDetailsRequest.errors ?? []) + parse: (o: unknown): { right: EditTransactionDetailsRequest } | { left: DefinedError[] } => { + if (EditTransactionDetailsRequest.is(o)) { + return { right: o } } + return { left: (EditTransactionDetailsRequest.errors ?? []) as DefinedError[] } }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -789,10 +806,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -803,24 +821,23 @@ export interface FeeAppliedDepositTransactionInput { /** * The value of the fee applied on the account */ - amount?: number + amount?: number | undefined /** * The external id of the current transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * Extra notes about the current transaction */ - notes?: string + notes?: string | undefined /** * The encodedKey of the predefined fee that defines the current fee */ - predefinedFeeKey?: string + predefinedFeeKey?: string | undefined } export const FeeAppliedDepositTransactionInput = { - validate: (await import('./schemas/fee-applied-deposit-transaction-input.schema.js')) - .validate as ValidateFunction, + validate: FeeAppliedDepositTransactionInputValidator as ValidateFunction, get schema() { return FeeAppliedDepositTransactionInput.validate.schema }, @@ -828,10 +845,11 @@ export const FeeAppliedDepositTransactionInput = { return FeeAppliedDepositTransactionInput.validate.errors ?? undefined }, is: (o: unknown): o is FeeAppliedDepositTransactionInput => FeeAppliedDepositTransactionInput.validate(o) === true, - assert: (o: unknown) => { - if (!FeeAppliedDepositTransactionInput.validate(o)) { - throw new ValidationError(FeeAppliedDepositTransactionInput.errors ?? []) + parse: (o: unknown): { right: FeeAppliedDepositTransactionInput } | { left: DefinedError[] } => { + if (FeeAppliedDepositTransactionInput.is(o)) { + return { right: o } } + return { left: (FeeAppliedDepositTransactionInput.errors ?? []) as DefinedError[] } }, } as const @@ -842,13 +860,13 @@ export interface FinancialInstitutionIdentification { /** * Business identifier code */ - bic?: string + bic?: string | undefined } export type GetAllResponse = DepositTransaction[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -856,13 +874,18 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetDepositTransactionDocumentResponse = string export const GetDepositTransactionDocumentResponse = { - validate: (await import('./schemas/get-deposit-transaction-document-response.schema.js')) - .validate as ValidateFunction, + validate: GetDepositTransactionDocumentResponseValidator as ValidateFunction, get schema() { return GetDepositTransactionDocumentResponse.validate.schema }, @@ -870,6 +893,12 @@ export const GetDepositTransactionDocumentResponse = { return GetDepositTransactionDocumentResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetDepositTransactionDocumentResponse => GetDepositTransactionDocumentResponse.validate(o) === true, + parse: (o: unknown): { right: GetDepositTransactionDocumentResponse } | { left: DefinedError[] } => { + if (GetDepositTransactionDocumentResponse.is(o)) { + return { right: o } + } + return { left: (GetDepositTransactionDocumentResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -879,11 +908,11 @@ export interface OtherAccountIdentification { /** * The identification of the payer/payee */ - identification?: string + identification?: string | undefined /** * The identification scheme */ - scheme?: string + scheme?: string | undefined } /** @@ -893,7 +922,7 @@ export interface Party { /** * The name of the party */ - name?: string + name?: string | undefined } /** @@ -903,7 +932,7 @@ export interface PatchOperation { /** * The field from where a value should be moved, when using move */ - from?: string + from?: string | undefined /** * The change to perform */ @@ -915,24 +944,22 @@ export interface PatchOperation { /** * The value of the field, can be null */ - value?: { - [k: string]: unknown | undefined - } + value?: unknown } /** * The payment information including account identification details */ export interface PaymentDetails { - creditor?: Party - creditorAccount?: AccountDetails - creditorAgent?: Agent - debtor?: Party - debtorAccount?: AccountDetails - debtorAgent?: Agent - paymentIdentification?: PaymentIdentification - paymentTypeInformation?: PaymentTypeInformation - remittanceInformation?: RemittanceInformation + creditor?: Party | undefined + creditorAccount?: AccountDetails | undefined + creditorAgent?: Agent | undefined + debtor?: Party | undefined + debtorAccount?: AccountDetails | undefined + debtorAgent?: Agent | undefined + paymentIdentification?: PaymentIdentification | undefined + paymentTypeInformation?: PaymentTypeInformation | undefined + remittanceInformation?: RemittanceInformation | undefined } /** @@ -942,45 +969,45 @@ export interface PaymentIdentification { /** * Identifier assigned by the initiating party to the transaction */ - endToEndIdentification?: string + endToEndIdentification?: string | undefined /** * Identifier of a payment instruction */ - instructionIdentification?: string + instructionIdentification?: string | undefined /** * Identifier unique for a period assigned by the first initiating party to the transaction */ - transactionIdentification?: string + transactionIdentification?: string | undefined } /** * The information specifying the type of transaction */ export interface PaymentTypeInformation { - serviceLevel?: ServiceLevel + serviceLevel?: ServiceLevel | undefined } /** * The information specifying the payment items that are intended to settle */ export interface RemittanceInformation { - structured?: Structured + structured?: Structured | undefined /** * Information supplied to match the items of the payment in an unstructured form */ - unstructured?: string + unstructured?: string | undefined } export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } export type SearchResponse = DepositTransaction[] export const SearchResponse = { - validate: (await import('./schemas/search-response.schema.js')).validate as ValidateFunction, + validate: SearchResponseValidator as ValidateFunction, get schema() { return SearchResponse.validate.schema }, @@ -988,6 +1015,12 @@ export const SearchResponse = { return SearchResponse.validate.errors ?? undefined }, is: (o: unknown): o is SearchResponse => SearchResponse.validate(o) === true, + parse: (o: unknown): { right: SearchResponse } | { left: DefinedError[] } => { + if (SearchResponse.is(o)) { + return { right: o } + } + return { left: (SearchResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -997,7 +1030,7 @@ export interface SeizeBlockAmount { /** * The amount of the block fund */ - amount?: number + amount?: number | undefined /** * The id of the block fund */ @@ -1005,11 +1038,11 @@ export interface SeizeBlockAmount { /** * The external id of the current transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * Extra notes about the current transaction */ - notes?: string + notes?: string | undefined /** * The id of the channel through which the transaction is done. */ @@ -1017,7 +1050,7 @@ export interface SeizeBlockAmount { } export const SeizeBlockAmount = { - validate: (await import('./schemas/seize-block-amount.schema.js')).validate as ValidateFunction, + validate: SeizeBlockAmountValidator as ValidateFunction, get schema() { return SeizeBlockAmount.validate.schema }, @@ -1025,10 +1058,11 @@ export const SeizeBlockAmount = { return SeizeBlockAmount.validate.errors ?? undefined }, is: (o: unknown): o is SeizeBlockAmount => SeizeBlockAmount.validate(o) === true, - assert: (o: unknown) => { - if (!SeizeBlockAmount.validate(o)) { - throw new ValidationError(SeizeBlockAmount.errors ?? []) + parse: (o: unknown): { right: SeizeBlockAmount } | { left: DefinedError[] } => { + if (SeizeBlockAmount.is(o)) { + return { right: o } } + return { left: (SeizeBlockAmount.errors ?? []) as DefinedError[] } }, } as const @@ -1039,14 +1073,14 @@ export interface ServiceLevel { /** * The code for a pre-agreed service or level of service between the parties */ - code?: string + code?: string | undefined } /** * The information specifying the payment items that are intended to settle */ export interface Structured { - creditorReferenceInformation?: CreditorReferenceInformation + creditorReferenceInformation?: CreditorReferenceInformation | undefined } /** @@ -1056,11 +1090,11 @@ export interface TransactionDetails { /** * The id of the transaction channel associated with the transaction details. */ - transactionChannelId?: string + transactionChannelId?: string | undefined /** * The encoded key of the transaction channel associated with the transaction details. */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } /** @@ -1070,11 +1104,11 @@ export interface TransactionDetailsInput { /** * The id of the transaction channel associated with the transaction details. */ - transactionChannelId?: string + transactionChannelId?: string | undefined /** * The encoded key of the transaction channel associated with the transaction details. */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } /** @@ -1088,30 +1122,29 @@ export interface TransferDepositTransactionInput { /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external id of the transfer transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * Extra notes about this deposit transaction */ - notes?: string - paymentDetails?: PaymentDetails + notes?: string | undefined + paymentDetails?: PaymentDetails | undefined /** * The payment order id of the transfer transaction, customizable */ - paymentOrderId?: string + paymentOrderId?: string | undefined transferDetails: TransferDetailsInput /** * The entry date of the transfer. If not specified it is considered the current date (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } export const TransferDepositTransactionInput = { - validate: (await import('./schemas/transfer-deposit-transaction-input.schema.js')) - .validate as ValidateFunction, + validate: TransferDepositTransactionInputValidator as ValidateFunction, get schema() { return TransferDepositTransactionInput.validate.schema }, @@ -1119,10 +1152,11 @@ export const TransferDepositTransactionInput = { return TransferDepositTransactionInput.validate.errors ?? undefined }, is: (o: unknown): o is TransferDepositTransactionInput => TransferDepositTransactionInput.validate(o) === true, - assert: (o: unknown) => { - if (!TransferDepositTransactionInput.validate(o)) { - throw new ValidationError(TransferDepositTransactionInput.errors ?? []) + parse: (o: unknown): { right: TransferDepositTransactionInput } | { left: DefinedError[] } => { + if (TransferDepositTransactionInput.is(o)) { + return { right: o } } + return { left: (TransferDepositTransactionInput.errors ?? []) as DefinedError[] } }, } as const @@ -1133,11 +1167,11 @@ export interface TransferDetails { /** * The key of the related deposit transaction */ - linkedDepositTransactionKey?: string + linkedDepositTransactionKey?: string | undefined /** * The key of the related loan transaction */ - linkedLoanTransactionKey?: string + linkedLoanTransactionKey?: string | undefined } /** @@ -1147,11 +1181,11 @@ export interface TransferDetailsInput { /** * The id of the linked account */ - linkedAccountId?: string + linkedAccountId?: string | undefined /** * The encoded key of the linked account */ - linkedAccountKey?: string + linkedAccountKey?: string | undefined /** * The type of the linked account. Can be LOAN or DEPOSIT */ @@ -1169,34 +1203,33 @@ export interface WithdrawalDepositTransactionInput { /** * The date of the withdrawal when the transaction is logged into accounting. If not specified it is considered the value date */ - bookingDate?: string + bookingDate?: string | undefined /** * The external id of the withdrawal transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * The external id of an account authorization hold */ - holdExternalReferenceId?: string + holdExternalReferenceId?: string | undefined /** * Extra notes about this deposit transaction */ - notes?: string - paymentDetails?: PaymentDetails + notes?: string | undefined + paymentDetails?: PaymentDetails | undefined /** * The payment order id of the withdrawal transaction, customizable */ - paymentOrderId?: string - transactionDetails?: TransactionDetailsInput + paymentOrderId?: string | undefined + transactionDetails?: TransactionDetailsInput | undefined /** * The entry date of the withdrawal. If not specified it is considered the current date (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } export const WithdrawalDepositTransactionInput = { - validate: (await import('./schemas/withdrawal-deposit-transaction-input.schema.js')) - .validate as ValidateFunction, + validate: WithdrawalDepositTransactionInputValidator as ValidateFunction, get schema() { return WithdrawalDepositTransactionInput.validate.schema }, @@ -1204,9 +1237,10 @@ export const WithdrawalDepositTransactionInput = { return WithdrawalDepositTransactionInput.validate.errors ?? undefined }, is: (o: unknown): o is WithdrawalDepositTransactionInput => WithdrawalDepositTransactionInput.validate(o) === true, - assert: (o: unknown) => { - if (!WithdrawalDepositTransactionInput.validate(o)) { - throw new ValidationError(WithdrawalDepositTransactionInput.errors ?? []) + parse: (o: unknown): { right: WithdrawalDepositTransactionInput } | { left: DefinedError[] } => { + if (WithdrawalDepositTransactionInput.is(o)) { + return { right: o } } + return { left: (WithdrawalDepositTransactionInput.errors ?? []) as DefinedError[] } }, } as const diff --git a/src/deposit-transactions/schemas/bulk-deposit-transactions-input.schema.js b/src/deposit-transactions/schemas/bulk-deposit-transactions-input.schema.js index 3c68240..6bc87fe 100644 --- a/src/deposit-transactions/schemas/bulk-deposit-transactions-input.schema.js +++ b/src/deposit-transactions/schemas/bulk-deposit-transactions-input.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"BulkDepositTransactionsInput","type":"object","description":"Represents the request payload for creating a bulk deposit transactions.","properties":{"transactions":{"type":"array","title":"transactions","description":"The list of transactions","items":{"$ref":"#/$defs/DepositTransactionBulkableInputDTOaf30"}}},"additionalProperties":true,"$defs":{"DepositTransactionBulkableInputDTOaf30":{"type":"object","title":"DepositTransactionBulkableInputDTOaf30","description":"Represents the request payload for creating a deposit transactions when sent in bulk.","properties":{"accountId":{"type":"string","title":"accountId","description":"The id of the account"},"amount":{"type":"number","title":"amount","description":"The amount that was added to an account"},"externalId":{"type":"string","title":"externalId","description":"The external id of the deposit transaction, customizable, unique"},"holdExternalReferenceId":{"type":"string","title":"holdExternalReferenceId","description":"The external id of an account authorization hold"},"notes":{"type":"string","title":"notes","description":"Extra notes about this deposit transaction"},"paymentDetails":{"title":"paymentDetails","$ref":"#/$defs/PaymentDetailsaf30"},"paymentOrderId":{"type":"string","title":"paymentOrderId","description":"The payment order id of the deposit transaction, customizable"},"skipMaximumBalanceValidation":{"type":"boolean","title":"skipMaximumBalanceValidation","description":"Flag indicating that a maximum balance validation should be skipped"},"transactionDetails":{"title":"transactionDetails","$ref":"#/$defs/TransactionDetailsInputaf30"}},"required":["accountId","amount"],"additionalProperties":true},"PaymentDetailsaf30":{"type":"object","title":"PaymentDetailsaf30","description":"The payment information including account identification details","properties":{"creditor":{"title":"creditor","$ref":"#/$defs/Partyaf30"},"creditorAccount":{"title":"creditorAccount","$ref":"#/$defs/AccountDetailsaf30"},"creditorAgent":{"title":"creditorAgent","$ref":"#/$defs/Agentaf30"},"debtor":{"title":"debtor","$ref":"#/$defs/Partyaf30"},"debtorAccount":{"title":"debtorAccount","$ref":"#/$defs/AccountDetailsaf30"},"debtorAgent":{"title":"debtorAgent","$ref":"#/$defs/Agentaf30"},"paymentIdentification":{"title":"paymentIdentification","$ref":"#/$defs/PaymentIdentificationaf30"},"paymentTypeInformation":{"title":"paymentTypeInformation","$ref":"#/$defs/PaymentTypeInformationaf30"},"remittanceInformation":{"title":"remittanceInformation","$ref":"#/$defs/RemittanceInformationaf30"}},"additionalProperties":true},"Partyaf30":{"type":"object","title":"Partyaf30","description":"The details of the party for a transaction","properties":{"name":{"type":"string","title":"name","description":"The name of the party"}},"additionalProperties":true},"AccountDetailsaf30":{"type":"object","title":"AccountDetailsaf30","description":"The account currency and identification","properties":{"currency":{"type":"string","title":"currency","description":"The currency of the account"},"identification":{"title":"identification","$ref":"#/$defs/AccountIdentificationaf30"}},"additionalProperties":true},"AccountIdentificationaf30":{"type":"object","title":"AccountIdentificationaf30","description":"The account identification details","properties":{"iban":{"type":"string","title":"iban","description":"The account unique identifier"},"other":{"title":"other","$ref":"#/$defs/OtherAccountIdentificationaf30"}},"additionalProperties":true},"OtherAccountIdentificationaf30":{"type":"object","title":"OtherAccountIdentificationaf30","description":"Represents other way of identification for the account.","properties":{"identification":{"type":"string","title":"identification","description":"The identification of the payer/payee"},"scheme":{"type":"string","title":"scheme","description":"The identification scheme"}},"additionalProperties":true},"Agentaf30":{"type":"object","title":"Agentaf30","description":"The agent details for a party","properties":{"financialInstitutionIdentification":{"title":"financialInstitutionIdentification","$ref":"#/$defs/FinancialInstitutionIdentificationaf30"}},"additionalProperties":true},"FinancialInstitutionIdentificationaf30":{"type":"object","title":"FinancialInstitutionIdentificationaf30","description":"The identification of the financial institution","properties":{"bic":{"type":"string","title":"bic","description":"Business identifier code"}},"additionalProperties":true},"PaymentIdentificationaf30":{"type":"object","title":"PaymentIdentificationaf30","description":"The payment identification details","properties":{"endToEndIdentification":{"type":"string","title":"endToEndIdentification","description":"Identifier assigned by the initiating party to the transaction"},"instructionIdentification":{"type":"string","title":"instructionIdentification","description":"Identifier of a payment instruction"},"transactionIdentification":{"type":"string","title":"transactionIdentification","description":"Identifier unique for a period assigned by the first initiating party to the transaction"}},"additionalProperties":true},"PaymentTypeInformationaf30":{"type":"object","title":"PaymentTypeInformationaf30","description":"The information specifying the type of transaction","properties":{"serviceLevel":{"title":"serviceLevel","$ref":"#/$defs/ServiceLevelaf30"}},"additionalProperties":true},"ServiceLevelaf30":{"type":"object","title":"ServiceLevelaf30","description":"The rules under which the transaction should be processed","properties":{"code":{"type":"string","title":"code","description":"The code for a pre-agreed service or level of service between the parties"}},"additionalProperties":true},"RemittanceInformationaf30":{"type":"object","title":"RemittanceInformationaf30","description":"The information specifying the payment items that are intended to settle","properties":{"structured":{"title":"structured","$ref":"#/$defs/Structuredaf30"},"unstructured":{"type":"string","title":"unstructured","description":"Information supplied to match the items of the payment in an unstructured form"}},"additionalProperties":true},"Structuredaf30":{"type":"object","title":"Structuredaf30","description":"The information specifying the payment items that are intended to settle","properties":{"creditorReferenceInformation":{"title":"creditorReferenceInformation","$ref":"#/$defs/CreditorReferenceInformationaf30"}},"additionalProperties":true},"CreditorReferenceInformationaf30":{"type":"object","title":"CreditorReferenceInformationaf30","description":"Represents the reference to the underlying documents of the payment.","properties":{"reference":{"type":"string","title":"reference","description":"The reference information of the creditor's underlying documents"},"referenceIssuer":{"type":"string","title":"referenceIssuer","description":"The entity that assigns the reference type"},"referenceType":{"type":"string","title":"referenceType","description":"The type of creditor reference"}},"additionalProperties":true},"TransactionDetailsInputaf30":{"type":"object","title":"TransactionDetailsInputaf30","description":"Contains the details about transaction including fields like transaction channel key and channel ID","properties":{"transactionChannelId":{"type":"string","title":"transactionChannelId","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"DepositTransactionBulkableInputDTOaf30","description":"Represents the request payload for creating a deposit transactions when sent in bulk.","properties":{"accountId":{"type":"string","title":"accountId","description":"The id of the account"},"amount":{"type":"number","title":"amount","description":"The amount that was added to an account"},"externalId":{"type":"string","title":"externalId","description":"The external id of the deposit transaction, customizable, unique"},"holdExternalReferenceId":{"type":"string","title":"holdExternalReferenceId","description":"The external id of an account authorization hold"},"notes":{"type":"string","title":"notes","description":"Extra notes about this deposit transaction"},"paymentDetails":{"title":"paymentDetails","$ref":"#/$defs/PaymentDetailsaf30"},"paymentOrderId":{"type":"string","title":"paymentOrderId","description":"The payment order id of the deposit transaction, customizable"},"skipMaximumBalanceValidation":{"type":"boolean","title":"skipMaximumBalanceValidation","description":"Flag indicating that a maximum balance validation should be skipped"},"transactionDetails":{"title":"transactionDetails","$ref":"#/$defs/TransactionDetailsInputaf30"}},"required":["accountId","amount"],"additionalProperties":true};const schema27 = {"type":"object","title":"TransactionDetailsInputaf30","description":"Contains the details about transaction including fields like transaction channel key and channel ID","properties":{"transactionChannelId":{"type":"string","title":"transactionChannelId","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};const schema13 = {"type":"object","title":"PaymentDetailsaf30","description":"The payment information including account identification details","properties":{"creditor":{"title":"creditor","$ref":"#/$defs/Partyaf30"},"creditorAccount":{"title":"creditorAccount","$ref":"#/$defs/AccountDetailsaf30"},"creditorAgent":{"title":"creditorAgent","$ref":"#/$defs/Agentaf30"},"debtor":{"title":"debtor","$ref":"#/$defs/Partyaf30"},"debtorAccount":{"title":"debtorAccount","$ref":"#/$defs/AccountDetailsaf30"},"debtorAgent":{"title":"debtorAgent","$ref":"#/$defs/Agentaf30"},"paymentIdentification":{"title":"paymentIdentification","$ref":"#/$defs/PaymentIdentificationaf30"},"paymentTypeInformation":{"title":"paymentTypeInformation","$ref":"#/$defs/PaymentTypeInformationaf30"},"remittanceInformation":{"title":"remittanceInformation","$ref":"#/$defs/RemittanceInformationaf30"}},"additionalProperties":true};const schema14 = {"type":"object","title":"Partyaf30","description":"The details of the party for a transaction","properties":{"name":{"type":"string","title":"name","description":"The name of the party"}},"additionalProperties":true};const schema21 = {"type":"object","title":"PaymentIdentificationaf30","description":"The payment identification details","properties":{"endToEndIdentification":{"type":"string","title":"endToEndIdentification","description":"Identifier assigned by the initiating party to the transaction"},"instructionIdentification":{"type":"string","title":"instructionIdentification","description":"Identifier of a payment instruction"},"transactionIdentification":{"type":"string","title":"transactionIdentification","description":"Identifier unique for a period assigned by the first initiating party to the transaction"}},"additionalProperties":true};const schema15 = {"type":"object","title":"AccountDetailsaf30","description":"The account currency and identification","properties":{"currency":{"type":"string","title":"currency","description":"The currency of the account"},"identification":{"title":"identification","$ref":"#/$defs/AccountIdentificationaf30"}},"additionalProperties":true};const schema16 = {"type":"object","title":"AccountIdentificationaf30","description":"The account identification details","properties":{"iban":{"type":"string","title":"iban","description":"The account unique identifier"},"other":{"title":"other","$ref":"#/$defs/OtherAccountIdentificationaf30"}},"additionalProperties":true};const schema17 = {"type":"object","title":"OtherAccountIdentificationaf30","description":"Represents other way of identification for the account.","properties":{"identification":{"type":"string","title":"identification","description":"The identification of the payer/payee"},"scheme":{"type":"string","title":"scheme","description":"The identification scheme"}},"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.iban !== undefined){const _errs2 = errors;if(typeof data.iban !== "string"){validate14.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"){validate14.errors = [{instancePath:instancePath+"/other/identification",schemaPath:"#/$defs/OtherAccountIdentificationaf30/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"){validate14.errors = [{instancePath:instancePath+"/other/scheme",schemaPath:"#/$defs/OtherAccountIdentificationaf30/properties/scheme/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}else {validate14.errors = [{instancePath:instancePath+"/other",schemaPath:"#/$defs/OtherAccountIdentificationaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}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;}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.currency !== undefined){const _errs2 = errors;if(typeof data.currency !== "string"){validate13.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(!(validate14(data.identification, {instancePath:instancePath+"/identification",parentData:data,parentDataProperty:"identification",rootData}))){vErrors = vErrors === null ? validate14.errors : vErrors.concat(validate14.errors);errors = vErrors.length;}var valid0 = _errs4 === 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 schema18 = {"type":"object","title":"Agentaf30","description":"The agent details for a party","properties":{"financialInstitutionIdentification":{"title":"financialInstitutionIdentification","$ref":"#/$defs/FinancialInstitutionIdentificationaf30"}},"additionalProperties":true};const schema19 = {"type":"object","title":"FinancialInstitutionIdentificationaf30","description":"The identification of the financial institution","properties":{"bic":{"type":"string","title":"bic","description":"Business identifier code"}},"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)){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"){validate17.errors = [{instancePath:instancePath+"/financialInstitutionIdentification/bic",schemaPath:"#/$defs/FinancialInstitutionIdentificationaf30/properties/bic/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate17.errors = [{instancePath:instancePath+"/financialInstitutionIdentification",schemaPath:"#/$defs/FinancialInstitutionIdentificationaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate17.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate17.errors = vErrors;return errors === 0;}const schema22 = {"type":"object","title":"PaymentTypeInformationaf30","description":"The information specifying the type of transaction","properties":{"serviceLevel":{"title":"serviceLevel","$ref":"#/$defs/ServiceLevelaf30"}},"additionalProperties":true};const schema23 = {"type":"object","title":"ServiceLevelaf30","description":"The rules under which the transaction should be processed","properties":{"code":{"type":"string","title":"code","description":"The code for a pre-agreed service or level of service between the parties"}},"additionalProperties":true};function validate21(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"){validate21.errors = [{instancePath:instancePath+"/serviceLevel/code",schemaPath:"#/$defs/ServiceLevelaf30/properties/code/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate21.errors = [{instancePath:instancePath+"/serviceLevel",schemaPath:"#/$defs/ServiceLevelaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate21.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate21.errors = vErrors;return errors === 0;}const schema24 = {"type":"object","title":"RemittanceInformationaf30","description":"The information specifying the payment items that are intended to settle","properties":{"structured":{"title":"structured","$ref":"#/$defs/Structuredaf30"},"unstructured":{"type":"string","title":"unstructured","description":"Information supplied to match the items of the payment in an unstructured form"}},"additionalProperties":true};const schema25 = {"type":"object","title":"Structuredaf30","description":"The information specifying the payment items that are intended to settle","properties":{"creditorReferenceInformation":{"title":"creditorReferenceInformation","$ref":"#/$defs/CreditorReferenceInformationaf30"}},"additionalProperties":true};const schema26 = {"type":"object","title":"CreditorReferenceInformationaf30","description":"Represents the reference to the underlying documents of the payment.","properties":{"reference":{"type":"string","title":"reference","description":"The reference information of the creditor's underlying documents"},"referenceIssuer":{"type":"string","title":"referenceIssuer","description":"The entity that assigns the reference type"},"referenceType":{"type":"string","title":"referenceType","description":"The type of creditor reference"}},"additionalProperties":true};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.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"){validate24.errors = [{instancePath:instancePath+"/creditorReferenceInformation/reference",schemaPath:"#/$defs/CreditorReferenceInformationaf30/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"){validate24.errors = [{instancePath:instancePath+"/creditorReferenceInformation/referenceIssuer",schemaPath:"#/$defs/CreditorReferenceInformationaf30/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"){validate24.errors = [{instancePath:instancePath+"/creditorReferenceInformation/referenceType",schemaPath:"#/$defs/CreditorReferenceInformationaf30/properties/referenceType/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}else {validate24.errors = [{instancePath:instancePath+"/creditorReferenceInformation",schemaPath:"#/$defs/CreditorReferenceInformationaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate24.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate24.errors = vErrors;return errors === 0;}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.structured !== undefined){const _errs2 = errors;if(!(validate24(data.structured, {instancePath:instancePath+"/structured",parentData:data,parentDataProperty:"structured",rootData}))){vErrors = vErrors === null ? validate24.errors : vErrors.concat(validate24.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"){validate23.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 {validate23.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate23.errors = vErrors;return errors === 0;}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.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"){validate12.errors = [{instancePath:instancePath+"/creditor/name",schemaPath:"#/$defs/Partyaf30/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate12.errors = [{instancePath:instancePath+"/creditor",schemaPath:"#/$defs/Partyaf30/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(!(validate13(data.creditorAccount, {instancePath:instancePath+"/creditorAccount",parentData:data,parentDataProperty:"creditorAccount",rootData}))){vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);errors = vErrors.length;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.creditorAgent !== undefined){const _errs9 = errors;if(!(validate17(data.creditorAgent, {instancePath:instancePath+"/creditorAgent",parentData:data,parentDataProperty:"creditorAgent",rootData}))){vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.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"){validate12.errors = [{instancePath:instancePath+"/debtor/name",schemaPath:"#/$defs/Partyaf30/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}else {validate12.errors = [{instancePath:instancePath+"/debtor",schemaPath:"#/$defs/Partyaf30/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(!(validate13(data.debtorAccount, {instancePath:instancePath+"/debtorAccount",parentData:data,parentDataProperty:"debtorAccount",rootData}))){vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);errors = vErrors.length;}var valid0 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.debtorAgent !== undefined){const _errs17 = errors;if(!(validate17(data.debtorAgent, {instancePath:instancePath+"/debtorAgent",parentData:data,parentDataProperty:"debtorAgent",rootData}))){vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.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"){validate12.errors = [{instancePath:instancePath+"/paymentIdentification/endToEndIdentification",schemaPath:"#/$defs/PaymentIdentificationaf30/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"){validate12.errors = [{instancePath:instancePath+"/paymentIdentification/instructionIdentification",schemaPath:"#/$defs/PaymentIdentificationaf30/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"){validate12.errors = [{instancePath:instancePath+"/paymentIdentification/transactionIdentification",schemaPath:"#/$defs/PaymentIdentificationaf30/properties/transactionIdentification/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid6 = _errs26 === errors;}else {var valid6 = true;}}}}else {validate12.errors = [{instancePath:instancePath+"/paymentIdentification",schemaPath:"#/$defs/PaymentIdentificationaf30/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(!(validate21(data.paymentTypeInformation, {instancePath:instancePath+"/paymentTypeInformation",parentData:data,parentDataProperty:"paymentTypeInformation",rootData}))){vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors);errors = vErrors.length;}var valid0 = _errs28 === errors;}else {var valid0 = true;}if(valid0){if(data.remittanceInformation !== undefined){const _errs29 = errors;if(!(validate23(data.remittanceInformation, {instancePath:instancePath+"/remittanceInformation",parentData:data,parentDataProperty:"remittanceInformation",rootData}))){vErrors = vErrors === null ? validate23.errors : vErrors.concat(validate23.errors);errors = vErrors.length;}var valid0 = _errs29 === 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;}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.accountId === undefined) && (missing0 = "accountId")) || ((data.amount === undefined) && (missing0 = "amount"))){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.accountId !== undefined){const _errs2 = errors;if(typeof data.accountId !== "string"){validate11.errors = [{instancePath:instancePath+"/accountId",schemaPath:"#/properties/accountId/type",keyword:"type",params:{type: "string"},message:"must be string"}];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.externalId !== undefined){const _errs6 = 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 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.holdExternalReferenceId !== undefined){const _errs8 = errors;if(typeof data.holdExternalReferenceId !== "string"){validate11.errors = [{instancePath:instancePath+"/holdExternalReferenceId",schemaPath:"#/properties/holdExternalReferenceId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs10 = 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 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentDetails !== undefined){const _errs12 = errors;if(!(validate12(data.paymentDetails, {instancePath:instancePath+"/paymentDetails",parentData:data,parentDataProperty:"paymentDetails",rootData}))){vErrors = vErrors === null ? validate12.errors : vErrors.concat(validate12.errors);errors = vErrors.length;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.paymentOrderId !== undefined){const _errs13 = errors;if(typeof data.paymentOrderId !== "string"){validate11.errors = [{instancePath:instancePath+"/paymentOrderId",schemaPath:"#/properties/paymentOrderId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.skipMaximumBalanceValidation !== undefined){const _errs15 = errors;if(typeof data.skipMaximumBalanceValidation !== "boolean"){validate11.errors = [{instancePath:instancePath+"/skipMaximumBalanceValidation",schemaPath:"#/properties/skipMaximumBalanceValidation/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs15 === errors;}else {var valid0 = true;}if(valid0){if(data.transactionDetails !== undefined){let data8 = data.transactionDetails;const _errs17 = errors;const _errs18 = errors;if(errors === _errs18){if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.transactionChannelId !== undefined){const _errs21 = errors;if(typeof data8.transactionChannelId !== "string"){validate11.errors = [{instancePath:instancePath+"/transactionDetails/transactionChannelId",schemaPath:"#/$defs/TransactionDetailsInputaf30/properties/transactionChannelId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs21 === errors;}else {var valid2 = true;}if(valid2){if(data8.transactionChannelKey !== undefined){const _errs23 = errors;if(typeof data8.transactionChannelKey !== "string"){validate11.errors = [{instancePath:instancePath+"/transactionDetails/transactionChannelKey",schemaPath:"#/$defs/TransactionDetailsInputaf30/properties/transactionChannelKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs23 === errors;}else {var valid2 = true;}}}else {validate11.errors = [{instancePath:instancePath+"/transactionDetails",schemaPath:"#/$defs/TransactionDetailsInputaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs17 === 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;}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.transactions !== undefined){let data0 = data.transactions;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'201', Document> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).post(`documents`, { + this.buildClient(auth).post('documents', { headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: Document, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete document */ - public async deleteDocumentById({ + public deleteDocumentById({ path, auth = [['apiKey'], ['basic']], - }: { - path: { documentId: string } - auth?: string[][] | string[] - }) { + }: { path: { documentId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`documents/${path.documentId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Download document */ - public async downloadDocumentById({ + public downloadDocumentById({ path, auth = [['apiKey'], ['basic']], - }: { - path: { documentId: string } - auth?: string[][] | string[] - }) { - return this.awaitResponse(this.buildClient(auth).get(`documents/${path.documentId}`, {}), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - }) + }: { path: { documentId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + return this.awaitResponse( + this.buildClient(auth).get(`documents/${path.documentId}`, { + responseType: 'text', + }), + { + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Get all documents' metadata */ - public async getDocumentsByEntityId({ + public getDocumentsByEntityId({ query, auth = [['apiKey'], ['basic']], }: { query?: { offset?: string; limit?: string; paginationDetails?: string; entity: string; ownerKey: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetDocumentsByEntityIdResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`documents/documentsMetadata`, { + this.buildClient(auth).get('documents/documentsMetadata', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -132,40 +186,48 @@ export class MambuDocuments { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -192,24 +254,52 @@ export class MambuDocuments { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/documents/rest.type.ts b/src/documents/rest.type.ts index 48a3586..2a7c4d1 100644 --- a/src/documents/rest.type.ts +++ b/src/documents/rest.type.ts @@ -3,8 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +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' /** * Holds information regarding the documents uploaded as attachments @@ -13,19 +17,19 @@ export interface Document { /** * The creation date of the document, stored as UTC */ - creationDate?: string + creationDate?: string | undefined /** * The document encodedKey */ - encodedKey?: string + encodedKey?: string | undefined /** * The original file name of the document */ - fileName?: string + fileName?: string | undefined /** * The file size of the document */ - fileSize?: number + fileSize?: number | undefined /** * The document id */ @@ -33,11 +37,11 @@ export interface Document { /** * The last modified date of the document, stored as UTC */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * Location where the document can be found, eg /myfiles/mypicture.jpeg */ - location?: string + location?: string | undefined /** * The name of the document */ @@ -45,11 +49,11 @@ export interface Document { /** * Detailed notes about the document */ - notes?: string + notes?: string | undefined /** * Represents the holder of this document. If null, means nobody is the owner of this document */ - ownerKey?: string + ownerKey?: string | undefined /** * Determines the owner type of the document */ @@ -66,6 +70,7 @@ export interface Document { | 'ID_DOCUMENT' | 'LINE_OF_CREDIT' | 'GL_JOURNAL_ENTRY' + | undefined /** * The extension of the document */ @@ -73,7 +78,7 @@ export interface Document { } export const Document = { - validate: (await import('./schemas/document.schema.js')).validate as ValidateFunction, + validate: DocumentValidator as ValidateFunction, get schema() { return Document.validate.schema }, @@ -81,14 +86,20 @@ export const Document = { return Document.validate.errors ?? undefined }, is: (o: unknown): o is Document => Document.validate(o) === true, + parse: (o: unknown): { right: Document } | { left: DefinedError[] } => { + if (Document.is(o)) { + return { right: o } + } + return { left: (Document.errors ?? []) as DefinedError[] } + }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -96,18 +107,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetDocumentsByEntityIdResponse = Document[] export const GetDocumentsByEntityIdResponse = { - validate: (await import('./schemas/get-documents-by-entity-id-response.schema.js')) - .validate as ValidateFunction, + validate: GetDocumentsByEntityIdResponseValidator as ValidateFunction, get schema() { return GetDocumentsByEntityIdResponse.validate.schema }, @@ -115,10 +126,16 @@ export const GetDocumentsByEntityIdResponse = { return GetDocumentsByEntityIdResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetDocumentsByEntityIdResponse => GetDocumentsByEntityIdResponse.validate(o) === true, + parse: (o: unknown): { right: GetDocumentsByEntityIdResponse } | { left: DefinedError[] } => { + if (GetDocumentsByEntityIdResponse.is(o)) { + return { right: o } + } + return { left: (GetDocumentsByEntityIdResponse.errors ?? []) as DefinedError[] } + }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/documents/schemas/document.schema.js b/src/documents/schemas/document.schema.js index de15b34..9503090 100644 --- a/src/documents/schemas/document.schema.js +++ b/src/documents/schemas/document.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"Document","type":"object","description":"Holds information regarding the documents uploaded as attachments","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the document, stored as UTC","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The document encodedKey"},"fileName":{"type":"string","title":"fileName","description":"The original file name of the document"},"fileSize":{"type":"integer","title":"fileSize","description":"The file size of the document"},"id":{"type":"integer","title":"id","description":"The document id"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last modified date of the document, stored as UTC","format":"date-time"},"location":{"type":"string","title":"location","description":"Location where the document can be found, eg /myfiles/mypicture.jpeg"},"name":{"type":"string","title":"name","description":"The name of the document"},"notes":{"type":"string","title":"notes","description":"Detailed notes about the document"},"ownerKey":{"type":"string","title":"ownerKey","description":"Represents the holder of this document. If null, means nobody is the owner of this document"},"ownerType":{"title":"ownerType","description":"Determines the owner type 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"]},"type":{"type":"string","title":"type","description":"The extension of the document"}},"required":["id","name","type"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.id === undefined) && (missing0 = "id")) || ((data.name === undefined) && (missing0 = "name"))) || ((data.type === undefined) && (missing0 = "type"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.creationDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){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 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs4 = 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 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.fileName !== undefined){const _errs6 = errors;if(typeof data.fileName !== "string"){validate10.errors = [{instancePath:instancePath+"/fileName",schemaPath:"#/properties/fileName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fileSize !== undefined){let data3 = data.fileSize;const _errs8 = errors;if(!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))){validate10.errors = [{instancePath:instancePath+"/fileSize",schemaPath:"#/properties/fileSize/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){let data4 = data.id;const _errs10 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){const _errs12 = errors;if(errors === _errs12){if(errors === _errs12){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 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.location !== undefined){const _errs14 = errors;if(typeof data.location !== "string"){validate10.errors = [{instancePath:instancePath+"/location",schemaPath:"#/properties/location/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs16 = 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 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs18 = 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 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.ownerKey !== undefined){const _errs20 = errors;if(typeof data.ownerKey !== "string"){validate10.errors = [{instancePath:instancePath+"/ownerKey",schemaPath:"#/properties/ownerKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.ownerType !== undefined){const _errs22 = 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 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.type !== undefined){const _errs23 = errors;if(typeof data.type !== "string"){validate10.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs23 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"Document","type":"object","description":"Holds information regarding the documents uploaded as attachments","properties":{"creationDate":{"type":"string","description":"The creation date of the document, stored as UTC","format":"date-time"},"encodedKey":{"type":"string","description":"The document encodedKey"},"fileName":{"type":"string","description":"The original file name of the document"},"fileSize":{"type":"integer","description":"The file size of the document"},"id":{"type":"integer","description":"The document id"},"lastModifiedDate":{"type":"string","description":"The last modified date of the document, stored as UTC","format":"date-time"},"location":{"type":"string","description":"Location where the document can be found, eg /myfiles/mypicture.jpeg"},"name":{"type":"string","description":"The name of the document"},"notes":{"type":"string","description":"Detailed notes about the document"},"ownerKey":{"type":"string","description":"Represents the holder of this document. If null, means nobody is the owner of this document"},"ownerType":{"description":"Determines the owner type 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"]},"type":{"type":"string","description":"The extension of the document"}},"required":["id","name","type"],"additionalProperties":true};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];const func0 = require("ajv/dist/runtime/equal").default;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.id === undefined) && (missing0 = "id")) || ((data.name === undefined) && (missing0 = "name"))) || ((data.type === undefined) && (missing0 = "type"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.creationDate !== undefined){let data0 = data.creationDate;const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(typeof data0 === "string"){if(!(formats0.validate(data0))){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/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"){validate10.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.fileName !== undefined){const _errs6 = errors;if(typeof data.fileName !== "string"){validate10.errors = [{instancePath:instancePath+"/fileName",schemaPath:"#/properties/fileName/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fileSize !== undefined){let data3 = data.fileSize;const _errs8 = errors;if(!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))){validate10.errors = [{instancePath:instancePath+"/fileSize",schemaPath:"#/properties/fileSize/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){let data4 = data.id;const _errs10 = errors;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){let data5 = data.lastModifiedDate;const _errs12 = errors;if(errors === _errs12){if(errors === _errs12){if(typeof data5 === "string"){if(!(formats0.validate(data5))){validate10.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.location !== undefined){const _errs14 = errors;if(typeof data.location !== "string"){validate10.errors = [{instancePath:instancePath+"/location",schemaPath:"#/properties/location/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs16 = 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 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs18 = 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 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.ownerKey !== undefined){const _errs20 = errors;if(typeof data.ownerKey !== "string"){validate10.errors = [{instancePath:instancePath+"/ownerKey",schemaPath:"#/properties/ownerKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.ownerType !== undefined){const _errs22 = 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 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.type !== undefined){const _errs23 = errors;if(typeof data.type !== "string"){validate10.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs23 === 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/documents/schemas/error-response.schema.js b/src/documents/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/documents/schemas/error-response.schema.js +++ b/src/documents/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/endofdayprocessing.yaml`, { + this.buildClient(auth).get('configuration/endofdayprocessing.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update end of day processing configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/endofdayprocessing.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/endofdayprocessing.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +166,52 @@ export class MambuEndOfDayProcessingConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/funding-sources/index.ts b/src/funding-sources/index.ts index 56e4e15..7c8aa9f 100644 --- a/src/funding-sources/index.ts +++ b/src/funding-sources/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuFundingSources } from './rest.client.js' export * as fundingSources from './rest.type.js' diff --git a/src/funding-sources/rest.client.ts b/src/funding-sources/rest.client.ts index 380739e..73afa08 100644 --- a/src/funding-sources/rest.client.ts +++ b/src/funding-sources/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ErrorResponse, SellFundingSourceAction, SellResponse } from './rest.type.js' /** @@ -46,7 +49,7 @@ export class MambuFundingSources { /** * 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 async sell({ + public sell({ body, path, headers, @@ -54,10 +57,28 @@ export class MambuFundingSources { }: { body: SellFundingSourceAction path: { fundingSourceId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(SellFundingSourceAction, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', SellResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(SellFundingSourceAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`fundingsources/${path.fundingSourceId}:sell`, { @@ -66,51 +87,72 @@ export class MambuFundingSources { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: SellResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -137,24 +179,52 @@ export class MambuFundingSources { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/funding-sources/rest.type.ts b/src/funding-sources/rest.type.ts index bd29e34..fd56b4c 100644 --- a/src/funding-sources/rest.type.ts +++ b/src/funding-sources/rest.type.ts @@ -3,8 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as SellFundingSourceActionValidator } from './schemas/sell-funding-source-action.schema.js' +import { validate as SellResponseValidator } from './schemas/sell-response.schema.js' /** * The account currency and identification @@ -13,8 +17,8 @@ export interface AccountDetails { /** * The currency of the account */ - currency?: string - identification?: AccountIdentification + currency?: string | undefined + identification?: AccountIdentification | undefined } /** @@ -24,15 +28,15 @@ export interface AccountIdentification { /** * The account unique identifier */ - iban?: string - other?: OtherAccountIdentification + iban?: string | undefined + other?: OtherAccountIdentification | undefined } /** * The agent details for a party */ export interface Agent { - financialInstitutionIdentification?: FinancialInstitutionIdentification + financialInstitutionIdentification?: FinancialInstitutionIdentification | undefined } /** @@ -42,31 +46,31 @@ export interface CardAcceptor { /** * The city in which the card acceptor has the business. */ - city?: string + city?: string | undefined /** * The country in which the card acceptor has the business. */ - country?: string + country?: string | undefined /** * The Merchant Category Code of the card acceptor. */ - mcc?: number + mcc?: number | undefined /** * The name of the card acceptor. */ - name?: string + name?: string | undefined /** * The state in which the card acceptor has the business. */ - state?: string + state?: string | undefined /** * The street in which the card acceptor has the business. */ - street?: string + street?: string | undefined /** * The ZIP code of the location in which the card acceptor has the business. */ - zip?: string + zip?: string | undefined } /** @@ -81,23 +85,23 @@ export interface CardTransaction { * The amount of money to be withdrawn in the financial transaction. */ amount: number - cardAcceptor?: CardAcceptor + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * 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. */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external authorization hold reference ID, which relates this card transaction to a previous authorization hold. */ - externalAuthorizationReferenceId?: string + externalAuthorizationReferenceId?: string | undefined /** * The external reference ID to be used to reference the card transaction in subsequent requests. */ @@ -105,7 +109,7 @@ export interface CardTransaction { /** * The formatted time at which the user made this card transaction. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } /** @@ -115,15 +119,15 @@ export interface CreditorReferenceInformation { /** * The reference information of the creditor's underlying documents */ - reference?: string + reference?: string | undefined /** * The entity that assigns the reference type */ - referenceIssuer?: string + referenceIssuer?: string | undefined /** * The type of creditor reference */ - referenceType?: string + referenceType?: string | undefined } /** @@ -133,39 +137,39 @@ export interface DepositAffectedAmounts { /** * Amount of fees involved in a transaction that affects an account with positive balance */ - feesAmount?: number + feesAmount?: number | undefined /** * In the case of an LOAN_FRACTION_BOUGHT this represent the fraction amount which was bought from another investor */ - fractionAmount?: number + fractionAmount?: number | undefined /** * Balance change amount involved in a transaction that affects an account with positive balance */ - fundsAmount?: number + fundsAmount?: number | undefined /** * Amount of interest involved in a transaction that affects an account with positive balance */ - interestAmount?: number + interestAmount?: number | undefined /** * The amount of money that was added/subtracted from the account by this transaction as overdraft */ - overdraftAmount?: number + overdraftAmount?: number | undefined /** * Fees amount involved in a transaction that affects an overdraft */ - overdraftFeesAmount?: number + overdraftFeesAmount?: number | undefined /** * Interest amount involved in a transaction that affects an overdraft */ - overdraftInterestAmount?: number + overdraftInterestAmount?: number | undefined /** * The amount of money that was added/subtracted from the account by this transaction as technical overdraft */ - technicalOverdraftAmount?: number + technicalOverdraftAmount?: number | undefined /** * The amount of money that was added/subtracted from the account by this transaction as technical overdraft interest */ - technicalOverdraftInterestAmount?: number + technicalOverdraftInterestAmount?: number | undefined } /** @@ -175,11 +179,11 @@ export interface DepositFee { /** * The amount of the fee that was applied/paid in the transaction for the given predefined fee. */ - amount?: number + amount?: number | undefined /** * The name of the predefined fee */ - name?: string + name?: string | undefined /** * The encoded key of the predefined fee, auto generated, unique */ @@ -187,11 +191,11 @@ export interface DepositFee { /** * The amount of the taxes on fee that was applied/paid in the transaction. */ - taxAmount?: number + taxAmount?: number | undefined /** * Shows the event that will trigger a fee */ - trigger?: 'MANUAL' | 'MONTHLY_FEE' | 'ARBITRARY' + trigger?: 'MANUAL' | 'MONTHLY_FEE' | 'ARBITRARY' | undefined } /** @@ -201,19 +205,19 @@ export interface DepositInterestAccruedAmounts { /** * The amount of positive interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - interestAccrued?: number + interestAccrued?: number | undefined /** * The amount of negative interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - negativeInterestAccrued?: number + negativeInterestAccrued?: number | undefined /** * The amount of overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - overdraftInterestAccrued?: number + overdraftInterestAccrued?: number | undefined /** * The amount of technical overdraft interest accrued since last interest application/activation date and applied within Interest Applied transaction */ - technicalOverdraftInterestAccrued?: number + technicalOverdraftInterestAccrued?: number | undefined } /** @@ -223,11 +227,11 @@ export interface DepositOverdraftInterestSettings { /** * The value of the index interest rate set or changed in this transaction */ - indexInterestRate?: number + indexInterestRate?: number | undefined /** * The interest rate that was set or changed in this transaction. Used on product interest rate changes or interest tier switches */ - interestRate?: number + interestRate?: number | undefined } /** @@ -237,7 +241,7 @@ export interface DepositOverdraftSettings { /** * The overdraft limit that was set or changed in this transaction */ - overdraftLimit?: number + overdraftLimit?: number | undefined } /** @@ -247,107 +251,107 @@ export interface DepositTaxes { /** * The tax rate that was set or changed in this transaction */ - taxRate?: number + taxRate?: number | undefined } /** * The deposit transaction terms */ export interface DepositTerms { - interestSettings?: DepositTransactionInterestSettings - overdraftInterestSettings?: DepositOverdraftInterestSettings - overdraftSettings?: DepositOverdraftSettings + interestSettings?: DepositTransactionInterestSettings | undefined + overdraftInterestSettings?: DepositOverdraftInterestSettings | undefined + overdraftSettings?: DepositOverdraftSettings | undefined } /** * Represents the action performed on an Deposit Account after which the account's amount changes its value. */ export interface DepositTransaction { - accountBalances?: DepositTransactionBalances + accountBalances?: DepositTransactionBalances | undefined /** * The key of the deposit transaction where the adjustment for this transaction was made (if any adjustment was involved) */ - adjustmentTransactionKey?: string - affectedAmounts?: DepositAffectedAmounts + adjustmentTransactionKey?: string | undefined + affectedAmounts?: DepositAffectedAmounts | undefined /** * How much was added/removed in account */ - amount?: number + amount?: number | undefined /** * The block fund id associated with the transaction */ - blockId?: string + blockId?: string | undefined /** * The date when corresponding JE is booked (as Organization Time) */ - bookingDate?: string + bookingDate?: string | undefined /** * The branch where the transaction was performed */ - branchKey?: string - cardTransaction?: CardTransaction + branchKey?: string | undefined + cardTransaction?: CardTransaction | undefined /** * The center where the transaction was performed */ - centreKey?: string + centreKey?: string | undefined /** * The date when this deposit transaction was created */ - creationDate?: string + creationDate?: string | undefined /** * The currency in which this transaction was posted */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the deposit transaction, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external id of the deposit transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * All the amounts that have been applied or paid within this transaction and involved predefined fees */ - fees?: DepositFee[] + fees?: DepositFee[] | undefined /** * The external id of an account authorization hold */ - holdExternalReferenceId?: string + holdExternalReferenceId?: string | undefined /** * The id of the deposit transaction, auto generated, unique */ - id?: string - interestAccruedAmounts?: DepositInterestAccruedAmounts + id?: string | undefined + interestAccruedAmounts?: DepositInterestAccruedAmounts | undefined /** * The migration event encoded key associated with this deposit account. If this account was imported, track which 'migration event' they came from */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * Extra notes about this deposit transaction */ - notes?: string + notes?: string | undefined /** * The encodedKey of the transaction that was adjusted as part of this one. Available only for adjustment transactions */ - originalTransactionKey?: string + originalTransactionKey?: string | undefined /** * The key of the parent deposit account */ - parentAccountKey?: string - paymentDetails?: PaymentDetails + parentAccountKey?: string | undefined + paymentDetails?: PaymentDetails | undefined /** * The payment order id of the deposit transaction, customizable */ - paymentOrderId?: string - taxes?: DepositTaxes - terms?: DepositTerms + paymentOrderId?: string | undefined + taxes?: DepositTaxes | undefined + terms?: DepositTerms | undefined /** * The till key associated with this transaction */ - tillKey?: string - transactionDetails?: TransactionDetails - transferDetails?: TransferDetails + tillKey?: string | undefined + transactionDetails?: TransactionDetails | undefined + transferDetails?: TransferDetails | undefined /** * The type of the deposit transaction */ @@ -385,14 +389,15 @@ export interface DepositTransaction { | 'LOAN_FRACTION_SOLD' | 'LOAN_FRACTION_SOLD_ADJUSTMENT' | 'SEIZED_AMOUNT' + | undefined /** * The person that performed the transaction */ - userKey?: string + userKey?: string | undefined /** * Date of the entry (eg date of repayment or disbursal, etc.) (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } /** @@ -402,7 +407,7 @@ export interface DepositTransactionBalances { /** * The running balance owed by deposit */ - totalBalance?: number + totalBalance?: number | undefined } /** @@ -412,19 +417,19 @@ export interface DepositTransactionInterestSettings { /** * The value of the index interest rate set or changed in this transaction */ - indexInterestRate?: number + indexInterestRate?: number | undefined /** * The interest rate for the deposit account */ - interestRate?: number + interestRate?: number | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -432,10 +437,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -446,7 +452,7 @@ export interface FinancialInstitutionIdentification { /** * Business identifier code */ - bic?: string + bic?: string | undefined } /** @@ -460,7 +466,7 @@ export interface FundingSourcePurchase { /** * The buyer funding account (savings account) key */ - depositAccountKey?: string + depositAccountKey?: string | undefined /** * The price paid for the amount */ @@ -474,11 +480,11 @@ export interface OtherAccountIdentification { /** * The identification of the payer/payee */ - identification?: string + identification?: string | undefined /** * The identification scheme */ - scheme?: string + scheme?: string | undefined } /** @@ -488,22 +494,22 @@ export interface Party { /** * The name of the party */ - name?: string + name?: string | undefined } /** * The payment information including account identification details */ export interface PaymentDetails { - creditor?: Party - creditorAccount?: AccountDetails - creditorAgent?: Agent - debtor?: Party - debtorAccount?: AccountDetails - debtorAgent?: Agent - paymentIdentification?: PaymentIdentification - paymentTypeInformation?: PaymentTypeInformation - remittanceInformation?: RemittanceInformation + creditor?: Party | undefined + creditorAccount?: AccountDetails | undefined + creditorAgent?: Agent | undefined + debtor?: Party | undefined + debtorAccount?: AccountDetails | undefined + debtorAgent?: Agent | undefined + paymentIdentification?: PaymentIdentification | undefined + paymentTypeInformation?: PaymentTypeInformation | undefined + remittanceInformation?: RemittanceInformation | undefined } /** @@ -513,39 +519,39 @@ export interface PaymentIdentification { /** * Identifier assigned by the initiating party to the transaction */ - endToEndIdentification?: string + endToEndIdentification?: string | undefined /** * Identifier of a payment instruction */ - instructionIdentification?: string + instructionIdentification?: string | undefined /** * Identifier unique for a period assigned by the first initiating party to the transaction */ - transactionIdentification?: string + transactionIdentification?: string | undefined } /** * The information specifying the type of transaction */ export interface PaymentTypeInformation { - serviceLevel?: ServiceLevel + serviceLevel?: ServiceLevel | undefined } /** * The information specifying the payment items that are intended to settle */ export interface RemittanceInformation { - structured?: Structured + structured?: Structured | undefined /** * Information supplied to match the items of the payment in an unstructured form */ - unstructured?: string + unstructured?: string | undefined } export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -555,12 +561,11 @@ export interface SellFundingSourceAction { /** * Funding source purchase list */ - purchases?: FundingSourcePurchase[] + purchases?: FundingSourcePurchase[] | undefined } export const SellFundingSourceAction = { - validate: (await import('./schemas/sell-funding-source-action.schema.js')) - .validate as ValidateFunction, + validate: SellFundingSourceActionValidator as ValidateFunction, get schema() { return SellFundingSourceAction.validate.schema }, @@ -568,17 +573,18 @@ export const SellFundingSourceAction = { return SellFundingSourceAction.validate.errors ?? undefined }, is: (o: unknown): o is SellFundingSourceAction => SellFundingSourceAction.validate(o) === true, - assert: (o: unknown) => { - if (!SellFundingSourceAction.validate(o)) { - throw new ValidationError(SellFundingSourceAction.errors ?? []) + parse: (o: unknown): { right: SellFundingSourceAction } | { left: DefinedError[] } => { + if (SellFundingSourceAction.is(o)) { + return { right: o } } + return { left: (SellFundingSourceAction.errors ?? []) as DefinedError[] } }, } as const export type SellResponse = DepositTransaction[] export const SellResponse = { - validate: (await import('./schemas/sell-response.schema.js')).validate as ValidateFunction, + validate: SellResponseValidator as ValidateFunction, get schema() { return SellResponse.validate.schema }, @@ -586,6 +592,12 @@ export const SellResponse = { return SellResponse.validate.errors ?? undefined }, is: (o: unknown): o is SellResponse => SellResponse.validate(o) === true, + parse: (o: unknown): { right: SellResponse } | { left: DefinedError[] } => { + if (SellResponse.is(o)) { + return { right: o } + } + return { left: (SellResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -595,14 +607,14 @@ export interface ServiceLevel { /** * The code for a pre-agreed service or level of service between the parties */ - code?: string + code?: string | undefined } /** * The information specifying the payment items that are intended to settle */ export interface Structured { - creditorReferenceInformation?: CreditorReferenceInformation + creditorReferenceInformation?: CreditorReferenceInformation | undefined } /** @@ -612,11 +624,11 @@ export interface TransactionDetails { /** * The id of the transaction channel associated with the transaction details. */ - transactionChannelId?: string + transactionChannelId?: string | undefined /** * The encoded key of the transaction channel associated with the transaction details. */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } /** @@ -626,9 +638,9 @@ export interface TransferDetails { /** * The key of the related deposit transaction */ - linkedDepositTransactionKey?: string + linkedDepositTransactionKey?: string | undefined /** * The key of the related loan transaction */ - linkedLoanTransactionKey?: string + linkedLoanTransactionKey?: string | undefined } diff --git a/src/funding-sources/schemas/error-response.schema.js b/src/funding-sources/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/funding-sources/schemas/error-response.schema.js +++ b/src/funding-sources/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'201', CreateResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CreateRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`glaccounts`, { + this.buildClient(auth).post('glaccounts', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: CreateResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get general ledger accounts */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { @@ -92,9 +109,21 @@ export class MambuGeneralLedgerAccounts { balanceExcluded?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`glaccounts`, { + this.buildClient(auth).get('glaccounts', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -104,14 +133,14 @@ export class MambuGeneralLedgerAccounts { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get general ledger account */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], @@ -119,7 +148,20 @@ export class MambuGeneralLedgerAccounts { path: { glAccountId: string } query?: { from?: string; to?: string; branchId?: string; balanceExcluded?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GLAccount> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`glaccounts/${path.glAccountId}`, { searchParams: query ?? {}, @@ -132,75 +174,108 @@ export class MambuGeneralLedgerAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update an existing general ledger account */ - public async patch({ + public patch({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: PatchRequest - path: { glAccountId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }: { body: PatchRequest; path: { glAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`glaccounts/${path.glAccountId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -227,24 +302,52 @@ export class MambuGeneralLedgerAccounts { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/general-ledger-accounts/rest.type.ts b/src/general-ledger-accounts/rest.type.ts index 77e01d6..21b871a 100644 --- a/src/general-ledger-accounts/rest.type.ts +++ b/src/general-ledger-accounts/rest.type.ts @@ -3,13 +3,20 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as CreateRequestValidator } from './schemas/create-request.schema.js' +import { validate as CreateResponseValidator } from './schemas/create-response.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' +import { validate as GLAccountValidator } from './schemas/gl-account.schema.js' +import { validate as PatchRequestValidator } from './schemas/patch-request.schema.js' export type CreateRequest = GLAccountInput[] export const CreateRequest = { - validate: (await import('./schemas/create-request.schema.js')).validate as ValidateFunction, + validate: CreateRequestValidator as ValidateFunction, get schema() { return CreateRequest.validate.schema }, @@ -17,17 +24,18 @@ export const CreateRequest = { return CreateRequest.validate.errors ?? undefined }, is: (o: unknown): o is CreateRequest => CreateRequest.validate(o) === true, - assert: (o: unknown) => { - if (!CreateRequest.validate(o)) { - throw new ValidationError(CreateRequest.errors ?? []) + parse: (o: unknown): { right: CreateRequest } | { left: DefinedError[] } => { + if (CreateRequest.is(o)) { + return { right: o } } + return { left: (CreateRequest.errors ?? []) as DefinedError[] } }, } as const export type CreateResponse = GLAccount[] export const CreateResponse = { - validate: (await import('./schemas/create-response.schema.js')).validate as ValidateFunction, + validate: CreateResponseValidator as ValidateFunction, get schema() { return CreateResponse.validate.schema }, @@ -35,6 +43,12 @@ export const CreateResponse = { return CreateResponse.validate.errors ?? undefined }, is: (o: unknown): o is CreateResponse => CreateResponse.validate(o) === true, + parse: (o: unknown): { right: CreateResponse } | { left: DefinedError[] } => { + if (CreateResponse.is(o)) { + return { right: o } + } + return { left: (CreateResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -228,23 +242,25 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -252,17 +268,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = GLAccount[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -270,6 +287,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -279,60 +302,60 @@ export interface GLAccount { /** * `TRUE` if the account is activated and may be used, `FALSE` otherwise. */ - activated?: boolean + activated?: boolean | undefined /** * `TRUE` if manual journal entries are allowed, `FALSE` otherwise. */ - allowManualJournalEntries?: boolean + allowManualJournalEntries?: boolean | undefined /** * The balance of the general ledger account, which is only populated for the GET /glaccounts endpoint. */ - balance?: number + balance?: number | undefined /** * The creation date for this account, which is stored as UTC. */ - creationDate?: string - currency?: Currency + creationDate?: string | undefined + currency?: Currency | undefined /** * A description of the general ledger account. */ - description?: string + description?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The general ledger code used to identify different account types. Also used for grouping and categorizing accounts. For example: an account code of '3201' is considered a subtype of '3200'. */ - glCode?: string + glCode?: string | undefined /** * The last modification date and time, which is stored as UTC. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The data migration event key if the general ledger account was created as a part of a data migration event. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * The name of the general ledger account. */ - name?: string + name?: string | undefined /** * `TRUE` if trailing zeros are stripped, `FALSE` otherwise. */ - stripTrailingZeros?: boolean + stripTrailingZeros?: boolean | undefined /** * The general ledger account type. */ - type?: 'ASSET' | 'LIABILITY' | 'EQUITY' | 'INCOME' | 'EXPENSE' + type?: 'ASSET' | 'LIABILITY' | 'EQUITY' | 'INCOME' | 'EXPENSE' | undefined /** * The usage type of the general ledger account. `DETAIL` accounts are used to stores transaction balances. `HEADER` accounts are used to organise and group detail accounts for reporting purposes. */ - usage?: 'DETAIL' | 'HEADER' + usage?: 'DETAIL' | 'HEADER' | undefined } export const GLAccount = { - validate: (await import('./schemas/gl-account.schema.js')).validate as ValidateFunction, + validate: GLAccountValidator as ValidateFunction, get schema() { return GLAccount.validate.schema }, @@ -340,6 +363,12 @@ export const GLAccount = { return GLAccount.validate.errors ?? undefined }, is: (o: unknown): o is GLAccount => GLAccount.validate(o) === true, + parse: (o: unknown): { right: GLAccount } | { left: DefinedError[] } => { + if (GLAccount.is(o)) { + return { right: o } + } + return { left: (GLAccount.errors ?? []) as DefinedError[] } + }, } as const /** @@ -349,12 +378,12 @@ export interface GLAccountInput { /** * `TRUE` if manual journal entries are allowed, `FALSE` otherwise. This is only available for Detail Accounts. */ - allowManualJournalEntries?: boolean - currency?: Currency + allowManualJournalEntries?: boolean | undefined + currency?: Currency | undefined /** * The description of the general ledger account. */ - description?: string + description?: string | undefined /** * The general ledger code used to identify different account types. Also used for grouping and categorizing accounts. For example: an account code of '3201' is considered a subtype of '3200'. */ @@ -366,7 +395,7 @@ export interface GLAccountInput { /** * `TRUE` to strip trailing zeros, `FALSE` otherwise. Only available for Header Accounts. */ - stripTrailingZeros?: boolean + stripTrailingZeros?: boolean | undefined /** * The general ledger account type. */ @@ -384,7 +413,7 @@ export interface PatchOperation { /** * The field from where a value should be moved, when using move */ - from?: string + from?: string | undefined /** * The change to perform */ @@ -396,15 +425,13 @@ export interface PatchOperation { /** * The value of the field, can be null */ - value?: { - [k: string]: unknown | undefined - } + value?: unknown } export type PatchRequest = PatchOperation[] export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, + validate: PatchRequestValidator as ValidateFunction, get schema() { return PatchRequest.validate.schema }, @@ -412,15 +439,16 @@ export const PatchRequest = { return PatchRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/general-ledger-accounts/schemas/create-request.schema.js b/src/general-ledger-accounts/schemas/create-request.schema.js index 22c1772..2a66972 100644 --- a/src/general-ledger-accounts/schemas/create-request.schema.js +++ b/src/general-ledger-accounts/schemas/create-request.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"createRequest","type":"array","items":{"$ref":"#/$defs/GLAccountInputaf30"},"$defs":{"GLAccountInputaf30":{"type":"object","title":"GLAccountInputaf30","description":"Represents the request payload for creating a GL Account","properties":{"allowManualJournalEntries":{"type":"boolean","title":"allowManualJournalEntries","description":"`TRUE` if manual journal entries are allowed, `FALSE` otherwise. This is only available for Detail Accounts."},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"description":{"type":"string","title":"description","description":"The description of the general ledger account."},"glCode":{"type":"string","title":"glCode","description":"The general ledger code used to identify different account types. Also used for grouping and categorizing accounts. For example: an account code of '3201' is considered a subtype of '3200'."},"name":{"type":"string","title":"name","description":"The name of the general ledger account."},"stripTrailingZeros":{"type":"boolean","title":"stripTrailingZeros","description":"`TRUE` to strip trailing zeros, `FALSE` otherwise. Only available for Header Accounts."},"type":{"title":"type","description":"The general ledger account type.","enum":["ASSET","LIABILITY","EQUITY","INCOME","EXPENSE"]},"usage":{"title":"usage","description":"`DETAIL` for general ledger accounts that log transactions, and `HEADER` for general ledger accounts used for reporting and organizational purposes.","enum":["DETAIL","HEADER"]}},"required":["glCode","name","type","usage"],"additionalProperties":true},"Currencyaf30":{"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"GLAccountInputaf30","description":"Represents the request payload for creating a GL Account","properties":{"allowManualJournalEntries":{"type":"boolean","title":"allowManualJournalEntries","description":"`TRUE` if manual journal entries are allowed, `FALSE` otherwise. This is only available for Detail Accounts."},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"description":{"type":"string","title":"description","description":"The description of the general ledger account."},"glCode":{"type":"string","title":"glCode","description":"The general ledger code used to identify different account types. Also used for grouping and categorizing accounts. For example: an account code of '3201' is considered a subtype of '3200'."},"name":{"type":"string","title":"name","description":"The name of the general ledger account."},"stripTrailingZeros":{"type":"boolean","title":"stripTrailingZeros","description":"`TRUE` to strip trailing zeros, `FALSE` otherwise. Only available for Header Accounts."},"type":{"title":"type","description":"The general ledger account type.","enum":["ASSET","LIABILITY","EQUITY","INCOME","EXPENSE"]},"usage":{"title":"usage","description":"`DETAIL` for general ledger accounts that log transactions, and `HEADER` for general ledger accounts used for reporting and organizational purposes.","enum":["DETAIL","HEADER"]}},"required":["glCode","name","type","usage"],"additionalProperties":true};const schema13 = {"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.glCode === undefined) && (missing0 = "glCode")) || ((data.name === undefined) && (missing0 = "name"))) || ((data.type === undefined) && (missing0 = "type"))) || ((data.usage === undefined) && (missing0 = "usage"))){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.allowManualJournalEntries !== undefined){const _errs2 = errors;if(typeof data.allowManualJournalEntries !== "boolean"){validate11.errors = [{instancePath:instancePath+"/allowManualJournalEntries",schemaPath:"#/properties/allowManualJournalEntries/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.currency !== undefined){let data1 = data.currency;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.code !== undefined){const _errs8 = errors;let valid3;valid3 = false;for(const v0 of schema13.properties.code.enum){if(func0(data1.code, v0)){valid3 = true;break;}}if(!valid3){validate11.errors = [{instancePath:instancePath+"/currency/code",schemaPath:"#/$defs/Currencyaf30/properties/code/enum",keyword:"enum",params:{allowedValues: schema13.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data1.currencyCode !== undefined){const _errs9 = errors;if(typeof data1.currencyCode !== "string"){validate11.errors = [{instancePath:instancePath+"/currency/currencyCode",schemaPath:"#/$defs/Currencyaf30/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs9 === errors;}else {var valid2 = true;}}}else {validate11.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/$defs/Currencyaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.description !== undefined){const _errs11 = errors;if(typeof data.description !== "string"){validate11.errors = [{instancePath:instancePath+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs11 === errors;}else {var valid0 = true;}if(valid0){if(data.glCode !== undefined){const _errs13 = errors;if(typeof data.glCode !== "string"){validate11.errors = [{instancePath:instancePath+"/glCode",schemaPath:"#/properties/glCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs15 = 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 = _errs15 === errors;}else {var valid0 = true;}if(valid0){if(data.stripTrailingZeros !== undefined){const _errs17 = errors;if(typeof data.stripTrailingZeros !== "boolean"){validate11.errors = [{instancePath:instancePath+"/stripTrailingZeros",schemaPath:"#/properties/stripTrailingZeros/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.type !== undefined){const _errs19 = errors;let valid4;valid4 = false;for(const v1 of schema12.properties.type.enum){if(func0(data.type, v1)){valid4 = true;break;}}if(!valid4){validate11.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/enum",keyword:"enum",params:{allowedValues: schema12.properties.type.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs19 === errors;}else {var valid0 = true;}if(valid0){if(data.usage !== undefined){let data9 = data.usage;const _errs20 = errors;if(!((data9 === "DETAIL") || (data9 === "HEADER"))){validate11.errors = [{instancePath:instancePath+"/usage",schemaPath:"#/properties/usage/enum",keyword:"enum",params:{allowedValues: schema12.properties.usage.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs20 === 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;}function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(Array.isArray(data)){var valid0 = true;const len0 = data.length;for(let i0=0; i0 + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`setup/general`, { + this.buildClient(auth).get('setup/general', { headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', }), @@ -56,40 +67,48 @@ export class MambuGeneralSetup { 200: GeneralSetup, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -116,24 +135,52 @@ export class MambuGeneralSetup { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/general-setup/rest.type.ts b/src/general-setup/rest.type.ts index 1209fda..3d91732 100644 --- a/src/general-setup/rest.type.ts +++ b/src/general-setup/rest.type.ts @@ -3,8 +3,11 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GeneralSetupValidator } from './schemas/general-setup.schema.js' /** * Response representation of the dashboard configuration @@ -13,11 +16,11 @@ export interface DashboardConfiguration { /** * The date dashboard configuration was created */ - creationDate?: string + creationDate?: string | undefined /** * The encoded key of the dashboard configuration, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The Dashboard option name */ @@ -30,6 +33,7 @@ export interface DashboardConfiguration { | 'CLIENTS' | 'UPCOMING_REPAYMENTS' | 'NONE' + | undefined } /** @@ -39,11 +43,11 @@ export interface DuplicateFieldConstraint { /** * The check will be performed if the field is true */ - active?: boolean + active?: boolean | undefined /** * The ENUM data field when the field is an ENUM */ - dataField?: string + dataField?: string | undefined /** * The type of the owner (entity) to whom a data field belongs to */ @@ -105,22 +109,25 @@ export interface DuplicateFieldConstraint { | 'ACCOUNT_INTEREST_RATE_SETTINGS' | 'LENDING_ACCOUNT_CONTRACT' | 'REVOLVING_ACCOUNT' + | undefined /** * The encoded key of the duplicate field constraint, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Used for creating an AND clause between constraints */ - groupIndex?: number + groupIndex?: number | undefined } +type EnabledComponents = 'LOANS' | 'DEPOSITS' | 'BRANCHES' | 'CENTRES' | 'CLIENTS' | 'GROUPS' | 'ACCOUNTING' | 'CREDIT_OFFICERS' + export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -128,10 +135,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -142,149 +150,151 @@ export interface GeneralSetup { /** * The accounting cut off time. */ - accountingCutOffTime?: string + accountingCutOffTime?: string | undefined /** * `TRUE` if separate users are required for approval and disbursal, `FALSE` otherwise. */ - approvalDisbursalTwoManRuleEnabled?: boolean + approvalDisbursalTwoManRuleEnabled?: boolean | undefined /** * The number of days that are required before an account can be written off. */ - arrearsDaysBeforeWriteOff?: number + arrearsDaysBeforeWriteOff?: number | undefined /** * The list of required assignments for clients and groups. */ - assignmentConstraints?: GeneralSetupAssignmentConstraintsArray[] + assignmentConstraints?: ('BRANCH' | 'CENTRE' | 'CREDIT_OFFICER' | 'GROUP')[] | undefined /** * The interval (number of days) between the execution of automated accounting closures. If this number is 0, automated closure is performed. */ - automatedAccountingClosuresInterval?: number + automatedAccountingClosuresInterval?: number | undefined /** * The pattern for generating individual client IDs. */ - clientIdFormat?: string + clientIdFormat?: string | undefined /** * The dashboard configuration. */ - dashboardConfigurations?: DashboardConfiguration[] + dashboardConfigurations?: DashboardConfiguration[] | undefined /** * The date (dd-MM-yyyy) or date time (dd-MM-yyyy HH:mm:ss) formats. */ - dateFormats?: { - [k: string]: string - } + dateFormats?: + | { + [k: string]: string | undefined + } + | undefined /** * The symbol used to mark the border between the integral and the fractional parts of a decimal numeral. */ - decimalSeparator?: 'COMMA' | 'POINT' + decimalSeparator?: 'COMMA' | 'POINT' | undefined /** * The client role used as default. */ - defaultClientRoleKey?: string + defaultClientRoleKey?: string | undefined /** * The client default state. */ - defaultClientState?: 'PENDING_APPROVAL' | 'INACTIVE' | 'ACTIVE' | 'EXITED' | 'BLACKLISTED' | 'REJECTED' + defaultClientState?: 'PENDING_APPROVAL' | 'INACTIVE' | 'ACTIVE' | 'EXITED' | 'BLACKLISTED' | 'REJECTED' | undefined /** * The group role used as default. */ - defaultGroupRoleKey?: string + defaultGroupRoleKey?: string | undefined /** * The line of credit default state. */ - defaultLineOfCreditState?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' + defaultLineOfCreditState?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' | undefined /** * The transaction channel that is used as the default. */ - defaultTransactionChannelKey?: string + defaultTransactionChannelKey?: string | undefined /** * The list of duplicate client constraints that are available in the administration and can be performed. */ - duplicateClientChecks?: DuplicateFieldConstraint[] + duplicateClientChecks?: DuplicateFieldConstraint[] | undefined /** * The action to be taken when the duplicate client validation fails. */ - duplicateClientConstraintAction?: 'NONE' | 'WARNING' | 'ERROR' + duplicateClientConstraintAction?: 'NONE' | 'WARNING' | 'ERROR' | undefined /** * The list of all the enabled components for the current tenant. */ - enabledComponents?: GeneralSetupEnabledComponentsArray[] + enabledComponents?: EnabledComponents[] | undefined /** * The encoded key of the general setup, which is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * 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. */ - eodProcessingMethod?: 'AUTOMATIC' | 'MANUAL' + eodProcessingMethod?: 'AUTOMATIC' | 'MANUAL' | undefined /** * The maximum exposure amount. */ - exposureAmount?: number + exposureAmount?: number | undefined /** * The maximum exposure a client can have in outstanding loans at any time. */ - exposureType?: 'UNLIMITED' | 'SUM_OF_LOANS' | 'SUM_OF_LOANS_MINUS_SAVINGS' + exposureType?: 'UNLIMITED' | 'SUM_OF_LOANS' | 'SUM_OF_LOANS_MINUS_SAVINGS' | undefined /** * The pattern for generating group client IDs. */ - groupIdFormat?: string + groupIdFormat?: string | undefined /** * The group size limitation type. */ - groupSizeLimitType?: 'HARD' | 'WARNING' | 'NONE' + groupSizeLimitType?: 'HARD' | 'WARNING' | 'NONE' | undefined /** * The key of the general ledger (GL) account which will be used for inter-branch transfers. */ - interBranchTransferGLAccountKey?: string + interBranchTransferGLAccountKey?: string | undefined /** * The unique pattern after which all the lines of credit IDs should be created. */ - lineOfCreditIdFormat?: string + lineOfCreditIdFormat?: string | undefined /** * The maximum allowed ID document attachments. */ - maxAllowedIdDocumentAttachments?: number + maxAllowedIdDocumentAttachments?: number | undefined /** * The maximum allowed journal entry attachments. */ - maxAllowedJournalEntryDocumentAttachments?: number + maxAllowedJournalEntryDocumentAttachments?: number | undefined /** * The maximum number of days users are allowed to undo of close obligations met for a loan account. */ - maxAllowedUndoClosurePeriod?: number + maxAllowedUndoClosurePeriod?: number | undefined /** * The maximum group size allowed. A null value means the limit is ignored. */ - maxGroupSizeLimit?: number + maxGroupSizeLimit?: number | undefined /** * The minimum group size allowed. A null value means the limit is ignored. */ - minGroupSizeLimit?: number + minGroupSizeLimit?: number | undefined /** * The constraint on whether clients can belong to more than one group or not. */ - multipleGroupMemberships?: 'UNLIMITED' | 'ONE_GROUP' + multipleGroupMemberships?: 'UNLIMITED' | 'ONE_GROUP' | undefined /** * The option that shows if multiple loans are allowed or not. */ - multipleLoans?: 'UNLIMITED' | 'ONE_LOAN' + multipleLoans?: 'UNLIMITED' | 'ONE_LOAN' | undefined /** * `TRUE` if other ID documents are enabled, `FALSE` otherwise. */ - otherIdDocumentsEnabled?: boolean + otherIdDocumentsEnabled?: boolean | undefined /** * The date used when computing overdraft interest for savings accounts. */ - overdraftInterestEodBalanceDate?: string + overdraftInterestEodBalanceDate?: string | undefined /** * The unique pattern after which all the till IDs should be created. */ - tillIdFormat?: string + tillIdFormat?: string | undefined } export const GeneralSetup = { - validate: (await import('./schemas/general-setup.schema.js')).validate as ValidateFunction, + validate: GeneralSetupValidator as ValidateFunction, get schema() { return GeneralSetup.validate.schema }, @@ -292,22 +302,16 @@ export const GeneralSetup = { return GeneralSetup.validate.errors ?? undefined }, is: (o: unknown): o is GeneralSetup => GeneralSetup.validate(o) === true, + parse: (o: unknown): { right: GeneralSetup } | { left: DefinedError[] } => { + if (GeneralSetup.is(o)) { + return { right: o } + } + return { left: (GeneralSetup.errors ?? []) as DefinedError[] } + }, } as const -type GeneralSetupAssignmentConstraintsArray = 'BRANCH' | 'CENTRE' | 'CREDIT_OFFICER' | 'GROUP' - -type GeneralSetupEnabledComponentsArray = - | 'LOANS' - | 'DEPOSITS' - | 'BRANCHES' - | 'CENTRES' - | 'CLIENTS' - | 'GROUPS' - | 'ACCOUNTING' - | 'CREDIT_OFFICERS' - export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/general-setup/schemas/error-response.schema.js b/src/general-setup/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/general-setup/schemas/error-response.schema.js +++ b/src/general-setup/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.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 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/grouprolenames.yaml`, { + this.buildClient(auth).get('configuration/grouprolenames.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update group role names configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/grouprolenames.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/grouprolenames.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +166,52 @@ export class MambuGroupRoleNamesConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/groups/index.ts b/src/groups/index.ts index 0d6a481..03cf4b5 100644 --- a/src/groups/index.ts +++ b/src/groups/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuGroups } from './rest.client.js' export * as groups from './rest.type.js' diff --git a/src/groups/rest.client.ts b/src/groups/rest.client.ts index 5d8ab51..a16188b 100644 --- a/src/groups/rest.client.ts +++ b/src/groups/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ErrorResponse, GetAllResponse, @@ -54,56 +57,84 @@ export class MambuGroups { /** * Create group */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: Group - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(Group, body) + }: { body: Group; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', Group> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Group, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`groups`, { + this.buildClient(auth).post('groups', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: Group, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete group */ - public async delete({ path, auth = [['apiKey'], ['basic']] }: { path: { groupId: string }; auth?: string[][] | string[] }) { + public delete({ + path, + auth = [['apiKey'], ['basic']], + }: { path: { groupId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`groups/${path.groupId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get groups */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { @@ -118,9 +149,21 @@ export class MambuGroups { sortBy?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`groups`, { + this.buildClient(auth).get('groups', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -130,22 +173,31 @@ export class MambuGroups { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get group */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { groupId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { groupId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Group> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`groups/${path.groupId}`, { searchParams: query ?? {}, @@ -158,14 +210,14 @@ export class MambuGroups { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Credit arrangements list returned. */ - public async getCreditArrangementsByGroupIdOrKey({ + public getCreditArrangementsByGroupIdOrKey({ path, query, auth = [['apiKey'], ['basic']], @@ -173,7 +225,20 @@ export class MambuGroups { path: { groupId: string } query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetCreditArrangementsByGroupIdOrKeyResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`groups/${path.groupId}/creditarrangements`, { searchParams: query ?? {}, @@ -186,44 +251,56 @@ export class MambuGroups { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update group */ - public async patch({ + public patch({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: PatchRequest - path: { groupId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }: { body: PatchRequest; path: { groupId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`groups/${path.groupId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Search groups */ - public async search({ + public search({ body, query, auth = [['apiKey'], ['basic']], @@ -231,11 +308,27 @@ export class MambuGroups { body: GroupSearchCriteria query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(GroupSearchCriteria, body) + }): Promise< + | SuccessResponse<'200', SearchResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(GroupSearchCriteria, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`groups:search`, { + this.buildClient(auth).post('groups:search', { json: body, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -246,23 +339,36 @@ export class MambuGroups { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update group */ - public async update({ + public update({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: Group - path: { groupId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(Group, body) + }: { body: Group; path: { groupId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Group> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Group, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`groups/${path.groupId}`, { @@ -276,45 +382,66 @@ export class MambuGroups { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -341,24 +468,52 @@ export class MambuGroups { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/groups/rest.type.ts b/src/groups/rest.type.ts index edaa344..ce457ef 100644 --- a/src/groups/rest.type.ts +++ b/src/groups/rest.type.ts @@ -3,8 +3,16 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +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 GetCreditArrangementsByGroupIdOrKeyResponseValidator } from './schemas/get-credit-arrangements-by-group-id-or-key-response.schema.js' +import { validate as GroupSearchCriteriaValidator } from './schemas/group-search-criteria.schema.js' +import { validate as GroupValidator } from './schemas/group.schema.js' +import { validate as PatchRequestValidator } from './schemas/patch-request.schema.js' +import { validate as SearchResponseValidator } from './schemas/search-response.schema.js' /** * Represents an address. @@ -13,47 +21,47 @@ export interface Address { /** * The city for the address. */ - city?: string + city?: string | undefined /** * The country. */ - country?: string + country?: string | undefined /** * The address encoded key, which is unique and generated. */ - encodedKey?: string + encodedKey?: string | undefined /** * The index of this address in the list of addresses. */ - indexInList?: number + indexInList?: number | undefined /** * The GPS latitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -90 to +90. */ - latitude?: number + latitude?: number | undefined /** * The first line of the address. */ - line1?: string + line1?: string | undefined /** * The second line of the address. */ - line2?: string + line2?: string | undefined /** * The GPS longitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -180 to +180. */ - longitude?: number + longitude?: number | undefined /** * The address parent key indicating the object owning this address. For example: client, centre, or branch. */ - parentKey?: string + parentKey?: string | undefined /** * The post code. */ - postcode?: string + postcode?: string | undefined /** * The region for the address. */ - region?: string + region?: string | undefined } /** @@ -67,28 +75,28 @@ export interface CreditArrangement { /** * The date when the credit arrangement was approved. */ - approvedDate?: string + approvedDate?: string | undefined /** * The available amount of the credit arrangement. */ - availableCreditAmount?: number + availableCreditAmount?: number | undefined /** * The date when the credit arrangement was closed. */ - closedDate?: string + closedDate?: string | undefined /** * The consumed amount of the credit arrangement, which is calculated as the difference between the amount and available amount. */ - consumedCreditAmount?: number + consumedCreditAmount?: number | undefined /** * The date when the credit arrangement was created. */ - creationDate?: string - currency?: Currency + creationDate?: string | undefined + currency?: Currency | undefined /** * The encoded key of the credit arrangement, it is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The date when the credit arrangement expires. */ @@ -96,11 +104,11 @@ export interface CreditArrangement { /** * The type of exposure limit calculation method used for the credit arrangement. */ - exposureLimitType?: 'APPROVED_AMOUNT' | 'OUTSTANDING_AMOUNT' + exposureLimitType?: 'APPROVED_AMOUNT' | 'OUTSTANDING_AMOUNT' | undefined /** * The encoded key of the credit arrangement holder (individual client or group). */ - holderKey?: string + holderKey?: string | undefined /** * The type of the credit arrangement holder (individual client or group). */ @@ -108,15 +116,15 @@ export interface CreditArrangement { /** * The ID of credit arrangement, can be generated and customized, and must be unique. */ - id?: string + id?: string | undefined /** * The last date when the credit arrangement was modified. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The notes or description of the credit arrangement. */ - notes?: string + notes?: string | undefined /** * The start date from which the credit arrangement became active. */ @@ -124,11 +132,11 @@ export interface CreditArrangement { /** * The state of the credit arrangement. */ - state?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' + state?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' | undefined /** * The substate of credit arrangement. */ - subState?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' + subState?: 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'CLOSED' | 'WITHDRAWN' | 'REJECTED' | undefined } /** @@ -322,23 +330,25 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -346,17 +356,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = Group[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -364,13 +375,19 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetCreditArrangementsByGroupIdOrKeyResponse = CreditArrangement[] export const GetCreditArrangementsByGroupIdOrKeyResponse = { - validate: (await import('./schemas/get-credit-arrangements-by-group-id-or-key-response.schema.js')) - .validate as ValidateFunction, + validate: + GetCreditArrangementsByGroupIdOrKeyResponseValidator as ValidateFunction, get schema() { return GetCreditArrangementsByGroupIdOrKeyResponse.validate.schema }, @@ -379,6 +396,12 @@ export const GetCreditArrangementsByGroupIdOrKeyResponse = { }, is: (o: unknown): o is GetCreditArrangementsByGroupIdOrKeyResponse => GetCreditArrangementsByGroupIdOrKeyResponse.validate(o) === true, + parse: (o: unknown): { right: GetCreditArrangementsByGroupIdOrKeyResponse } | { left: DefinedError[] } => { + if (GetCreditArrangementsByGroupIdOrKeyResponse.is(o)) { + return { right: o } + } + return { left: (GetCreditArrangementsByGroupIdOrKeyResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -388,35 +411,35 @@ export interface Group { /** * The addresses associated with this group. */ - addresses?: Address[] + addresses?: Address[] | undefined /** * Key of the branch this group is assigned to. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * Key of the centre this group is assigned to. */ - assignedCentreKey?: string + assignedCentreKey?: string | undefined /** * Key of the user this group is assigned to. */ - assignedUserKey?: string + assignedUserKey?: string | undefined /** * The date the group was created. */ - creationDate?: string + creationDate?: string | undefined /** * The email address associated with the group. */ - emailAddress?: string + emailAddress?: string | undefined /** * The encoded key of the group, which is auto generated, and must be unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The members of this group. */ - groupMembers?: GroupMember[] + groupMembers?: GroupMember[] | undefined /** * The name of the group. */ @@ -424,35 +447,35 @@ export interface Group { /** * A role which describes the intended use of a group in the system. */ - groupRoleKey?: string + groupRoleKey?: string | undefined /** * The home phone number associated with the group. */ - homePhone?: string + homePhone?: string | undefined /** * The ID of the group, which can be generated and customized, but must be unique. */ - id?: string + id?: string | undefined /** * The last date the group was updated. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * Number of paid and closed (with 'obligations met') accounts for this client. When the closing operation is reverted, this is reduced. */ - loanCycle?: number + loanCycle?: number | undefined /** * The migration event encoded key associated with this group. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * The mobile phone number associated with the group. */ - mobilePhone?: string + mobilePhone?: string | undefined /** * Extra notes about this group. */ - notes?: string + notes?: string | undefined /** * The preferred language associated with the group (used for the notifications). */ @@ -474,10 +497,11 @@ export interface Group { | 'THAI' | 'NORWEGIAN' | 'PHRASE' + | undefined } export const Group = { - validate: (await import('./schemas/group.schema.js')).validate as ValidateFunction, + validate: GroupValidator as ValidateFunction, get schema() { return Group.validate.schema }, @@ -485,10 +509,11 @@ export const Group = { return Group.validate.errors ?? undefined }, is: (o: unknown): o is Group => Group.validate(o) === true, - assert: (o: unknown) => { - if (!Group.validate(o)) { - throw new ValidationError(Group.errors ?? []) + parse: (o: unknown): { right: Group } | { left: DefinedError[] } => { + if (Group.is(o)) { + return { right: o } } + return { left: (Group.errors ?? []) as DefinedError[] } }, } as const @@ -561,15 +586,15 @@ export interface GroupFilterCriteria { /** * The second value to match the searching criteria, when the `BETWEEN` operator is used. */ - secondValue?: string + secondValue?: string | undefined /** * The value to match the searching criteria. */ - value?: string + value?: string | undefined /** * List of values when the `IN` operator is used. */ - values?: string[] + values?: string[] | undefined } /** @@ -583,7 +608,7 @@ export interface GroupMember { /** * The group role name associated with a group member. */ - roles?: GroupRole[] + roles?: GroupRole[] | undefined } /** @@ -593,7 +618,7 @@ export interface GroupRole { /** * The encoded key of the group role name, which is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The group role name key. */ @@ -601,11 +626,11 @@ export interface GroupRole { /** * The group role name. */ - roleName?: string + roleName?: string | undefined /** * The group role name ID. */ - roleNameId?: string + roleNameId?: string | undefined } /** @@ -616,11 +641,11 @@ export interface GroupSearchCriteria { * The list of filtering criteria */ filterCriteria: GroupFilterCriteria[] - sortingCriteria?: GroupSortingCriteria + sortingCriteria?: GroupSortingCriteria | undefined } export const GroupSearchCriteria = { - validate: (await import('./schemas/group-search-criteria.schema.js')).validate as ValidateFunction, + validate: GroupSearchCriteriaValidator as ValidateFunction, get schema() { return GroupSearchCriteria.validate.schema }, @@ -628,10 +653,11 @@ export const GroupSearchCriteria = { return GroupSearchCriteria.validate.errors ?? undefined }, is: (o: unknown): o is GroupSearchCriteria => GroupSearchCriteria.validate(o) === true, - assert: (o: unknown) => { - if (!GroupSearchCriteria.validate(o)) { - throw new ValidationError(GroupSearchCriteria.errors ?? []) + parse: (o: unknown): { right: GroupSearchCriteria } | { left: DefinedError[] } => { + if (GroupSearchCriteria.is(o)) { + return { right: o } } + return { left: (GroupSearchCriteria.errors ?? []) as DefinedError[] } }, } as const @@ -655,7 +681,7 @@ export interface GroupSortingCriteria { /** * The sorting order: `ASC` or `DESC`. The default order is `DESC`. */ - order?: 'ASC' | 'DESC' + order?: 'ASC' | 'DESC' | undefined } /** @@ -665,7 +691,7 @@ export interface PatchOperation { /** * The field from where a value should be moved, when using move */ - from?: string + from?: string | undefined /** * The change to perform */ @@ -677,15 +703,13 @@ export interface PatchOperation { /** * The value of the field, can be null */ - value?: { - [k: string]: unknown | undefined - } + value?: unknown } export type PatchRequest = PatchOperation[] export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, + validate: PatchRequestValidator as ValidateFunction, get schema() { return PatchRequest.validate.schema }, @@ -693,23 +717,24 @@ export const PatchRequest = { return PatchRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } export type SearchResponse = Group[] export const SearchResponse = { - validate: (await import('./schemas/search-response.schema.js')).validate as ValidateFunction, + validate: SearchResponseValidator as ValidateFunction, get schema() { return SearchResponse.validate.schema }, @@ -717,4 +742,10 @@ export const SearchResponse = { return SearchResponse.validate.errors ?? undefined }, is: (o: unknown): o is SearchResponse => SearchResponse.validate(o) === true, + parse: (o: unknown): { right: SearchResponse } | { left: DefinedError[] } => { + if (SearchResponse.is(o)) { + return { right: o } + } + return { left: (SearchResponse.errors ?? []) as DefinedError[] } + }, } as const diff --git a/src/groups/schemas/error-response.schema.js b/src/groups/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/groups/schemas/error-response.schema.js +++ b/src/groups/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/holidays.yaml`, { + this.buildClient(auth).get('configuration/holidays.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update holidays configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/holidays.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/holidays.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -136,24 +175,52 @@ export class MambuHolidaysConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/id-templates/index.ts b/src/id-templates/index.ts index 6213685..2c8f999 100644 --- a/src/id-templates/index.ts +++ b/src/id-templates/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuIdTemplates } from './rest.client.js' export * as idTemplates from './rest.type.js' diff --git a/src/id-templates/rest.client.ts b/src/id-templates/rest.client.ts index 31dc032..d63e446 100644 --- a/src/id-templates/rest.client.ts +++ b/src/id-templates/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ErrorResponse, GetAllResponse } from './rest.type.js' /** @@ -46,12 +49,24 @@ export class MambuIdTemplates { /** * Get ID templates */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], - }: { query?: { detailsLevel?: string }; auth?: string[][] | string[] } = {}) { + }: { query?: { detailsLevel?: string }; auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`organization/identificationDocumentTemplates`, { + this.buildClient(auth).get('organization/identificationDocumentTemplates', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -61,40 +76,48 @@ export class MambuIdTemplates { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -121,24 +144,52 @@ export class MambuIdTemplates { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/id-templates/rest.type.ts b/src/id-templates/rest.type.ts index f2b065a..d6cbb69 100644 --- a/src/id-templates/rest.type.ts +++ b/src/id-templates/rest.type.ts @@ -3,15 +3,18 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +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' export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -19,17 +22,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = IdentificationDocumentTemplate[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -37,6 +41,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -46,35 +56,35 @@ export interface IdentificationDocumentTemplate { /** * `TRUE` if a template allows files to be attached, `FALSE` otherwise. */ - allowAttachments?: boolean + allowAttachments?: boolean | undefined /** * The ID template constraint to define the ID number length and format. Templates consist of the characters `#`, `@`, and `$`, where `#` specifies a number, `@` a letter, and `$` a number or a letter. */ - documentIdTemplate?: string + documentIdTemplate?: string | undefined /** * The type of the document. For example, passport. */ - documentType?: string + documentType?: string | undefined /** * The encoded key of the ID template. It is auto generated and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The unique identifier for the template. */ - id?: string + id?: string | undefined /** * The authority that issued the document. */ - issuingAuthority?: string + issuingAuthority?: string | undefined /** * `TRUE` if a template is mandatory for all the individual clients, `FALSE` otherwise. */ - mandatory?: boolean + mandatory?: boolean | undefined } export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/id-templates/schemas/error-response.schema.js b/src/id-templates/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/id-templates/schemas/error-response.schema.js +++ b/src/id-templates/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/iddocumenttemplates.yaml`, { + this.buildClient(auth).get('configuration/iddocumenttemplates.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update ID templates configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/iddocumenttemplates.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/iddocumenttemplates.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +166,52 @@ export class MambuIdentificationDocumentTemplatesConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/index-rate-sources/index.ts b/src/index-rate-sources/index.ts index 7297acc..fe5200d 100644 --- a/src/index-rate-sources/index.ts +++ b/src/index-rate-sources/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuIndexRateSources } from './rest.client.js' export * as indexRateSources from './rest.type.js' diff --git a/src/index-rate-sources/rest.client.ts b/src/index-rate-sources/rest.client.ts index 1fd4d61..66629a1 100644 --- a/src/index-rate-sources/rest.client.ts +++ b/src/index-rate-sources/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ErrorResponse, GetAllIndexRateSourcesResponse, @@ -52,7 +55,7 @@ export class MambuIndexRateSources { /** * Create index rate */ - public async createIndexRate({ + public createIndexRate({ body, path, headers, @@ -60,10 +63,27 @@ export class MambuIndexRateSources { }: { body: IndexRate path: { indexRateSourceId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(IndexRate, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', IndexRate> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(IndexRate, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`indexratesources/${path.indexRateSourceId}/indexrates`, { @@ -72,105 +92,145 @@ export class MambuIndexRateSources { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: IndexRate, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create index rate source */ - public async createIndexRateSource({ + public createIndexRateSource({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: IndexRateSource - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(IndexRateSource, body) + }: { body: IndexRateSource; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', IndexRateSource> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(IndexRateSource, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`indexratesources`, { + this.buildClient(auth).post('indexratesources', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: IndexRateSource, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete index rate */ - public async deleteIndexRate({ + public deleteIndexRate({ path, auth = [['apiKey'], ['basic']], - }: { - path: { indexRateSourceId: string; indexRateId: string } - auth?: string[][] | string[] - }) { + }: { path: { indexRateSourceId: string; indexRateId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`indexratesources/${path.indexRateSourceId}/indexrates/${path.indexRateId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete index rate source */ - public async deleteIndexRateSource({ + public deleteIndexRateSource({ path, auth = [['apiKey'], ['basic']], - }: { - path: { indexRateSourceId: string } - auth?: string[][] | string[] - }) { + }: { path: { indexRateSourceId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`indexratesources/${path.indexRateSourceId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get index rates for a source */ - public async getAllIndexRates({ + public getAllIndexRates({ path, auth = [['apiKey'], ['basic']], - }: { - path: { indexRateSourceId: string } - auth?: string[][] | string[] - }) { + }: { path: { indexRateSourceId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', GetAllIndexRatesResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`indexratesources/${path.indexRateSourceId}/indexrates`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -181,16 +241,30 @@ export class MambuIndexRateSources { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get index rate sources */ - public async getAllIndexRateSources({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public getAllIndexRateSources({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', GetAllIndexRateSourcesResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`indexratesources`, { + this.buildClient(auth).get('indexratesources', { headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', }), @@ -199,20 +273,30 @@ export class MambuIndexRateSources { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get index rate sources */ - public async getIndexRateSourceById({ + public getIndexRateSourceById({ path, auth = [['apiKey'], ['basic']], - }: { - path: { indexRateSourceId: string } - auth?: string[][] | string[] - }) { + }: { path: { indexRateSourceId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', IndexRateSource> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`indexratesources/${path.indexRateSourceId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -224,45 +308,66 @@ export class MambuIndexRateSources { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -289,24 +394,52 @@ export class MambuIndexRateSources { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/index-rate-sources/rest.type.ts b/src/index-rate-sources/rest.type.ts index 78b90da..85b0f90 100644 --- a/src/index-rate-sources/rest.type.ts +++ b/src/index-rate-sources/rest.type.ts @@ -3,15 +3,21 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllIndexRateSourcesResponseValidator } from './schemas/get-all-index-rate-sources-response.schema.js' +import { validate as GetAllIndexRatesResponseValidator } from './schemas/get-all-index-rates-response.schema.js' +import { validate as IndexRateSourceValidator } from './schemas/index-rate-source.schema.js' +import { validate as IndexRateValidator } from './schemas/index-rate.schema.js' export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -19,18 +25,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllIndexRateSourcesResponse = IndexRateSource[] export const GetAllIndexRateSourcesResponse = { - validate: (await import('./schemas/get-all-index-rate-sources-response.schema.js')) - .validate as ValidateFunction, + validate: GetAllIndexRateSourcesResponseValidator as ValidateFunction, get schema() { return GetAllIndexRateSourcesResponse.validate.schema }, @@ -38,13 +44,18 @@ export const GetAllIndexRateSourcesResponse = { return GetAllIndexRateSourcesResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllIndexRateSourcesResponse => GetAllIndexRateSourcesResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllIndexRateSourcesResponse } | { left: DefinedError[] } => { + if (GetAllIndexRateSourcesResponse.is(o)) { + return { right: o } + } + return { left: (GetAllIndexRateSourcesResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetAllIndexRatesResponse = IndexRate[] export const GetAllIndexRatesResponse = { - validate: (await import('./schemas/get-all-index-rates-response.schema.js')) - .validate as ValidateFunction, + validate: GetAllIndexRatesResponseValidator as ValidateFunction, get schema() { return GetAllIndexRatesResponse.validate.schema }, @@ -52,6 +63,12 @@ export const GetAllIndexRatesResponse = { return GetAllIndexRatesResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllIndexRatesResponse => GetAllIndexRatesResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllIndexRatesResponse } | { left: DefinedError[] } => { + if (GetAllIndexRatesResponse.is(o)) { + return { right: o } + } + return { left: (GetAllIndexRatesResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -61,35 +78,35 @@ export interface IndexRate { /** * The index rate source that the index rate belongs to. */ - assignedIndexRateSourceKey?: string + assignedIndexRateSourceKey?: string | undefined /** * The encoded key of the index rate, which is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the index rate, which can be generated and customized, and must be unique. */ - id?: string + id?: string | undefined /** * The notes or description attached to this object. */ - notes?: string + notes?: string | undefined /** * The percentage value of the index rate. */ - rate?: number + rate?: number | undefined /** * The date when the index rate starts being the active rate for its source. */ - startDate?: string + startDate?: string | undefined /** * The key for the user that last modified the index rate. */ - userKey?: string + userKey?: string | undefined } export const IndexRate = { - validate: (await import('./schemas/index-rate.schema.js')).validate as ValidateFunction, + validate: IndexRateValidator as ValidateFunction, get schema() { return IndexRate.validate.schema }, @@ -97,10 +114,11 @@ export const IndexRate = { return IndexRate.validate.errors ?? undefined }, is: (o: unknown): o is IndexRate => IndexRate.validate(o) === true, - assert: (o: unknown) => { - if (!IndexRate.validate(o)) { - throw new ValidationError(IndexRate.errors ?? []) + parse: (o: unknown): { right: IndexRate } | { left: DefinedError[] } => { + if (IndexRate.is(o)) { + return { right: o } } + return { left: (IndexRate.errors ?? []) as DefinedError[] } }, } as const @@ -111,35 +129,35 @@ export interface IndexRateSource { /** * The creation date of the index rate source */ - creationDate?: string + creationDate?: string | undefined /** * The encoded key of the index rate source, which is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the index rate source, which can be generated and customized, and must be unique. */ - id?: string + id?: string | undefined /** * The last date this rate source was modified */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The name of the index rate source. */ - name?: string + name?: string | undefined /** * The notes about the the index rate source. */ - notes?: string + notes?: string | undefined /** * The type of index rate source. */ - type?: 'INTEREST_RATE' | 'TAX_RATE' | 'WITHHOLDING_TAX_RATE' | 'PRINCIPAL_TAX_RATE' + type?: 'INTEREST_RATE' | 'TAX_RATE' | 'WITHHOLDING_TAX_RATE' | 'PRINCIPAL_TAX_RATE' | undefined } export const IndexRateSource = { - validate: (await import('./schemas/index-rate-source.schema.js')).validate as ValidateFunction, + validate: IndexRateSourceValidator as ValidateFunction, get schema() { return IndexRateSource.validate.schema }, @@ -147,15 +165,16 @@ export const IndexRateSource = { return IndexRateSource.validate.errors ?? undefined }, is: (o: unknown): o is IndexRateSource => IndexRateSource.validate(o) === true, - assert: (o: unknown) => { - if (!IndexRateSource.validate(o)) { - throw new ValidationError(IndexRateSource.errors ?? []) + parse: (o: unknown): { right: IndexRateSource } | { left: DefinedError[] } => { + if (IndexRateSource.is(o)) { + return { right: o } } + return { left: (IndexRateSource.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/index-rate-sources/schemas/error-response.schema.js b/src/index-rate-sources/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/index-rate-sources/schemas/error-response.schema.js +++ b/src/index-rate-sources/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/indexrates.yaml`, { + this.buildClient(auth).get('configuration/indexrates.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update index rates configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/indexrates.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/indexrates.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +166,52 @@ export class MambuIndexRatesConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/index.ts b/src/index.ts index 765e990..2e7954d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -56,8 +56,6 @@ export * from './loan-products/index.js' export * from './loan-products-configuration/index.js' export * from './loan-risk-levels-configuration/index.js' export * from './loan-transactions/index.js' -export * from './mambu-function-secrets/index.js' -export * from './mambu-functions/index.js' export * from './object-labels-configuration/index.js' export * from './organization-configuration/index.js' export * from './organization-details/index.js' diff --git a/src/installments/index.ts b/src/installments/index.ts index 63fea6c..b5f8f8e 100644 --- a/src/installments/index.ts +++ b/src/installments/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuInstallments } from './rest.client.js' export * as installments from './rest.type.js' diff --git a/src/installments/rest.client.ts b/src/installments/rest.client.ts index 3cc8c52..4ce0b01 100644 --- a/src/installments/rest.client.ts +++ b/src/installments/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ErrorResponse, GetAllResponse } from './rest.type.js' /** @@ -46,7 +49,7 @@ export class MambuInstallments { /** * Get installments for `ACTIVE` or `ACTIVE_IN_ARREARS` loan accounts */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { @@ -60,9 +63,22 @@ export class MambuInstallments { accountState?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`installments`, { + this.buildClient(auth).get('installments', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -73,40 +89,48 @@ export class MambuInstallments { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -133,24 +157,52 @@ export class MambuInstallments { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/installments/rest.type.ts b/src/installments/rest.type.ts index f88912e..d35ae8e 100644 --- a/src/installments/rest.type.ts +++ b/src/installments/rest.type.ts @@ -3,8 +3,11 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +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' /** * Represents a simple installment amount structure. @@ -13,15 +16,15 @@ export interface Amount { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined } /** @@ -31,27 +34,27 @@ export interface AmountWithReduced { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined /** * The reduced amount. */ - reduced?: number + reduced?: number | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -59,10 +62,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -73,25 +77,25 @@ export interface FeeAmount { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The expected amount, which is the sum of unapplied fee and planned fee due amounts. */ - expectedUnapplied?: number + expectedUnapplied?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined } export type GetAllResponse = Installment[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -99,6 +103,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -108,98 +118,98 @@ export interface Installment { /** * The installment due date. */ - dueDate?: string + dueDate?: string | undefined /** * The encoded key of the installment, which is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The expected closing balance is the remaining amount per installment only applicable for interest only equal installment products. */ - expectedClosingBalance?: number - fee?: InstallmentFee + expectedClosingBalance?: number | undefined + fee?: InstallmentFee | undefined /** * The breakdown of the fee amounts that have been applied to the loan account. */ - feeDetails?: InstallmentFeeDetails[] - interest?: InstallmentAllocationElementTaxableAmount + feeDetails?: InstallmentFeeDetails[] | undefined + interest?: InstallmentAllocationElementTaxableAmount | undefined /** * The interest accrued calculated on previous repayment closing balance only applicable interest only equal installment products. */ - interestAccrued?: number + interestAccrued?: number | undefined /** * `TRUE` if a payment holiday is offered for the installment, `FALSE` otherwise. */ - isPaymentHoliday?: boolean + isPaymentHoliday?: boolean | undefined /** * The installment last paid date. */ - lastPaidDate?: string + lastPaidDate?: string | undefined /** * The order number of an installment among all the installments generated for a loan. Loan installments are put in ascending order by due date. The order number only applies to the content of a particular JSON response therefore it is not unique. */ - number?: string + number?: string | undefined /** * The parent account key of the installment. */ - parentAccountKey?: string - penalty?: InstallmentAllocationElementTaxableAmount - principal?: InstallmentAllocationElementAmount + parentAccountKey?: string | undefined + penalty?: InstallmentAllocationElementTaxableAmount | undefined + principal?: InstallmentAllocationElementAmount | undefined /** * The installment repaid date. */ - repaidDate?: string + repaidDate?: string | undefined /** * The installment state. */ - state?: 'PENDING' | 'LATE' | 'PAID' | 'PARTIALLY_PAID' | 'GRACE' + state?: 'PENDING' | 'LATE' | 'PAID' | 'PARTIALLY_PAID' | 'GRACE' | undefined } /** * Represents an installment allocation element amount structure. */ export interface InstallmentAllocationElementAmount { - amount?: Amount + amount?: Amount | undefined } /** * Represents an installment allocation element taxable amount structure. */ export interface InstallmentAllocationElementTaxableAmount { - amount?: Amount - tax?: Amount + amount?: Amount | undefined + tax?: Amount | undefined } /** * Represents an installment fee structure. */ export interface InstallmentFee { - amount?: FeeAmount - tax?: Amount + amount?: FeeAmount | undefined + tax?: Amount | undefined } /** * Represents fee details for an installment. */ export interface InstallmentFeeDetails { - amount?: AmountWithReduced + amount?: AmountWithReduced | undefined /** * The encoded key of the predefined fee, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The id of the fee, provided by the client */ - id?: string + id?: string | undefined /** * The name of the fee */ - name?: string - tax?: AmountWithReduced + name?: string | undefined + tax?: AmountWithReduced | undefined } export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/installments/schemas/error-response.schema.js b/src/installments/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/installments/schemas/error-response.schema.js +++ b/src/installments/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/internalcontrols.yaml`, { + this.buildClient(auth).get('configuration/internalcontrols.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update internal controls configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/internalcontrols.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/internalcontrols.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -135,24 +173,52 @@ export class MambuInternalControlsConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/journal-entries/index.ts b/src/journal-entries/index.ts index a0d9099..c9f78a4 100644 --- a/src/journal-entries/index.ts +++ b/src/journal-entries/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuJournalEntries } from './rest.client.js' export * as journalEntries from './rest.type.js' diff --git a/src/journal-entries/rest.client.ts b/src/journal-entries/rest.client.ts index a08aff8..bdca9b0 100644 --- a/src/journal-entries/rest.client.ts +++ b/src/journal-entries/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { CreateResponse, ErrorResponse, @@ -53,37 +56,50 @@ export class MambuJournalEntries { /** * Create general ledger journal entries. */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: PostGLJournalEntriesDTO - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PostGLJournalEntriesDTO, body) + }: { body: PostGLJournalEntriesDTO; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', CreateResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PostGLJournalEntriesDTO, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`gljournalentries`, { + this.buildClient(auth).post('gljournalentries', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: CreateResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get general ledger journal entries */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { @@ -97,9 +113,21 @@ export class MambuJournalEntries { glAccountId?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`gljournalentries`, { + this.buildClient(auth).get('gljournalentries', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -109,14 +137,14 @@ export class MambuJournalEntries { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Search for general ledger journal entries */ - public async search({ + public search({ body, query, auth = [['apiKey'], ['basic']], @@ -124,11 +152,27 @@ export class MambuJournalEntries { body: GLJournalEntrySearchCriteria query?: { offset?: string; limit?: string; paginationDetails?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(GLJournalEntrySearchCriteria, body) + }): Promise< + | SuccessResponse<'200', SearchResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(GLJournalEntrySearchCriteria, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`gljournalentries:search`, { + this.buildClient(auth).post('gljournalentries:search', { json: body, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -139,45 +183,66 @@ export class MambuJournalEntries { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -204,24 +269,52 @@ export class MambuJournalEntries { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/journal-entries/rest.type.ts b/src/journal-entries/rest.type.ts index 102a99a..a731804 100644 --- a/src/journal-entries/rest.type.ts +++ b/src/journal-entries/rest.type.ts @@ -3,8 +3,15 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as CreateResponseValidator } from './schemas/create-response.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' +import { validate as GLJournalEntrySearchCriteriaValidator } from './schemas/gl-journal-entry-search-criteria.schema.js' +import { validate as PostGLJournalEntriesDTOValidator } from './schemas/post-gl-journal-entries-dto.schema.js' +import { validate as SearchResponseValidator } from './schemas/search-response.schema.js' /** * Represents the conversion rate used in accounting to convert amounts from one currency to organisation currency @@ -13,33 +20,33 @@ export interface AccountingRate { /** * The encoded key of the accounting rate, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Rate validity end date */ - endDate?: string + endDate?: string | undefined /** * Organisation currency code */ - fromCurrencyCode?: string + fromCurrencyCode?: string | undefined /** * Value of rate to be used for accounting conversions */ - rate?: number + rate?: number | undefined /** * Rate validity start date */ - startDate?: string + startDate?: string | undefined /** * Foreign currency code */ - toCurrencyCode?: string + toCurrencyCode?: string | undefined } export type CreateResponse = GLJournalEntry[] export const CreateResponse = { - validate: (await import('./schemas/create-response.schema.js')).validate as ValidateFunction, + validate: CreateResponseValidator as ValidateFunction, get schema() { return CreateResponse.validate.schema }, @@ -47,6 +54,12 @@ export const CreateResponse = { return CreateResponse.validate.errors ?? undefined }, is: (o: unknown): o is CreateResponse => CreateResponse.validate(o) === true, + parse: (o: unknown): { right: CreateResponse } | { left: DefinedError[] } => { + if (CreateResponse.is(o)) { + return { right: o } + } + return { left: (CreateResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -240,23 +253,25 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -264,17 +279,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = GLJournalEntry[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -282,6 +298,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -291,56 +313,56 @@ export interface GLAccount { /** * `TRUE` if the account is activated and may be used, `FALSE` otherwise. */ - activated?: boolean + activated?: boolean | undefined /** * `TRUE` if manual journal entries are allowed, `FALSE` otherwise. */ - allowManualJournalEntries?: boolean + allowManualJournalEntries?: boolean | undefined /** * The balance of the general ledger account, which is only populated for the GET /glaccounts endpoint. */ - balance?: number + balance?: number | undefined /** * The creation date for this account, which is stored as UTC. */ - creationDate?: string - currency?: Currency + creationDate?: string | undefined + currency?: Currency | undefined /** * A description of the general ledger account. */ - description?: string + description?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The general ledger code used to identify different account types. Also used for grouping and categorizing accounts. For example: an account code of '3201' is considered a subtype of '3200'. */ - glCode?: string + glCode?: string | undefined /** * The last modification date and time, which is stored as UTC. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The data migration event key if the general ledger account was created as a part of a data migration event. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * The name of the general ledger account. */ - name?: string + name?: string | undefined /** * `TRUE` if trailing zeros are stripped, `FALSE` otherwise. */ - stripTrailingZeros?: boolean + stripTrailingZeros?: boolean | undefined /** * The general ledger account type. */ - type?: 'ASSET' | 'LIABILITY' | 'EQUITY' | 'INCOME' | 'EXPENSE' + type?: 'ASSET' | 'LIABILITY' | 'EQUITY' | 'INCOME' | 'EXPENSE' | undefined /** * The usage type of the general ledger account. `DETAIL` accounts are used to stores transaction balances. `HEADER` accounts are used to organise and group detail accounts for reporting purposes. */ - usage?: 'DETAIL' | 'HEADER' + usage?: 'DETAIL' | 'HEADER' | undefined } /** @@ -350,11 +372,11 @@ export interface GLAccountAmount { /** * The amount which was debited or credited. */ - amount?: number + amount?: number | undefined /** * Represents the general ledger account code of the the general ledger account that was debited or credited. */ - glAccount?: string + glAccount?: string | undefined } /** @@ -364,61 +386,61 @@ export interface GLJournalEntry { /** * The account associated with this journal entry. `Null` if the journal entry is not associated to any account. */ - accountKey?: string + accountKey?: string | undefined /** * The amount which was debited or credited in the organization's currency. */ - amount?: number + amount?: number | undefined /** * The key of the assigned branch for this general ledger journal entry. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * The date and time when the general ledger journal entry was recorded. */ - bookingDate?: string + bookingDate?: string | undefined /** * The creation date of the general ledger journal entry. */ - creationDate?: string + creationDate?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the general ledger journal entry. */ - entryID?: number - foreignAmount?: GLJournalEntryForeignAmount - glAccount?: GLAccount + entryID?: number | undefined + foreignAmount?: GLJournalEntryForeignAmount | undefined + glAccount?: GLAccount | undefined /** * Optional notes entered by the user when they performed the journal entry. */ - notes?: string + notes?: string | undefined /** * The product associated with this journal entry. `Null` if the journal entry is not associated with any product. */ - productKey?: string + productKey?: string | undefined /** * The product type that is referenced by the account key. `Null` if the journal entry is not associated to any product. */ - productType?: 'LOAN' | 'SAVINGS' + productType?: 'LOAN' | 'SAVINGS' | undefined /** * The entry key of the general ledger journal entry that reverses this general ledger journal entry. Null if the general ledger journal entry isn't reversed. */ - reversalEntryKey?: string + reversalEntryKey?: string | undefined /** * The transation ID, which is not unique. */ - transactionId?: string + transactionId?: string | undefined /** * The general ledger journal entry type, which may be debit or credit. */ - type?: 'DEBIT' | 'CREDIT' + type?: 'DEBIT' | 'CREDIT' | undefined /** * The encoded key of the user that performed the transaction. */ - userKey?: string + userKey?: string | undefined } /** @@ -493,27 +515,27 @@ export interface GLJournalEntryFilterCriteria { /** * The second value to match the searching criteria, when the `BETWEEN` operator is used. */ - secondValue?: string + secondValue?: string | undefined /** * The value to match the searching criteria. */ - value?: string + value?: string | undefined /** * List of values when the `IN` operator is used. */ - values?: string[] + values?: string[] | undefined } /** * Represents the details of the general ledger journal entry amount posted in foreign currency. */ export interface GLJournalEntryForeignAmount { - accountingRate?: AccountingRate + accountingRate?: AccountingRate | undefined /** * The amount of an accounting entry in foreign currency. */ - amount?: number - currency?: Currency + amount?: number | undefined + currency?: Currency | undefined } /** @@ -523,13 +545,12 @@ export interface GLJournalEntrySearchCriteria { /** * The list of filtering criteria. */ - filterCriteria?: GLJournalEntryFilterCriteria[] - sortingCriteria?: GLJournalEntrySortingCriteria + filterCriteria?: GLJournalEntryFilterCriteria[] | undefined + sortingCriteria?: GLJournalEntrySortingCriteria | undefined } export const GLJournalEntrySearchCriteria = { - validate: (await import('./schemas/gl-journal-entry-search-criteria.schema.js')) - .validate as ValidateFunction, + validate: GLJournalEntrySearchCriteriaValidator as ValidateFunction, get schema() { return GLJournalEntrySearchCriteria.validate.schema }, @@ -537,10 +558,11 @@ export const GLJournalEntrySearchCriteria = { return GLJournalEntrySearchCriteria.validate.errors ?? undefined }, is: (o: unknown): o is GLJournalEntrySearchCriteria => GLJournalEntrySearchCriteria.validate(o) === true, - assert: (o: unknown) => { - if (!GLJournalEntrySearchCriteria.validate(o)) { - throw new ValidationError(GLJournalEntrySearchCriteria.errors ?? []) + parse: (o: unknown): { right: GLJournalEntrySearchCriteria } | { left: DefinedError[] } => { + if (GLJournalEntrySearchCriteria.is(o)) { + return { right: o } } + return { left: (GLJournalEntrySearchCriteria.errors ?? []) as DefinedError[] } }, } as const @@ -572,7 +594,7 @@ export interface GLJournalEntrySortingCriteria { /** * The sorting order: `ASC` or `DESC`. The default order is `DESC`. */ - order?: 'ASC' | 'DESC' + order?: 'ASC' | 'DESC' | undefined } /** @@ -582,11 +604,11 @@ export interface PostGLJournalEntriesDTO { /** * The ID of the assigned branch for the journal entries. */ - branchId?: string + branchId?: string | undefined /** * The list of general ledger accounts to be credited with corresponding amounts. */ - credits?: GLAccountAmount[] + credits?: GLAccountAmount[] | undefined /** * The date and time when the general ledger journal entries were recorded, also known as the booking date. */ @@ -594,20 +616,19 @@ export interface PostGLJournalEntriesDTO { /** * The list of general ledger accounts to be debited with corresponding amounts. */ - debits?: GLAccountAmount[] + debits?: GLAccountAmount[] | undefined /** * The notes entered when the journal entry was posted. */ - notes?: string + notes?: string | undefined /** * A non-unique trasanction ID. This will be autogenerated if an ID is not provided. */ - transactionId?: string + transactionId?: string | undefined } export const PostGLJournalEntriesDTO = { - validate: (await import('./schemas/post-gl-journal-entries-dto.schema.js')) - .validate as ValidateFunction, + validate: PostGLJournalEntriesDTOValidator as ValidateFunction, get schema() { return PostGLJournalEntriesDTO.validate.schema }, @@ -615,23 +636,24 @@ export const PostGLJournalEntriesDTO = { return PostGLJournalEntriesDTO.validate.errors ?? undefined }, is: (o: unknown): o is PostGLJournalEntriesDTO => PostGLJournalEntriesDTO.validate(o) === true, - assert: (o: unknown) => { - if (!PostGLJournalEntriesDTO.validate(o)) { - throw new ValidationError(PostGLJournalEntriesDTO.errors ?? []) + parse: (o: unknown): { right: PostGLJournalEntriesDTO } | { left: DefinedError[] } => { + if (PostGLJournalEntriesDTO.is(o)) { + return { right: o } } + return { left: (PostGLJournalEntriesDTO.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } export type SearchResponse = GLJournalEntry[] export const SearchResponse = { - validate: (await import('./schemas/search-response.schema.js')).validate as ValidateFunction, + validate: SearchResponseValidator as ValidateFunction, get schema() { return SearchResponse.validate.schema }, @@ -639,4 +661,10 @@ export const SearchResponse = { return SearchResponse.validate.errors ?? undefined }, is: (o: unknown): o is SearchResponse => SearchResponse.validate(o) === true, + parse: (o: unknown): { right: SearchResponse } | { left: DefinedError[] } => { + if (SearchResponse.is(o)) { + return { right: o } + } + return { left: (SearchResponse.errors ?? []) as DefinedError[] } + }, } as const diff --git a/src/journal-entries/schemas/create-response.schema.js b/src/journal-entries/schemas/create-response.schema.js index ec24dea..8bd3aaf 100644 --- a/src/journal-entries/schemas/create-response.schema.js +++ b/src/journal-entries/schemas/create-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"createResponse","type":"array","items":{"$ref":"#/$defs/GLJournalEntryaf30"},"$defs":{"GLJournalEntryaf30":{"type":"object","title":"GLJournalEntryaf30","description":"Represents a general ledger journal entry.","properties":{"accountKey":{"type":"string","title":"accountKey","description":"The account associated with this journal entry. `Null` if the journal entry is not associated to any account."},"amount":{"type":"number","title":"amount","description":"The amount which was debited or credited in the organization's currency."},"assignedBranchKey":{"type":"string","title":"assignedBranchKey","description":"The key of the assigned branch for this general ledger journal entry."},"bookingDate":{"type":"string","title":"bookingDate","description":"The date and time when the general ledger journal entry was recorded.","format":"date-time"},"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the general ledger journal entry.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"entryID":{"type":"integer","title":"entryID","description":"The ID of the general ledger journal entry."},"foreignAmount":{"title":"foreignAmount","$ref":"#/$defs/GLJournalEntryForeignAmountaf30"},"glAccount":{"title":"glAccount","$ref":"#/$defs/GLAccountaf30"},"notes":{"type":"string","title":"notes","description":"Optional notes entered by the user when they performed the journal entry."},"productKey":{"type":"string","title":"productKey","description":"The product associated with this journal entry. `Null` if the journal entry is not associated with any product."},"productType":{"title":"productType","description":"The product type that is referenced by the account key. `Null` if the journal entry is not associated to any product.","enum":["LOAN","SAVINGS"]},"reversalEntryKey":{"type":"string","title":"reversalEntryKey","description":"The entry key of the general ledger journal entry that reverses this general ledger journal entry. Null if the general ledger journal entry isn't reversed."},"transactionId":{"type":"string","title":"transactionId","description":"The transation ID, which is not unique."},"type":{"title":"type","description":"The general ledger journal entry type, which may be debit or credit.","enum":["DEBIT","CREDIT"]},"userKey":{"type":"string","title":"userKey","description":"The encoded key of the user that performed the transaction."}},"additionalProperties":true},"GLJournalEntryForeignAmountaf30":{"type":"object","title":"GLJournalEntryForeignAmountaf30","description":"Represents the details of the general ledger journal entry amount posted in foreign currency.","properties":{"accountingRate":{"title":"accountingRate","$ref":"#/$defs/AccountingRateaf30"},"amount":{"type":"number","title":"amount","description":"The amount of an accounting entry in foreign currency."},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"}},"additionalProperties":true},"AccountingRateaf30":{"type":"object","title":"AccountingRateaf30","description":"Represents the conversion rate used in accounting to convert amounts from one currency to organisation currency","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the accounting rate, auto generated, unique"},"endDate":{"type":"string","title":"endDate","description":"Rate validity end date","format":"date-time"},"fromCurrencyCode":{"type":"string","title":"fromCurrencyCode","description":"Organisation currency code"},"rate":{"type":"number","title":"rate","description":"Value of rate to be used for accounting conversions"},"startDate":{"type":"string","title":"startDate","description":"Rate validity start date","format":"date-time"},"toCurrencyCode":{"type":"string","title":"toCurrencyCode","description":"Foreign currency code"}},"additionalProperties":true},"Currencyaf30":{"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true},"GLAccountaf30":{"type":"object","title":"GLAccountaf30","description":"Represents a general ledger account.","properties":{"activated":{"type":"boolean","title":"activated","description":"`TRUE` if the account is activated and may be used, `FALSE` otherwise."},"allowManualJournalEntries":{"type":"boolean","title":"allowManualJournalEntries","description":"`TRUE` if manual journal entries are allowed, `FALSE` otherwise."},"balance":{"type":"number","title":"balance","description":"The balance of the general ledger account, which is only populated for the GET /glaccounts endpoint."},"creationDate":{"type":"string","title":"creationDate","description":"The creation date for this account, which is stored as UTC.","format":"date-time"},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"description":{"type":"string","title":"description","description":"A description of the general ledger account."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"glCode":{"type":"string","title":"glCode","description":"The general ledger code used to identify different account types. Also used for grouping and categorizing accounts. For example: an account code of '3201' is considered a subtype of '3200'."},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last modification date and time, which is stored as UTC.","format":"date-time"},"migrationEventKey":{"type":"string","title":"migrationEventKey","description":"The data migration event key if the general ledger account was created as a part of a data migration event."},"name":{"type":"string","title":"name","description":"The name of the general ledger account."},"stripTrailingZeros":{"type":"boolean","title":"stripTrailingZeros","description":"`TRUE` if trailing zeros are stripped, `FALSE` otherwise."},"type":{"title":"type","description":"The general ledger account type.","enum":["ASSET","LIABILITY","EQUITY","INCOME","EXPENSE"]},"usage":{"title":"usage","description":"The usage type of the general ledger account. `DETAIL` accounts are used to stores transaction balances. `HEADER` accounts are used to organise and group detail accounts for reporting purposes.","enum":["DETAIL","HEADER"]}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"GLJournalEntryaf30","description":"Represents a general ledger journal entry.","properties":{"accountKey":{"type":"string","title":"accountKey","description":"The account associated with this journal entry. `Null` if the journal entry is not associated to any account."},"amount":{"type":"number","title":"amount","description":"The amount which was debited or credited in the organization's currency."},"assignedBranchKey":{"type":"string","title":"assignedBranchKey","description":"The key of the assigned branch for this general ledger journal entry."},"bookingDate":{"type":"string","title":"bookingDate","description":"The date and time when the general ledger journal entry was recorded.","format":"date-time"},"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the general ledger journal entry.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"entryID":{"type":"integer","title":"entryID","description":"The ID of the general ledger journal entry."},"foreignAmount":{"title":"foreignAmount","$ref":"#/$defs/GLJournalEntryForeignAmountaf30"},"glAccount":{"title":"glAccount","$ref":"#/$defs/GLAccountaf30"},"notes":{"type":"string","title":"notes","description":"Optional notes entered by the user when they performed the journal entry."},"productKey":{"type":"string","title":"productKey","description":"The product associated with this journal entry. `Null` if the journal entry is not associated with any product."},"productType":{"title":"productType","description":"The product type that is referenced by the account key. `Null` if the journal entry is not associated to any product.","enum":["LOAN","SAVINGS"]},"reversalEntryKey":{"type":"string","title":"reversalEntryKey","description":"The entry key of the general ledger journal entry that reverses this general ledger journal entry. Null if the general ledger journal entry isn't reversed."},"transactionId":{"type":"string","title":"transactionId","description":"The transation ID, which is not unique."},"type":{"title":"type","description":"The general ledger journal entry type, which may be debit or credit.","enum":["DEBIT","CREDIT"]},"userKey":{"type":"string","title":"userKey","description":"The encoded key of the user that performed the transaction."}},"additionalProperties":true};const schema13 = {"type":"object","title":"GLJournalEntryForeignAmountaf30","description":"Represents the details of the general ledger journal entry amount posted in foreign currency.","properties":{"accountingRate":{"title":"accountingRate","$ref":"#/$defs/AccountingRateaf30"},"amount":{"type":"number","title":"amount","description":"The amount of an accounting entry in foreign currency."},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"}},"additionalProperties":true};const schema14 = {"type":"object","title":"AccountingRateaf30","description":"Represents the conversion rate used in accounting to convert amounts from one currency to organisation currency","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the accounting rate, auto generated, unique"},"endDate":{"type":"string","title":"endDate","description":"Rate validity end date","format":"date-time"},"fromCurrencyCode":{"type":"string","title":"fromCurrencyCode","description":"Organisation currency code"},"rate":{"type":"number","title":"rate","description":"Value of rate to be used for accounting conversions"},"startDate":{"type":"string","title":"startDate","description":"Rate validity start date","format":"date-time"},"toCurrencyCode":{"type":"string","title":"toCurrencyCode","description":"Foreign currency code"}},"additionalProperties":true};const schema15 = {"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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.accountingRate !== undefined){let data0 = data.accountingRate;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.encodedKey !== undefined){const _errs6 = errors;if(typeof data0.encodedKey !== "string"){validate12.errors = [{instancePath:instancePath+"/accountingRate/encodedKey",schemaPath:"#/$defs/AccountingRateaf30/properties/encodedKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.endDate !== undefined){const _errs8 = errors;if(errors === _errs8){if(errors === _errs8){if(!(typeof data0.endDate === "string")){validate12.errors = [{instancePath:instancePath+"/accountingRate/endDate",schemaPath:"#/$defs/AccountingRateaf30/properties/endDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.fromCurrencyCode !== undefined){const _errs10 = errors;if(typeof data0.fromCurrencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/accountingRate/fromCurrencyCode",schemaPath:"#/$defs/AccountingRateaf30/properties/fromCurrencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data0.rate !== undefined){let data4 = data0.rate;const _errs12 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate12.errors = [{instancePath:instancePath+"/accountingRate/rate",schemaPath:"#/$defs/AccountingRateaf30/properties/rate/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}if(valid2){if(data0.startDate !== undefined){const _errs14 = errors;if(errors === _errs14){if(errors === _errs14){if(!(typeof data0.startDate === "string")){validate12.errors = [{instancePath:instancePath+"/accountingRate/startDate",schemaPath:"#/$defs/AccountingRateaf30/properties/startDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data0.toCurrencyCode !== undefined){const _errs16 = errors;if(typeof data0.toCurrencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/accountingRate/toCurrencyCode",schemaPath:"#/$defs/AccountingRateaf30/properties/toCurrencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs16 === errors;}else {var valid2 = true;}}}}}}}else {validate12.errors = [{instancePath:instancePath+"/accountingRate",schemaPath:"#/$defs/AccountingRateaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.amount !== undefined){let data7 = data.amount;const _errs18 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/properties/amount/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.currency !== undefined){let data8 = data.currency;const _errs20 = errors;const _errs21 = errors;if(errors === _errs21){if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.code !== undefined){const _errs24 = errors;let valid5;valid5 = false;for(const v0 of schema15.properties.code.enum){if(func0(data8.code, v0)){valid5 = true;break;}}if(!valid5){validate12.errors = [{instancePath:instancePath+"/currency/code",schemaPath:"#/$defs/Currencyaf30/properties/code/enum",keyword:"enum",params:{allowedValues: schema15.properties.code.enum},message:"must be equal to one of the allowed values"}];return false;}var valid4 = _errs24 === errors;}else {var valid4 = true;}if(valid4){if(data8.currencyCode !== undefined){const _errs25 = errors;if(typeof data8.currencyCode !== "string"){validate12.errors = [{instancePath:instancePath+"/currency/currencyCode",schemaPath:"#/$defs/Currencyaf30/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs25 === errors;}else {var valid4 = true;}}}else {validate12.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/$defs/Currencyaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs20 === 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 schema16 = {"type":"object","title":"GLAccountaf30","description":"Represents a general ledger account.","properties":{"activated":{"type":"boolean","title":"activated","description":"`TRUE` if the account is activated and may be used, `FALSE` otherwise."},"allowManualJournalEntries":{"type":"boolean","title":"allowManualJournalEntries","description":"`TRUE` if manual journal entries are allowed, `FALSE` otherwise."},"balance":{"type":"number","title":"balance","description":"The balance of the general ledger account, which is only populated for the GET /glaccounts endpoint."},"creationDate":{"type":"string","title":"creationDate","description":"The creation date for this account, which is stored as UTC.","format":"date-time"},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"description":{"type":"string","title":"description","description":"A description of the general ledger account."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"glCode":{"type":"string","title":"glCode","description":"The general ledger code used to identify different account types. Also used for grouping and categorizing accounts. For example: an account code of '3201' is considered a subtype of '3200'."},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last modification date and time, which is stored as UTC.","format":"date-time"},"migrationEventKey":{"type":"string","title":"migrationEventKey","description":"The data migration event key if the general ledger account was created as a part of a data migration event."},"name":{"type":"string","title":"name","description":"The name of the general ledger account."},"stripTrailingZeros":{"type":"boolean","title":"stripTrailingZeros","description":"`TRUE` if trailing zeros are stripped, `FALSE` otherwise."},"type":{"title":"type","description":"The general ledger account type.","enum":["ASSET","LIABILITY","EQUITY","INCOME","EXPENSE"]},"usage":{"title":"usage","description":"The usage type of the general ledger account. `DETAIL` accounts are used to stores transaction balances. `HEADER` accounts are used to organise and group detail accounts for reporting purposes.","enum":["DETAIL","HEADER"]}},"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.activated !== undefined){const _errs2 = errors;if(typeof data.activated !== "boolean"){validate14.errors = [{instancePath:instancePath+"/activated",schemaPath:"#/properties/activated/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.allowManualJournalEntries !== undefined){const _errs4 = errors;if(typeof data.allowManualJournalEntries !== "boolean"){validate14.errors = [{instancePath:instancePath+"/allowManualJournalEntries",schemaPath:"#/properties/allowManualJournalEntries/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.balance !== undefined){let data2 = data.balance;const _errs6 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate14.errors = [{instancePath:instancePath+"/balance",schemaPath:"#/properties/balance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs8 = errors;if(errors === _errs8){if(errors === _errs8){if(!(typeof data.creationDate === "string")){validate14.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.currency !== undefined){let data4 = data.currency;const _errs10 = errors;const _errs11 = errors;if(errors === _errs11){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){if(data4.code !== undefined){const _errs14 = errors;let valid3;valid3 = false;for(const v0 of schema15.properties.code.enum){if(func0(data4.code, v0)){valid3 = true;break;}}if(!valid3){validate14.errors = [{instancePath:instancePath+"/currency/code",schemaPath:"#/$defs/Currencyaf30/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 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data4.currencyCode !== undefined){const _errs15 = errors;if(typeof data4.currencyCode !== "string"){validate14.errors = [{instancePath:instancePath+"/currency/currencyCode",schemaPath:"#/$defs/Currencyaf30/properties/currencyCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs15 === errors;}else {var valid2 = true;}}}else {validate14.errors = [{instancePath:instancePath+"/currency",schemaPath:"#/$defs/Currencyaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.description !== undefined){const _errs17 = errors;if(typeof data.description !== "string"){validate14.errors = [{instancePath:instancePath+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs19 = 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 = _errs19 === errors;}else {var valid0 = true;}if(valid0){if(data.glCode !== undefined){const _errs21 = errors;if(typeof data.glCode !== "string"){validate14.errors = [{instancePath:instancePath+"/glCode",schemaPath:"#/properties/glCode/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs21 === errors;}else {var valid0 = true;}if(valid0){if(data.lastModifiedDate !== undefined){const _errs23 = errors;if(errors === _errs23){if(errors === _errs23){if(!(typeof data.lastModifiedDate === "string")){validate14.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs23 === errors;}else {var valid0 = true;}if(valid0){if(data.migrationEventKey !== undefined){const _errs25 = errors;if(typeof data.migrationEventKey !== "string"){validate14.errors = [{instancePath:instancePath+"/migrationEventKey",schemaPath:"#/properties/migrationEventKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs25 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs27 = errors;if(typeof data.name !== "string"){validate14.errors = [{instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs27 === errors;}else {var valid0 = true;}if(valid0){if(data.stripTrailingZeros !== undefined){const _errs29 = errors;if(typeof data.stripTrailingZeros !== "boolean"){validate14.errors = [{instancePath:instancePath+"/stripTrailingZeros",schemaPath:"#/properties/stripTrailingZeros/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs29 === errors;}else {var valid0 = true;}if(valid0){if(data.type !== undefined){const _errs31 = errors;let valid4;valid4 = false;for(const v1 of schema16.properties.type.enum){if(func0(data.type, v1)){valid4 = true;break;}}if(!valid4){validate14.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/enum",keyword:"enum",params:{allowedValues: schema16.properties.type.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.usage !== undefined){let data15 = data.usage;const _errs32 = errors;if(!((data15 === "DETAIL") || (data15 === "HEADER"))){validate14.errors = [{instancePath:instancePath+"/usage",schemaPath:"#/properties/usage/enum",keyword:"enum",params:{allowedValues: schema16.properties.usage.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs32 === 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;}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.accountKey !== undefined){const _errs2 = errors;if(typeof data.accountKey !== "string"){validate11.errors = [{instancePath:instancePath+"/accountKey",schemaPath:"#/properties/accountKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];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.assignedBranchKey !== undefined){const _errs6 = errors;if(typeof data.assignedBranchKey !== "string"){validate11.errors = [{instancePath:instancePath+"/assignedBranchKey",schemaPath:"#/properties/assignedBranchKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.bookingDate !== undefined){const _errs8 = errors;if(errors === _errs8){if(errors === _errs8){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 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.creationDate !== undefined){const _errs10 = errors;if(errors === _errs10){if(errors === _errs10){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 = _errs10 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs12 = 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 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.entryID !== undefined){let data6 = data.entryID;const _errs14 = errors;if(!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))){validate11.errors = [{instancePath:instancePath+"/entryID",schemaPath:"#/properties/entryID/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.foreignAmount !== undefined){const _errs16 = errors;if(!(validate12(data.foreignAmount, {instancePath:instancePath+"/foreignAmount",parentData:data,parentDataProperty:"foreignAmount",rootData}))){vErrors = vErrors === null ? validate12.errors : vErrors.concat(validate12.errors);errors = vErrors.length;}var valid0 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.glAccount !== undefined){const _errs17 = errors;if(!(validate14(data.glAccount, {instancePath:instancePath+"/glAccount",parentData:data,parentDataProperty:"glAccount",rootData}))){vErrors = vErrors === null ? validate14.errors : vErrors.concat(validate14.errors);errors = vErrors.length;}var valid0 = _errs17 === errors;}else {var valid0 = true;}if(valid0){if(data.notes !== undefined){const _errs18 = 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 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.productKey !== undefined){const _errs20 = errors;if(typeof data.productKey !== "string"){validate11.errors = [{instancePath:instancePath+"/productKey",schemaPath:"#/properties/productKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.productType !== undefined){let data11 = data.productType;const _errs22 = errors;if(!((data11 === "LOAN") || (data11 === "SAVINGS"))){validate11.errors = [{instancePath:instancePath+"/productType",schemaPath:"#/properties/productType/enum",keyword:"enum",params:{allowedValues: schema12.properties.productType.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs22 === errors;}else {var valid0 = true;}if(valid0){if(data.reversalEntryKey !== undefined){const _errs23 = errors;if(typeof data.reversalEntryKey !== "string"){validate11.errors = [{instancePath:instancePath+"/reversalEntryKey",schemaPath:"#/properties/reversalEntryKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs23 === errors;}else {var valid0 = true;}if(valid0){if(data.transactionId !== undefined){const _errs25 = errors;if(typeof data.transactionId !== "string"){validate11.errors = [{instancePath:instancePath+"/transactionId",schemaPath:"#/properties/transactionId/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs25 === errors;}else {var valid0 = true;}if(valid0){if(data.type !== undefined){let data14 = data.type;const _errs27 = errors;if(!((data14 === "DEBIT") || (data14 === "CREDIT"))){validate11.errors = [{instancePath:instancePath+"/type",schemaPath:"#/properties/type/enum",keyword:"enum",params:{allowedValues: schema12.properties.type.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs27 === errors;}else {var valid0 = true;}if(valid0){if(data.userKey !== undefined){const _errs28 = errors;if(typeof data.userKey !== "string"){validate11.errors = [{instancePath:instancePath+"/userKey",schemaPath:"#/properties/userKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs28 === 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;}function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(Array.isArray(data)){var valid0 = true;const len0 = data.length;for(let i0=0; i0 + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(EditScheduleRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`loans/${path.loanAccountId}/schedule`, { @@ -76,22 +92,31 @@ export class MambuLoanAccountSchedule { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get loan account schedule */ - public async getScheduleForLoanAccount({ + public getScheduleForLoanAccount({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', LoanAccountSchedule> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/schedule`, { searchParams: query ?? {}, @@ -104,22 +129,31 @@ export class MambuLoanAccountSchedule { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Preview loan account schedule using transactional processing for PMT. */ - public async previewProcessPmtTransactionally({ + public previewProcessPmtTransactionally({ path, headers, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string }; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', LoanAccountPreviewProcessPMTTransactionally> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/schedule/previewProcessPMTTransactionally`, { headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, @@ -131,26 +165,38 @@ export class MambuLoanAccountSchedule { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Preview loan account schedule for non-existent loan account */ - public async previewSchedule({ + public previewSchedule({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: PreviewLoanAccountSchedule - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PreviewLoanAccountSchedule, body) + }: { body: PreviewLoanAccountSchedule; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', LoanAccountSchedule> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PreviewLoanAccountSchedule, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`loans/schedule:preview`, { + this.buildClient(auth).post('loans/schedule:preview', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', @@ -160,14 +206,14 @@ export class MambuLoanAccountSchedule { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Preview loan account schedule for non-existent loan account */ - public async previewTranchesOnSchedule({ + public previewTranchesOnSchedule({ body, path, headers, @@ -175,10 +221,26 @@ export class MambuLoanAccountSchedule { }: { body: PreviewTranchesOnScheduleRequest path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(PreviewTranchesOnScheduleRequest, body) + }): Promise< + | SuccessResponse<'200', LoanAccountSchedule> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PreviewTranchesOnScheduleRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/schedule:previewTranches`, { @@ -191,45 +253,66 @@ export class MambuLoanAccountSchedule { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -256,24 +339,52 @@ export class MambuLoanAccountSchedule { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/loan-account-schedule/rest.type.ts b/src/loan-account-schedule/rest.type.ts index 07201d7..2fb1924 100644 --- a/src/loan-account-schedule/rest.type.ts +++ b/src/loan-account-schedule/rest.type.ts @@ -3,8 +3,15 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as EditScheduleRequestValidator } from './schemas/edit-schedule-request.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as LoanAccountPreviewProcessPMTTransactionallyValidator } from './schemas/loan-account-preview-process-pmt-transactionally.schema.js' +import { validate as LoanAccountScheduleValidator } from './schemas/loan-account-schedule.schema.js' +import { validate as PreviewLoanAccountScheduleValidator } from './schemas/preview-loan-account-schedule.schema.js' +import { validate as PreviewTranchesOnScheduleRequestValidator } from './schemas/preview-tranches-on-schedule-request.schema.js' /** * Adjustable interest rates settings for loan account @@ -13,31 +20,31 @@ export interface AccountInterestRateSettings { /** * The encoded key of the interest rate settings, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Index rate source key. */ - indexSourceKey?: string + indexSourceKey?: string | undefined /** * Interest rate value. */ - interestRate?: number + interestRate?: number | undefined /** * Maximum value allowed for index based interest rate. Valid only for index interest rate. */ - interestRateCeilingValue?: number + interestRateCeilingValue?: number | undefined /** * Minimum value allowed for index based interest rate. Valid only for index interest rate. */ - interestRateFloorValue?: number + interestRateFloorValue?: number | undefined /** * Interest rate review frequency unit count. Valid only for index interest rate. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * Interest rate review frequency measurement unit. Valid only for index interest rate. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * Interest calculation method: fixed or indexed(interest spread + active organization index interest rate) */ @@ -45,7 +52,7 @@ export interface AccountInterestRateSettings { /** * Interest spread value. */ - interestSpread?: number + interestSpread?: number | undefined /** * Date since an interest rate is valid */ @@ -59,15 +66,15 @@ export interface Amount { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined } /** @@ -77,19 +84,19 @@ export interface AmountWithReduced { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined /** * The reduced amount. */ - reduced?: number + reduced?: number | undefined } /** @@ -283,15 +290,17 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } /** @@ -301,19 +310,19 @@ export interface CustomPredefinedFee { /** * The amount of the custom fee. */ - amount?: number + amount?: number | undefined /** * The encoded key of the custom predefined fee, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The percentage of the custom fee. */ - percentage?: number + percentage?: number | undefined /** * The encoded key of the predefined fee */ - predefinedFeeEncodedKey?: string + predefinedFeeEncodedKey?: string | undefined } /** @@ -323,21 +332,21 @@ export interface DisbursementDetailsForSchedulePreview { /** * The date of the expected disbursement.Stored as Organization Time. */ - expectedDisbursementDate?: string + expectedDisbursementDate?: string | undefined /** * List of fees that should be applied at the disbursement time. */ - fees?: CustomPredefinedFee[] + fees?: CustomPredefinedFee[] | undefined /** * The date of the expected first repayment. Stored as Organization Time. */ - firstRepaymentDate?: string + firstRepaymentDate?: string | undefined } export type EditScheduleRequest = Installment[] export const EditScheduleRequest = { - validate: (await import('./schemas/edit-schedule-request.schema.js')).validate as ValidateFunction, + validate: EditScheduleRequestValidator as ValidateFunction, get schema() { return EditScheduleRequest.validate.schema }, @@ -345,19 +354,20 @@ export const EditScheduleRequest = { return EditScheduleRequest.validate.errors ?? undefined }, is: (o: unknown): o is EditScheduleRequest => EditScheduleRequest.validate(o) === true, - assert: (o: unknown) => { - if (!EditScheduleRequest.validate(o)) { - throw new ValidationError(EditScheduleRequest.errors ?? []) + parse: (o: unknown): { right: EditScheduleRequest } | { left: DefinedError[] } => { + if (EditScheduleRequest.is(o)) { + return { right: o } } + return { left: (EditScheduleRequest.errors ?? []) as DefinedError[] } }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -365,10 +375,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -379,19 +390,19 @@ export interface FeeAmount { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The expected amount, which is the sum of unapplied fee and planned fee due amounts. */ - expectedUnapplied?: number + expectedUnapplied?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined } /** @@ -401,94 +412,94 @@ export interface Installment { /** * The installment due date. */ - dueDate?: string + dueDate?: string | undefined /** * The encoded key of the installment, which is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The expected closing balance is the remaining amount per installment only applicable for interest only equal installment products. */ - expectedClosingBalance?: number - fee?: InstallmentFee + expectedClosingBalance?: number | undefined + fee?: InstallmentFee | undefined /** * The breakdown of the fee amounts that have been applied to the loan account. */ - feeDetails?: InstallmentFeeDetails[] - interest?: InstallmentAllocationElementTaxableAmount + feeDetails?: InstallmentFeeDetails[] | undefined + interest?: InstallmentAllocationElementTaxableAmount | undefined /** * The interest accrued calculated on previous repayment closing balance only applicable interest only equal installment products. */ - interestAccrued?: number + interestAccrued?: number | undefined /** * `TRUE` if a payment holiday is offered for the installment, `FALSE` otherwise. */ - isPaymentHoliday?: boolean + isPaymentHoliday?: boolean | undefined /** * The installment last paid date. */ - lastPaidDate?: string + lastPaidDate?: string | undefined /** * The order number of an installment among all the installments generated for a loan. Loan installments are put in ascending order by due date. The order number only applies to the content of a particular JSON response therefore it is not unique. */ - number?: string + number?: string | undefined /** * The parent account key of the installment. */ - parentAccountKey?: string - penalty?: InstallmentAllocationElementTaxableAmount - principal?: InstallmentAllocationElementAmount + parentAccountKey?: string | undefined + penalty?: InstallmentAllocationElementTaxableAmount | undefined + principal?: InstallmentAllocationElementAmount | undefined /** * The installment repaid date. */ - repaidDate?: string + repaidDate?: string | undefined /** * The installment state. */ - state?: 'PENDING' | 'LATE' | 'PAID' | 'PARTIALLY_PAID' | 'GRACE' + state?: 'PENDING' | 'LATE' | 'PAID' | 'PARTIALLY_PAID' | 'GRACE' | undefined } /** * Represents an installment allocation element amount structure. */ export interface InstallmentAllocationElementAmount { - amount?: Amount + amount?: Amount | undefined } /** * Represents an installment allocation element taxable amount structure. */ export interface InstallmentAllocationElementTaxableAmount { - amount?: Amount - tax?: Amount + amount?: Amount | undefined + tax?: Amount | undefined } /** * Represents an installment fee structure. */ export interface InstallmentFee { - amount?: FeeAmount - tax?: Amount + amount?: FeeAmount | undefined + tax?: Amount | undefined } /** * Represents fee details for an installment. */ export interface InstallmentFeeDetails { - amount?: AmountWithReduced + amount?: AmountWithReduced | undefined /** * The encoded key of the predefined fee, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The id of the fee, provided by the client */ - id?: string + id?: string | undefined /** * The name of the fee */ - name?: string - tax?: AmountWithReduced + name?: string | undefined + tax?: AmountWithReduced | undefined } /** @@ -498,15 +509,15 @@ export interface InterestSettingsForSchedulePreview { /** * The interest settings details for schedule preview. */ - accountInterestRateSettings?: AccountInterestRateSettings[] + accountInterestRateSettings?: AccountInterestRateSettings[] | undefined /** * 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. */ - interestRate?: number + interestRate?: number | undefined /** * Interest to be added to active organization index interest rate in order to find out actual interest rate */ - interestSpread?: number + interestSpread?: number | undefined } /** @@ -516,21 +527,21 @@ export interface LoanAccountPreviewProcessPMTTransactionally { /** * The error code of the request. */ - error?: string + error?: string | undefined /** * Additional information about the request. */ - info?: string - result?: LoanAccountSchedulesPreviewProcessPMTTransactionally + info?: string | undefined + result?: LoanAccountSchedulesPreviewProcessPMTTransactionally | undefined /** * The status of the request. */ - status?: string + status?: string | undefined } export const LoanAccountPreviewProcessPMTTransactionally = { - validate: (await import('./schemas/loan-account-preview-process-pmt-transactionally.schema.js')) - .validate as ValidateFunction, + validate: + LoanAccountPreviewProcessPMTTransactionallyValidator as ValidateFunction, get schema() { return LoanAccountPreviewProcessPMTTransactionally.validate.schema }, @@ -539,21 +550,27 @@ export const LoanAccountPreviewProcessPMTTransactionally = { }, is: (o: unknown): o is LoanAccountPreviewProcessPMTTransactionally => LoanAccountPreviewProcessPMTTransactionally.validate(o) === true, + parse: (o: unknown): { right: LoanAccountPreviewProcessPMTTransactionally } | { left: DefinedError[] } => { + if (LoanAccountPreviewProcessPMTTransactionally.is(o)) { + return { right: o } + } + return { left: (LoanAccountPreviewProcessPMTTransactionally.errors ?? []) as DefinedError[] } + }, } as const /** * Represents a single loan account schedule structure. */ export interface LoanAccountSchedule { - currency?: Currency + currency?: Currency | undefined /** * The loan account schedule installments list. */ - installments?: Installment[] + installments?: Installment[] | undefined } export const LoanAccountSchedule = { - validate: (await import('./schemas/loan-account-schedule.schema.js')).validate as ValidateFunction, + validate: LoanAccountScheduleValidator as ValidateFunction, get schema() { return LoanAccountSchedule.validate.schema }, @@ -561,10 +578,11 @@ export const LoanAccountSchedule = { return LoanAccountSchedule.validate.errors ?? undefined }, is: (o: unknown): o is LoanAccountSchedule => LoanAccountSchedule.validate(o) === true, - assert: (o: unknown) => { - if (!LoanAccountSchedule.validate(o)) { - throw new ValidationError(LoanAccountSchedule.errors ?? []) + parse: (o: unknown): { right: LoanAccountSchedule } | { left: DefinedError[] } => { + if (LoanAccountSchedule.is(o)) { + return { right: o } } + return { left: (LoanAccountSchedule.errors ?? []) as DefinedError[] } }, } as const @@ -575,15 +593,15 @@ export interface LoanAccountSchedulesPreviewProcessPMTTransactionally { /** * Whether there differences on schedule or not. */ - differences?: boolean + differences?: boolean | undefined /** * The loan account existing schedule installments list. */ - existingSchedule?: Installment[] + existingSchedule?: Installment[] | undefined /** * The loan account new schedule installments list. */ - schedule?: Installment[] + schedule?: Installment[] | undefined } /** @@ -594,19 +612,19 @@ export interface LoanTranche { * The amount this tranche has available for disburse */ amount: number - disbursementDetails?: TrancheDisbursementDetails + disbursementDetails?: TrancheDisbursementDetails | undefined /** * The encoded key of the transaction details , auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Fees that are associated with this tranche */ - fees?: CustomPredefinedFee[] + fees?: CustomPredefinedFee[] | undefined /** * Index indicating the tranche number */ - trancheNumber?: number + trancheNumber?: number | undefined } /** @@ -630,23 +648,23 @@ export interface PlannedInstallmentFee { /** * The amount of the planned fee. */ - amount?: number + amount?: number | undefined /** * 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. */ - applyOnDate?: string + applyOnDate?: string | undefined /** * The encoded key of the planned installment fee, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The encoded key of the installment on which the predefined fee is planned. */ - installmentKey?: string + installmentKey?: string | undefined /** * 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. */ - installmentNumber?: number + installmentNumber?: number | undefined /** * The encoded key of the predefined fee which is planned. */ @@ -657,12 +675,12 @@ export interface PlannedInstallmentFee { * Payload structure to preview loan account schedule. */ export interface PreviewLoanAccountSchedule { - disbursementDetails?: DisbursementDetailsForSchedulePreview + disbursementDetails?: DisbursementDetailsForSchedulePreview | undefined /** * The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enable */ - interestCommission?: number - interestSettings?: InterestSettingsForSchedulePreview + interestCommission?: number | undefined + interestSettings?: InterestSettingsForSchedulePreview | undefined /** * The loan amount */ @@ -670,25 +688,24 @@ export interface PreviewLoanAccountSchedule { /** * A list with planned manual fees to be applied on the installments for schedule preview. */ - plannedInstallmentFees?: PlannedInstallmentFee[] + plannedInstallmentFees?: PlannedInstallmentFee[] | undefined /** * The key to the type of product that this account is based on. */ productTypeKey: string - scheduleSettings?: ScheduleSettingsForSchedulePreview + scheduleSettings?: ScheduleSettingsForSchedulePreview | undefined /** * The top up amount in case of a refinanced account */ - topUpAmount?: number + topUpAmount?: number | undefined /** * List of tranches to be considered for schedule preview. */ - tranches?: LoanTranche[] + tranches?: LoanTranche[] | undefined } export const PreviewLoanAccountSchedule = { - validate: (await import('./schemas/preview-loan-account-schedule.schema.js')) - .validate as ValidateFunction, + validate: PreviewLoanAccountScheduleValidator as ValidateFunction, get schema() { return PreviewLoanAccountSchedule.validate.schema }, @@ -696,18 +713,18 @@ export const PreviewLoanAccountSchedule = { return PreviewLoanAccountSchedule.validate.errors ?? undefined }, is: (o: unknown): o is PreviewLoanAccountSchedule => PreviewLoanAccountSchedule.validate(o) === true, - assert: (o: unknown) => { - if (!PreviewLoanAccountSchedule.validate(o)) { - throw new ValidationError(PreviewLoanAccountSchedule.errors ?? []) + parse: (o: unknown): { right: PreviewLoanAccountSchedule } | { left: DefinedError[] } => { + if (PreviewLoanAccountSchedule.is(o)) { + return { right: o } } + return { left: (PreviewLoanAccountSchedule.errors ?? []) as DefinedError[] } }, } as const export type PreviewTranchesOnScheduleRequest = LoanTranche[] export const PreviewTranchesOnScheduleRequest = { - validate: (await import('./schemas/preview-tranches-on-schedule-request.schema.js')) - .validate as ValidateFunction, + validate: PreviewTranchesOnScheduleRequestValidator as ValidateFunction, get schema() { return PreviewTranchesOnScheduleRequest.validate.schema }, @@ -715,17 +732,18 @@ export const PreviewTranchesOnScheduleRequest = { return PreviewTranchesOnScheduleRequest.validate.errors ?? undefined }, is: (o: unknown): o is PreviewTranchesOnScheduleRequest => PreviewTranchesOnScheduleRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PreviewTranchesOnScheduleRequest.validate(o)) { - throw new ValidationError(PreviewTranchesOnScheduleRequest.errors ?? []) + parse: (o: unknown): { right: PreviewTranchesOnScheduleRequest } | { left: DefinedError[] } => { + if (PreviewTranchesOnScheduleRequest.is(o)) { + return { right: o } } + return { left: (PreviewTranchesOnScheduleRequest.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -735,35 +753,35 @@ export interface ScheduleSettingsForSchedulePreview { /** * Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH. */ - fixedDaysOfMonth?: number[] + fixedDaysOfMonth?: number[] | undefined /** * The grace period. Represents the grace period for loan repayment - in number of installments. */ - gracePeriod?: number + gracePeriod?: number | undefined /** * A list of periodic payments for the current loan account. */ - paymentPlan?: PeriodicPaymentForSchedulePreview[] + paymentPlan?: PeriodicPaymentForSchedulePreview[] | undefined /** * The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments */ - periodicPayment?: number + periodicPayment?: number | undefined /** * The principal repayment interval. Indicates the interval of repayments that the principal has to be paid. */ - principalRepaymentInterval?: number + principalRepaymentInterval?: number | undefined /** * The repayment installments. Represents how many installments are required to pay back the loan. */ - repaymentInstallments?: number + repaymentInstallments?: number | undefined /** * The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option. */ - repaymentPeriodCount?: number + repaymentPeriodCount?: number | undefined /** * The repayment period unit. Represents the frequency of loan repayment. */ - repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' + repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' | undefined } /** @@ -773,9 +791,9 @@ export interface TrancheDisbursementDetails { /** * The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement */ - disbursementTransactionKey?: string + disbursementTransactionKey?: string | undefined /** * The date when this tranche is supposed to be disbursed (as Organization Time) */ - expectedDisbursementDate?: string + expectedDisbursementDate?: string | undefined } diff --git a/src/loan-account-schedule/schemas/edit-schedule-request.schema.js b/src/loan-account-schedule/schemas/edit-schedule-request.schema.js index f69f7c9..f55d2a4 100644 --- a/src/loan-account-schedule/schemas/edit-schedule-request.schema.js +++ b/src/loan-account-schedule/schemas/edit-schedule-request.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"editScheduleRequest","type":"array","items":{"$ref":"#/$defs/Installmentaf30"},"$defs":{"Installmentaf30":{"type":"object","title":"Installmentaf30","description":"Represents a single installment details structure.","properties":{"dueDate":{"type":"string","title":"dueDate","description":"The installment due date.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the installment, which is auto generated, and unique."},"expectedClosingBalance":{"type":"number","title":"expectedClosingBalance","description":"The expected closing balance is the remaining amount per installment only applicable for interest only equal installment products."},"fee":{"title":"fee","$ref":"#/$defs/InstallmentFeeaf30"},"feeDetails":{"type":"array","title":"feeDetails","description":"The breakdown of the fee amounts that have been applied to the loan account.","items":{"$ref":"#/$defs/InstallmentFeeDetailsaf30"}},"interest":{"title":"interest","$ref":"#/$defs/InstallmentAllocationElementTaxableAmountaf30"},"interestAccrued":{"type":"number","title":"interestAccrued","description":"The interest accrued calculated on previous repayment closing balance only applicable interest only equal installment products."},"isPaymentHoliday":{"type":"boolean","title":"isPaymentHoliday","description":"`TRUE` if a payment holiday is offered for the installment, `FALSE` otherwise."},"lastPaidDate":{"type":"string","title":"lastPaidDate","description":"The installment last paid date.","format":"date-time"},"number":{"type":"string","title":"number","description":"The order number of an installment among all the installments generated for a loan. Loan installments are put in ascending order by due date. The order number only applies to the content of a particular JSON response therefore it is not unique."},"parentAccountKey":{"type":"string","title":"parentAccountKey","description":"The parent account key of the installment."},"penalty":{"title":"penalty","$ref":"#/$defs/InstallmentAllocationElementTaxableAmountaf30"},"principal":{"title":"principal","$ref":"#/$defs/InstallmentAllocationElementAmountaf30"},"repaidDate":{"type":"string","title":"repaidDate","description":"The installment repaid date.","format":"date-time"},"state":{"title":"state","description":"The installment state.","enum":["PENDING","LATE","PAID","PARTIALLY_PAID","GRACE"]}},"additionalProperties":true},"InstallmentFeeaf30":{"type":"object","title":"InstallmentFeeaf30","description":"Represents an installment fee structure.","properties":{"amount":{"title":"amount","$ref":"#/$defs/FeeAmountaf30"},"tax":{"title":"tax","$ref":"#/$defs/Amountaf30"}},"additionalProperties":true},"FeeAmountaf30":{"type":"object","title":"FeeAmountaf30","description":"Represents a fee amount.","properties":{"due":{"type":"number","title":"due","description":"The due amount."},"expected":{"type":"number","title":"expected","description":"The expected amount, which is sum of paid and due amounts."},"expectedUnapplied":{"type":"number","title":"expectedUnapplied","description":"The expected amount, which is the sum of unapplied fee and planned fee due amounts."},"paid":{"type":"number","title":"paid","description":"The paid amount."}},"additionalProperties":true},"Amountaf30":{"type":"object","title":"Amountaf30","description":"Represents a simple installment amount structure.","properties":{"due":{"type":"number","title":"due","description":"The due amount."},"expected":{"type":"number","title":"expected","description":"The expected amount, which is sum of paid and due amounts."},"paid":{"type":"number","title":"paid","description":"The paid amount."}},"additionalProperties":true},"InstallmentFeeDetailsaf30":{"type":"object","title":"InstallmentFeeDetailsaf30","description":"Represents fee details for an installment.","properties":{"amount":{"title":"amount","$ref":"#/$defs/AmountWithReducedaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the predefined fee, auto generated, unique"},"id":{"type":"string","title":"id","description":"The id of the fee, provided by the client"},"name":{"type":"string","title":"name","description":"The name of the fee"},"tax":{"title":"tax","$ref":"#/$defs/AmountWithReducedaf30"}},"additionalProperties":true},"AmountWithReducedaf30":{"type":"object","title":"AmountWithReducedaf30","description":"Represents a simple installment amount structure.","properties":{"due":{"type":"number","title":"due","description":"The due amount."},"expected":{"type":"number","title":"expected","description":"The expected amount, which is sum of paid and due amounts."},"paid":{"type":"number","title":"paid","description":"The paid amount."},"reduced":{"type":"number","title":"reduced","description":"The reduced amount."}},"additionalProperties":true},"InstallmentAllocationElementTaxableAmountaf30":{"type":"object","title":"InstallmentAllocationElementTaxableAmountaf30","description":"Represents an installment allocation element taxable amount structure.","properties":{"amount":{"title":"amount","$ref":"#/$defs/Amountaf30"},"tax":{"title":"tax","$ref":"#/$defs/Amountaf30"}},"additionalProperties":true},"InstallmentAllocationElementAmountaf30":{"type":"object","title":"InstallmentAllocationElementAmountaf30","description":"Represents an installment allocation element amount structure.","properties":{"amount":{"title":"amount","$ref":"#/$defs/Amountaf30"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"Installmentaf30","description":"Represents a single installment details structure.","properties":{"dueDate":{"type":"string","title":"dueDate","description":"The installment due date.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the installment, which is auto generated, and unique."},"expectedClosingBalance":{"type":"number","title":"expectedClosingBalance","description":"The expected closing balance is the remaining amount per installment only applicable for interest only equal installment products."},"fee":{"title":"fee","$ref":"#/$defs/InstallmentFeeaf30"},"feeDetails":{"type":"array","title":"feeDetails","description":"The breakdown of the fee amounts that have been applied to the loan account.","items":{"$ref":"#/$defs/InstallmentFeeDetailsaf30"}},"interest":{"title":"interest","$ref":"#/$defs/InstallmentAllocationElementTaxableAmountaf30"},"interestAccrued":{"type":"number","title":"interestAccrued","description":"The interest accrued calculated on previous repayment closing balance only applicable interest only equal installment products."},"isPaymentHoliday":{"type":"boolean","title":"isPaymentHoliday","description":"`TRUE` if a payment holiday is offered for the installment, `FALSE` otherwise."},"lastPaidDate":{"type":"string","title":"lastPaidDate","description":"The installment last paid date.","format":"date-time"},"number":{"type":"string","title":"number","description":"The order number of an installment among all the installments generated for a loan. Loan installments are put in ascending order by due date. The order number only applies to the content of a particular JSON response therefore it is not unique."},"parentAccountKey":{"type":"string","title":"parentAccountKey","description":"The parent account key of the installment."},"penalty":{"title":"penalty","$ref":"#/$defs/InstallmentAllocationElementTaxableAmountaf30"},"principal":{"title":"principal","$ref":"#/$defs/InstallmentAllocationElementAmountaf30"},"repaidDate":{"type":"string","title":"repaidDate","description":"The installment repaid date.","format":"date-time"},"state":{"title":"state","description":"The installment state.","enum":["PENDING","LATE","PAID","PARTIALLY_PAID","GRACE"]}},"additionalProperties":true};const schema13 = {"type":"object","title":"InstallmentFeeaf30","description":"Represents an installment fee structure.","properties":{"amount":{"title":"amount","$ref":"#/$defs/FeeAmountaf30"},"tax":{"title":"tax","$ref":"#/$defs/Amountaf30"}},"additionalProperties":true};const schema14 = {"type":"object","title":"FeeAmountaf30","description":"Represents a fee amount.","properties":{"due":{"type":"number","title":"due","description":"The due amount."},"expected":{"type":"number","title":"expected","description":"The expected amount, which is sum of paid and due amounts."},"expectedUnapplied":{"type":"number","title":"expectedUnapplied","description":"The expected amount, which is the sum of unapplied fee and planned fee due amounts."},"paid":{"type":"number","title":"paid","description":"The paid amount."}},"additionalProperties":true};const schema15 = {"type":"object","title":"Amountaf30","description":"Represents a simple installment amount structure.","properties":{"due":{"type":"number","title":"due","description":"The due amount."},"expected":{"type":"number","title":"expected","description":"The expected amount, which is sum of paid and due amounts."},"paid":{"type":"number","title":"paid","description":"The paid amount."}},"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.amount !== undefined){let data0 = data.amount;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.due !== undefined){let data1 = data0.due;const _errs6 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate12.errors = [{instancePath:instancePath+"/amount/due",schemaPath:"#/$defs/FeeAmountaf30/properties/due/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.expected !== undefined){let data2 = data0.expected;const _errs8 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate12.errors = [{instancePath:instancePath+"/amount/expected",schemaPath:"#/$defs/FeeAmountaf30/properties/expected/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.expectedUnapplied !== undefined){let data3 = data0.expectedUnapplied;const _errs10 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate12.errors = [{instancePath:instancePath+"/amount/expectedUnapplied",schemaPath:"#/$defs/FeeAmountaf30/properties/expectedUnapplied/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data0.paid !== undefined){let data4 = data0.paid;const _errs12 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate12.errors = [{instancePath:instancePath+"/amount/paid",schemaPath:"#/$defs/FeeAmountaf30/properties/paid/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}}}}}else {validate12.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/$defs/FeeAmountaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.tax !== undefined){let data5 = data.tax;const _errs14 = errors;const _errs15 = errors;if(errors === _errs15){if(data5 && typeof data5 == "object" && !Array.isArray(data5)){if(data5.due !== undefined){let data6 = data5.due;const _errs18 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate12.errors = [{instancePath:instancePath+"/tax/due",schemaPath:"#/$defs/Amountaf30/properties/due/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs18 === errors;}else {var valid4 = true;}if(valid4){if(data5.expected !== undefined){let data7 = data5.expected;const _errs20 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate12.errors = [{instancePath:instancePath+"/tax/expected",schemaPath:"#/$defs/Amountaf30/properties/expected/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs20 === errors;}else {var valid4 = true;}if(valid4){if(data5.paid !== undefined){let data8 = data5.paid;const _errs22 = errors;if(!((typeof data8 == "number") && (isFinite(data8)))){validate12.errors = [{instancePath:instancePath+"/tax/paid",schemaPath:"#/$defs/Amountaf30/properties/paid/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs22 === errors;}else {var valid4 = true;}}}}else {validate12.errors = [{instancePath:instancePath+"/tax",schemaPath:"#/$defs/Amountaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs14 === 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 schema16 = {"type":"object","title":"InstallmentFeeDetailsaf30","description":"Represents fee details for an installment.","properties":{"amount":{"title":"amount","$ref":"#/$defs/AmountWithReducedaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the predefined fee, auto generated, unique"},"id":{"type":"string","title":"id","description":"The id of the fee, provided by the client"},"name":{"type":"string","title":"name","description":"The name of the fee"},"tax":{"title":"tax","$ref":"#/$defs/AmountWithReducedaf30"}},"additionalProperties":true};const schema17 = {"type":"object","title":"AmountWithReducedaf30","description":"Represents a simple installment amount structure.","properties":{"due":{"type":"number","title":"due","description":"The due amount."},"expected":{"type":"number","title":"expected","description":"The expected amount, which is sum of paid and due amounts."},"paid":{"type":"number","title":"paid","description":"The paid amount."},"reduced":{"type":"number","title":"reduced","description":"The reduced 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.amount !== undefined){let data0 = data.amount;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.due !== undefined){let data1 = data0.due;const _errs6 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate14.errors = [{instancePath:instancePath+"/amount/due",schemaPath:"#/$defs/AmountWithReducedaf30/properties/due/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.expected !== undefined){let data2 = data0.expected;const _errs8 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate14.errors = [{instancePath:instancePath+"/amount/expected",schemaPath:"#/$defs/AmountWithReducedaf30/properties/expected/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.paid !== undefined){let data3 = data0.paid;const _errs10 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate14.errors = [{instancePath:instancePath+"/amount/paid",schemaPath:"#/$defs/AmountWithReducedaf30/properties/paid/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data0.reduced !== undefined){let data4 = data0.reduced;const _errs12 = errors;if(!((typeof data4 == "number") && (isFinite(data4)))){validate14.errors = [{instancePath:instancePath+"/amount/reduced",schemaPath:"#/$defs/AmountWithReducedaf30/properties/reduced/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs12 === errors;}else {var valid2 = true;}}}}}else {validate14.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/$defs/AmountWithReducedaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs14 = 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 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.id !== undefined){const _errs16 = errors;if(typeof data.id !== "string"){validate14.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs16 === errors;}else {var valid0 = true;}if(valid0){if(data.name !== undefined){const _errs18 = errors;if(typeof data.name !== "string"){validate14.errors = [{instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs18 === errors;}else {var valid0 = true;}if(valid0){if(data.tax !== undefined){let data8 = data.tax;const _errs20 = errors;const _errs21 = errors;if(errors === _errs21){if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.due !== undefined){let data9 = data8.due;const _errs24 = errors;if(!((typeof data9 == "number") && (isFinite(data9)))){validate14.errors = [{instancePath:instancePath+"/tax/due",schemaPath:"#/$defs/AmountWithReducedaf30/properties/due/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs24 === errors;}else {var valid4 = true;}if(valid4){if(data8.expected !== undefined){let data10 = data8.expected;const _errs26 = errors;if(!((typeof data10 == "number") && (isFinite(data10)))){validate14.errors = [{instancePath:instancePath+"/tax/expected",schemaPath:"#/$defs/AmountWithReducedaf30/properties/expected/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs26 === errors;}else {var valid4 = true;}if(valid4){if(data8.paid !== undefined){let data11 = data8.paid;const _errs28 = errors;if(!((typeof data11 == "number") && (isFinite(data11)))){validate14.errors = [{instancePath:instancePath+"/tax/paid",schemaPath:"#/$defs/AmountWithReducedaf30/properties/paid/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs28 === errors;}else {var valid4 = true;}if(valid4){if(data8.reduced !== undefined){let data12 = data8.reduced;const _errs30 = errors;if(!((typeof data12 == "number") && (isFinite(data12)))){validate14.errors = [{instancePath:instancePath+"/tax/reduced",schemaPath:"#/$defs/AmountWithReducedaf30/properties/reduced/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs30 === errors;}else {var valid4 = true;}}}}}else {validate14.errors = [{instancePath:instancePath+"/tax",schemaPath:"#/$defs/AmountWithReducedaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs20 === 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 schema19 = {"type":"object","title":"InstallmentAllocationElementTaxableAmountaf30","description":"Represents an installment allocation element taxable amount structure.","properties":{"amount":{"title":"amount","$ref":"#/$defs/Amountaf30"},"tax":{"title":"tax","$ref":"#/$defs/Amountaf30"}},"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.amount !== undefined){let data0 = data.amount;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.due !== undefined){let data1 = data0.due;const _errs6 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate16.errors = [{instancePath:instancePath+"/amount/due",schemaPath:"#/$defs/Amountaf30/properties/due/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.expected !== undefined){let data2 = data0.expected;const _errs8 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate16.errors = [{instancePath:instancePath+"/amount/expected",schemaPath:"#/$defs/Amountaf30/properties/expected/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.paid !== undefined){let data3 = data0.paid;const _errs10 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate16.errors = [{instancePath:instancePath+"/amount/paid",schemaPath:"#/$defs/Amountaf30/properties/paid/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}else {validate16.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/$defs/Amountaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.tax !== undefined){let data4 = data.tax;const _errs12 = errors;const _errs13 = errors;if(errors === _errs13){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){if(data4.due !== undefined){let data5 = data4.due;const _errs16 = errors;if(!((typeof data5 == "number") && (isFinite(data5)))){validate16.errors = [{instancePath:instancePath+"/tax/due",schemaPath:"#/$defs/Amountaf30/properties/due/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs16 === errors;}else {var valid4 = true;}if(valid4){if(data4.expected !== undefined){let data6 = data4.expected;const _errs18 = errors;if(!((typeof data6 == "number") && (isFinite(data6)))){validate16.errors = [{instancePath:instancePath+"/tax/expected",schemaPath:"#/$defs/Amountaf30/properties/expected/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs18 === errors;}else {var valid4 = true;}if(valid4){if(data4.paid !== undefined){let data7 = data4.paid;const _errs20 = errors;if(!((typeof data7 == "number") && (isFinite(data7)))){validate16.errors = [{instancePath:instancePath+"/tax/paid",schemaPath:"#/$defs/Amountaf30/properties/paid/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid4 = _errs20 === errors;}else {var valid4 = true;}}}}else {validate16.errors = [{instancePath:instancePath+"/tax",schemaPath:"#/$defs/Amountaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs12 === 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;}const schema22 = {"type":"object","title":"InstallmentAllocationElementAmountaf30","description":"Represents an installment allocation element amount structure.","properties":{"amount":{"title":"amount","$ref":"#/$defs/Amountaf30"}},"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.amount !== undefined){let data0 = data.amount;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.due !== undefined){let data1 = data0.due;const _errs6 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate19.errors = [{instancePath:instancePath+"/amount/due",schemaPath:"#/$defs/Amountaf30/properties/due/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.expected !== undefined){let data2 = data0.expected;const _errs8 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate19.errors = [{instancePath:instancePath+"/amount/expected",schemaPath:"#/$defs/Amountaf30/properties/expected/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.paid !== undefined){let data3 = data0.paid;const _errs10 = errors;if(!((typeof data3 == "number") && (isFinite(data3)))){validate19.errors = [{instancePath:instancePath+"/amount/paid",schemaPath:"#/$defs/Amountaf30/properties/paid/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}else {validate19.errors = [{instancePath:instancePath+"/amount",schemaPath:"#/$defs/Amountaf30/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 func0 = require("ajv/dist/runtime/equal").default;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.dueDate !== undefined){const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(!(typeof data.dueDate === "string")){validate11.errors = [{instancePath:instancePath+"/dueDate",schemaPath:"#/properties/dueDate/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"){validate11.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.expectedClosingBalance !== undefined){let data2 = data.expectedClosingBalance;const _errs6 = errors;if(!((typeof data2 == "number") && (isFinite(data2)))){validate11.errors = [{instancePath:instancePath+"/expectedClosingBalance",schemaPath:"#/properties/expectedClosingBalance/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs6 === errors;}else {var valid0 = true;}if(valid0){if(data.fee !== undefined){const _errs8 = errors;if(!(validate12(data.fee, {instancePath:instancePath+"/fee",parentData:data,parentDataProperty:"fee",rootData}))){vErrors = vErrors === null ? validate12.errors : vErrors.concat(validate12.errors);errors = vErrors.length;}var valid0 = _errs8 === errors;}else {var valid0 = true;}if(valid0){if(data.feeDetails !== undefined){let data4 = data.feeDetails;const _errs9 = errors;if(errors === _errs9){if(Array.isArray(data4)){var valid1 = true;const len0 = data4.length;for(let i0=0; i0 + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(EditTranchesRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`loans/${path.loanAccountId}/tranches`, { @@ -69,20 +85,29 @@ export class MambuLoanAccountTranches { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get loan account tranches list */ - public async getTranches({ + public getTranches({ path, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', GetTranchesResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/tranches`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -93,45 +118,66 @@ export class MambuLoanAccountTranches { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -158,24 +204,52 @@ export class MambuLoanAccountTranches { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/loan-account-tranches/rest.type.ts b/src/loan-account-tranches/rest.type.ts index 7423517..645502b 100644 --- a/src/loan-account-tranches/rest.type.ts +++ b/src/loan-account-tranches/rest.type.ts @@ -3,8 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as EditTranchesRequestValidator } from './schemas/edit-tranches-request.schema.js' +import { validate as EditTranchesResponseValidator } from './schemas/edit-tranches-response.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetTranchesResponseValidator } from './schemas/get-tranches-response.schema.js' /** * The custom predefined fees, they may be used as the expected predefined fees that will be applied on the disbursement. @@ -13,25 +18,25 @@ export interface CustomPredefinedFee { /** * The amount of the custom fee. */ - amount?: number + amount?: number | undefined /** * The encoded key of the custom predefined fee, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The percentage of the custom fee. */ - percentage?: number + percentage?: number | undefined /** * The encoded key of the predefined fee */ - predefinedFeeEncodedKey?: string + predefinedFeeEncodedKey?: string | undefined } export type EditTranchesRequest = LoanTranche[] export const EditTranchesRequest = { - validate: (await import('./schemas/edit-tranches-request.schema.js')).validate as ValidateFunction, + validate: EditTranchesRequestValidator as ValidateFunction, get schema() { return EditTranchesRequest.validate.schema }, @@ -39,17 +44,18 @@ export const EditTranchesRequest = { return EditTranchesRequest.validate.errors ?? undefined }, is: (o: unknown): o is EditTranchesRequest => EditTranchesRequest.validate(o) === true, - assert: (o: unknown) => { - if (!EditTranchesRequest.validate(o)) { - throw new ValidationError(EditTranchesRequest.errors ?? []) + parse: (o: unknown): { right: EditTranchesRequest } | { left: DefinedError[] } => { + if (EditTranchesRequest.is(o)) { + return { right: o } } + return { left: (EditTranchesRequest.errors ?? []) as DefinedError[] } }, } as const export type EditTranchesResponse = LoanTranche[] export const EditTranchesResponse = { - validate: (await import('./schemas/edit-tranches-response.schema.js')).validate as ValidateFunction, + validate: EditTranchesResponseValidator as ValidateFunction, get schema() { return EditTranchesResponse.validate.schema }, @@ -57,14 +63,20 @@ export const EditTranchesResponse = { return EditTranchesResponse.validate.errors ?? undefined }, is: (o: unknown): o is EditTranchesResponse => EditTranchesResponse.validate(o) === true, + parse: (o: unknown): { right: EditTranchesResponse } | { left: DefinedError[] } => { + if (EditTranchesResponse.is(o)) { + return { right: o } + } + return { left: (EditTranchesResponse.errors ?? []) as DefinedError[] } + }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -72,17 +84,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetTranchesResponse = LoanTranche[] export const GetTranchesResponse = { - validate: (await import('./schemas/get-tranches-response.schema.js')).validate as ValidateFunction, + validate: GetTranchesResponseValidator as ValidateFunction, get schema() { return GetTranchesResponse.validate.schema }, @@ -90,6 +103,12 @@ export const GetTranchesResponse = { return GetTranchesResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetTranchesResponse => GetTranchesResponse.validate(o) === true, + parse: (o: unknown): { right: GetTranchesResponse } | { left: DefinedError[] } => { + if (GetTranchesResponse.is(o)) { + return { right: o } + } + return { left: (GetTranchesResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -100,25 +119,25 @@ export interface LoanTranche { * The amount this tranche has available for disburse */ amount: number - disbursementDetails?: TrancheDisbursementDetails + disbursementDetails?: TrancheDisbursementDetails | undefined /** * The encoded key of the transaction details , auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Fees that are associated with this tranche */ - fees?: CustomPredefinedFee[] + fees?: CustomPredefinedFee[] | undefined /** * Index indicating the tranche number */ - trancheNumber?: number + trancheNumber?: number | undefined } export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -128,9 +147,9 @@ export interface TrancheDisbursementDetails { /** * The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement */ - disbursementTransactionKey?: string + disbursementTransactionKey?: string | undefined /** * The date when this tranche is supposed to be disbursed (as Organization Time) */ - expectedDisbursementDate?: string + expectedDisbursementDate?: string | undefined } diff --git a/src/loan-account-tranches/schemas/edit-tranches-request.schema.js b/src/loan-account-tranches/schemas/edit-tranches-request.schema.js index 17473b6..db60ace 100644 --- a/src/loan-account-tranches/schemas/edit-tranches-request.schema.js +++ b/src/loan-account-tranches/schemas/edit-tranches-request.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"editTranchesRequest","type":"array","items":{"$ref":"#/$defs/LoanTrancheaf30"},"$defs":{"LoanTrancheaf30":{"type":"object","title":"LoanTrancheaf30","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","title":"amount","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/TrancheDisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","title":"fees","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"trancheNumber":{"type":"integer","title":"trancheNumber","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetailsaf30":{"type":"object","title":"TrancheDisbursementDetailsaf30","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","title":"disbursementTransactionKey","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","title":"expectedDisbursementDate","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true},"CustomPredefinedFeeaf30":{"type":"object","title":"CustomPredefinedFeeaf30","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","title":"amount","description":"The amount of the custom fee."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","title":"percentage","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","title":"predefinedFeeEncodedKey","description":"The encoded key of the predefined fee"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"LoanTrancheaf30","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","title":"amount","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/TrancheDisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","title":"fees","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"trancheNumber":{"type":"integer","title":"trancheNumber","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true};const schema13 = {"type":"object","title":"TrancheDisbursementDetailsaf30","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","title":"disbursementTransactionKey","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","title":"expectedDisbursementDate","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true};const schema14 = {"type":"object","title":"CustomPredefinedFeeaf30","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","title":"amount","description":"The amount of the custom fee."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","title":"percentage","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","title":"predefinedFeeEncodedKey","description":"The encoded key of the predefined fee"}},"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")){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.disbursementDetails !== undefined){let data1 = data.disbursementDetails;const _errs4 = errors;const _errs5 = errors;if(errors === _errs5){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.disbursementTransactionKey !== undefined){const _errs8 = errors;if(typeof data1.disbursementTransactionKey !== "string"){validate11.errors = [{instancePath:instancePath+"/disbursementDetails/disbursementTransactionKey",schemaPath:"#/$defs/TrancheDisbursementDetailsaf30/properties/disbursementTransactionKey/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data1.expectedDisbursementDate !== undefined){const _errs10 = errors;if(errors === _errs10){if(errors === _errs10){if(!(typeof data1.expectedDisbursementDate === "string")){validate11.errors = [{instancePath:instancePath+"/disbursementDetails/expectedDisbursementDate",schemaPath:"#/$defs/TrancheDisbursementDetailsaf30/properties/expectedDisbursementDate/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}else {validate11.errors = [{instancePath:instancePath+"/disbursementDetails",schemaPath:"#/$defs/TrancheDisbursementDetailsaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.encodedKey !== undefined){const _errs12 = 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 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.fees !== undefined){let data5 = data.fees;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){var valid3 = true;const len0 = data5.length;for(let i0=0; i0 + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ApplyInterestInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:applyInterest`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * ApplY planned fees from the past installments, as backdated or from future installments, on the first pending installment */ - public async applyPlannedFees({ + public applyPlannedFees({ body, path, headers, @@ -129,10 +150,28 @@ export class MambuLoanAccounts { }: { body: PlannedFeeKeys path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(PlannedFeeKeys, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', ApplyPlannedFeesResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PlannedFeeKeys, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/plannedfees:apply`, { @@ -141,20 +180,20 @@ export class MambuLoanAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: ApplyPlannedFeesResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Change arrears settings for loan account */ - public async changeArrearsSettings({ + public changeArrearsSettings({ body, path, headers, @@ -162,32 +201,50 @@ export class MambuLoanAccounts { }: { body: ChangeArrearsSettingsInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ChangeArrearsSettingsInput, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ChangeArrearsSettingsInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changeArrearsSettings`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Change due dates settings for loan account */ - public async changeDueDatesSettings({ + public changeDueDatesSettings({ body, path, headers, @@ -195,32 +252,50 @@ export class MambuLoanAccounts { }: { body: ChangeDueDatesSettingsInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ChangeDueDatesSettingsInput, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ChangeDueDatesSettingsInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changeDueDatesSettings`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Change loan account interest rate */ - public async changeInterestRate({ + public changeInterestRate({ body, path, headers, @@ -228,32 +303,50 @@ export class MambuLoanAccounts { }: { body: ChangeInterestRateLoanAccountInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ChangeInterestRateLoanAccountInput, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ChangeInterestRateLoanAccountInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changeInterestRate`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * 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 async changePeriodicPayment({ + public changePeriodicPayment({ body, path, headers, @@ -261,32 +354,50 @@ export class MambuLoanAccounts { }: { body: ChangePeriodicPaymentLoanAccountInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ChangePeriodicPaymentLoanAccountInput, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ChangePeriodicPaymentLoanAccountInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changePeriodicPayment`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Change repayment value for loan account */ - public async changeRepaymentValue({ + public changeRepaymentValue({ body, path, headers, @@ -294,32 +405,50 @@ export class MambuLoanAccounts { }: { body: ChangeRepaymentValueLoanAccountInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(ChangeRepaymentValueLoanAccountInput, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(ChangeRepaymentValueLoanAccountInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changeRepaymentValue`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Change loan account state */ - public async changeState({ + public changeState({ body, path, headers, @@ -327,10 +456,28 @@ export class MambuLoanAccounts { }: { body: LoanAccountAction path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanAccountAction, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', LoanAccount> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanAccountAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:changeState`, { @@ -339,50 +486,63 @@ export class MambuLoanAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: LoanAccount, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create loan account */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: LoanAccount - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanAccount, body) + }: { body: LoanAccount; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', LoanAccount> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanAccount, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`loans`, { + this.buildClient(auth).post('loans', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: LoanAccount, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Represents the information needed to create and associate a new card to an account. */ - public async createCard({ + public createCard({ body, path, headers, @@ -390,32 +550,50 @@ export class MambuLoanAccounts { }: { body: Card path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(Card, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Card, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/cards`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 201: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 201: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create funding sources for a loan account */ - public async createLoanAccountFundingSources({ + public createLoanAccountFundingSources({ body, path, headers, @@ -423,10 +601,28 @@ export class MambuLoanAccounts { }: { body: CreateLoanAccountFundingSourcesRequest path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(CreateLoanAccountFundingSourcesRequest, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', CreateLoanAccountFundingSourcesResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CreateLoanAccountFundingSourcesRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/funding`, { @@ -435,20 +631,20 @@ export class MambuLoanAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: CreateLoanAccountFundingSourcesResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Create planned fees */ - public async createPlannedFees({ + public createPlannedFees({ body, path, headers, @@ -456,10 +652,28 @@ export class MambuLoanAccounts { }: { body: CreatePlannedFeesRequest path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(CreatePlannedFeesRequest, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', CreatePlannedFeesResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CreatePlannedFeesRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/plannedfees`, { @@ -468,145 +682,190 @@ export class MambuLoanAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: CreatePlannedFeesResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete loan account */ - public async delete({ + public delete({ path, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`loans/${path.loanAccountId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Represents the information needed to delete a card associated to an account using its reference token. */ - public async deleteCard({ + public deleteCard({ path, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string; cardReferenceToken: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string; cardReferenceToken: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`loans/${path.loanAccountId}/cards/${path.cardReferenceToken}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete loan account funding sources */ - public async deleteFundingSources({ + public deleteFundingSources({ path, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`loans/${path.loanAccountId}/funding`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete planned fee */ - public async deletePlannedFees({ + public deletePlannedFees({ path, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string; plannedInstallmentFeeKey: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string; plannedInstallmentFeeKey: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`loans/${path.loanAccountId}/plannedfees/${path.plannedInstallmentFeeKey}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete loan account funding source */ - public async deleteSingleFundingSource({ + public deleteSingleFundingSource({ path, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string; fundEncodedKey: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string; fundEncodedKey: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`loans/${path.loanAccountId}/funding/${path.fundEncodedKey}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get loan accounts */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { @@ -624,9 +883,21 @@ export class MambuLoanAccounts { sortBy?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`loans`, { + this.buildClient(auth).get('loans', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -636,14 +907,14 @@ export class MambuLoanAccounts { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get authorization holds related to a loan account, ordered from newest to oldest by creation date */ - public async getAllAuthorizationHolds({ + public getAllAuthorizationHolds({ path, query, auth = [['apiKey'], ['basic']], @@ -651,7 +922,20 @@ export class MambuLoanAccounts { path: { loanAccountId: string } query?: { offset?: string; limit?: string; paginationDetails?: string; status?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetAllAuthorizationHoldsResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/authorizationholds`, { searchParams: query ?? {}, @@ -664,20 +948,30 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get cards associated with an account */ - public async getAllCards({ + public getAllCards({ path, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', GetAllCardsResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/cards`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -689,20 +983,29 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get planned fees */ - public async getAllPlannedFees({ + public getAllPlannedFees({ path, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', GetAllPlannedFeesResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/plannedfees`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -713,22 +1016,31 @@ export class MambuLoanAccounts { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get loan account */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', LoanAccount> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}`, { searchParams: query ?? {}, @@ -741,14 +1053,14 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get loan account document */ - public async getLoanAccountDocument({ + public getLoanAccountDocument({ path, query, auth = [['apiKey'], ['basic']], @@ -756,7 +1068,20 @@ export class MambuLoanAccounts { path: { loanAccountId: string; templateId: string } query?: { startDate?: string; endDate?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetLoanAccountDocumentResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/templates/${path.templateId}`, { searchParams: query ?? {}, @@ -769,14 +1094,14 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Download loan account document PDF */ - public async getPdfDocument({ + public getPdfDocument({ path, query, auth = [['apiKey'], ['basic']], @@ -784,35 +1109,62 @@ export class MambuLoanAccounts { path: { loanAccountId: string; templateId: string } query?: { startDate?: string; endDate?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/templates/${path.templateId}/pdf`, { searchParams: query ?? {}, + responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Preview loan account schedule for non-existent loan account */ - public async getPreviewLoanAccountSchedule({ + public getPreviewLoanAccountSchedule({ body, auth = [['apiKey'], ['basic']], - }: { - body: PreviewLoanAccountSchedule - auth?: string[][] | string[] - }) { - this.validateRequestBody(PreviewLoanAccountSchedule, body) + }: { body: PreviewLoanAccountSchedule; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', LoanAccountSchedule> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PreviewLoanAccountSchedule, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`loans:previewSchedule`, { + this.buildClient(auth).post('loans:previewSchedule', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -822,22 +1174,31 @@ export class MambuLoanAccounts { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get all versions of loan account */ - public async getVersionsById({ + public getVersionsById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { loanAccountId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { loanAccountId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', GetVersionsByIdResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}:versions`, { searchParams: query ?? {}, @@ -850,44 +1211,56 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update loan account */ - public async patch({ + public patch({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: PatchRequest - path: { loanAccountId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }: { body: PatchRequest; path: { loanAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`loans/${path.loanAccountId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update loan account funding source */ - public async patchFundingSource({ + public patchFundingSource({ body, path, auth = [['apiKey'], ['basic']], @@ -895,29 +1268,45 @@ export class MambuLoanAccounts { body: PatchFundingSourceRequest path: { loanAccountId: string; fundEncodedKey: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchFundingSourceRequest, body) + }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchFundingSourceRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`loans/${path.loanAccountId}/funding/${path.fundEncodedKey}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Pay off loan account */ - public async payOff({ + public payOff({ body, path, headers, @@ -925,32 +1314,50 @@ export class MambuLoanAccounts { }: { body: LoanAccountPayOffInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanAccountPayOffInput, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanAccountPayOffInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:payOff`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Preview pay off due amounts in a future date */ - public async previewPayOffAmounts({ + public previewPayOffAmounts({ body, path, headers, @@ -958,10 +1365,28 @@ export class MambuLoanAccounts { }: { body: PreviewPayOffDueAmountsInAFutureDateInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(PreviewPayOffDueAmountsInAFutureDateInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', PreviewPayOffDueAmountsInAFutureDateWrapper> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PreviewPayOffDueAmountsInAFutureDateInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:previewPayOffAmounts`, { @@ -970,50 +1395,63 @@ export class MambuLoanAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: PreviewPayOffDueAmountsInAFutureDateWrapper, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update collateral asset amounts */ - public async reevaluateCollateralAssets({ + public reevaluateCollateralAssets({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: CollateralAssetFilter - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(CollateralAssetFilter, body) + }: { body: CollateralAssetFilter; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'202', CollateralAssetsReevaluationResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CollateralAssetFilter, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`loans:reevaluateCollateral`, { + this.buildClient(auth).post('loans:reevaluateCollateral', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 202: CollateralAssetsReevaluationResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Refinance loan account */ - public async refinance({ + public refinance({ body, path, headers, @@ -1021,10 +1459,28 @@ export class MambuLoanAccounts { }: { body: RefinanceLoanAccountAction path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(RefinanceLoanAccountAction, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', LoanAccount> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(RefinanceLoanAccountAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:refinance`, { @@ -1033,20 +1489,20 @@ export class MambuLoanAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: LoanAccount, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Reschedule loan account */ - public async reschedule({ + public reschedule({ body, path, headers, @@ -1054,10 +1510,28 @@ export class MambuLoanAccounts { }: { body: RescheduleLoanAccountAction path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(RescheduleLoanAccountAction, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', LoanAccount> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(RescheduleLoanAccountAction, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:reschedule`, { @@ -1066,20 +1540,20 @@ export class MambuLoanAccounts { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: LoanAccount, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Search loan accounts */ - public async search({ + public search({ body, query, auth = [['apiKey'], ['basic']], @@ -1087,11 +1561,28 @@ export class MambuLoanAccounts { body: LoanAccountSearchCriteria query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanAccountSearchCriteria, body) + }): Promise< + | SuccessResponse<'200', SearchResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanAccountSearchCriteria, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`loans:search`, { + this.buildClient(auth).post('loans:search', { json: body, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -1103,14 +1594,14 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Terminate loan account */ - public async terminateLoanAccount({ + public terminateLoanAccount({ body, path, headers, @@ -1118,32 +1609,50 @@ export class MambuLoanAccounts { }: { body: TerminateLoanAccountInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(TerminateLoanAccountInput, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(TerminateLoanAccountInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:terminate`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Undo loan account refinance action */ - public async undoRefinance({ + public undoRefinance({ body, path, headers, @@ -1151,32 +1660,50 @@ export class MambuLoanAccounts { }: { body: LoanActionDetails path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanActionDetails, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanActionDetails, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:undoRefinance`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Undo loan account reschedule action */ - public async undoReschedule({ + public undoReschedule({ body, path, headers, @@ -1184,32 +1711,50 @@ export class MambuLoanAccounts { }: { body: LoanActionDetails path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanActionDetails, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanActionDetails, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:undoReschedule`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Undo write off for loan account */ - public async undoWriteOff({ + public undoWriteOff({ body, path, headers, @@ -1217,41 +1762,72 @@ export class MambuLoanAccounts { }: { body: LoanActionDetails path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanActionDetails, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanActionDetails, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:undoWriteOff`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update loan account */ - public async update({ + public update({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: LoanAccount - path: { loanAccountId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanAccount, body) + }: { body: LoanAccount; path: { loanAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', LoanAccount> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanAccount, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`loans/${path.loanAccountId}`, { @@ -1265,23 +1841,36 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update loan account funding sources */ - public async updateLoanAccountFundingSources({ + public updateLoanAccountFundingSources({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: UpdateLoanAccountFundingSourcesRequest - path: { loanAccountId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(UpdateLoanAccountFundingSourcesRequest, body) + }: { body: UpdateLoanAccountFundingSourcesRequest; path: { loanAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', UpdateLoanAccountFundingSourcesResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(UpdateLoanAccountFundingSourcesRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`loans/${path.loanAccountId}/funding`, { @@ -1295,23 +1884,36 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update planned fees */ - public async updatePlannedFees({ + public updatePlannedFees({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: UpdatePlannedFeesRequest - path: { loanAccountId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(UpdatePlannedFeesRequest, body) + }: { body: UpdatePlannedFeesRequest; path: { loanAccountId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', UpdatePlannedFeesResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(UpdatePlannedFeesRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`loans/${path.loanAccountId}/plannedfees`, { @@ -1325,14 +1927,14 @@ export class MambuLoanAccounts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Write off loan account */ - public async writeOff({ + public writeOff({ body, path, headers, @@ -1340,63 +1942,102 @@ export class MambuLoanAccounts { }: { body: LoanActionDetails path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanActionDetails, body) + }): 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 + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanActionDetails, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}:writeOff`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 102: { is: (_x: unknown): _x is unknown => true }, - 204: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -1423,24 +2064,52 @@ export class MambuLoanAccounts { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/loan-accounts/rest.type.ts b/src/loan-accounts/rest.type.ts index c33e1fb..d19becb 100644 --- a/src/loan-accounts/rest.type.ts +++ b/src/loan-accounts/rest.type.ts @@ -3,8 +3,50 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ApplyInterestInputValidator } from './schemas/apply-interest-input.schema.js' +import { validate as ApplyPlannedFeesResponseValidator } from './schemas/apply-planned-fees-response.schema.js' +import { validate as CardValidator } from './schemas/card.schema.js' +import { validate as ChangeArrearsSettingsInputValidator } from './schemas/change-arrears-settings-input.schema.js' +import { validate as ChangeDueDatesSettingsInputValidator } from './schemas/change-due-dates-settings-input.schema.js' +import { validate as ChangeInterestRateLoanAccountInputValidator } from './schemas/change-interest-rate-loan-account-input.schema.js' +import { validate as ChangePeriodicPaymentLoanAccountInputValidator } from './schemas/change-periodic-payment-loan-account-input.schema.js' +import { validate as ChangeRepaymentValueLoanAccountInputValidator } from './schemas/change-repayment-value-loan-account-input.schema.js' +import { validate as CollateralAssetFilterValidator } from './schemas/collateral-asset-filter.schema.js' +import { validate as CollateralAssetsReevaluationResponseValidator } from './schemas/collateral-assets-reevaluation-response.schema.js' +import { validate as CreateLoanAccountFundingSourcesRequestValidator } from './schemas/create-loan-account-funding-sources-request.schema.js' +import { validate as CreateLoanAccountFundingSourcesResponseValidator } from './schemas/create-loan-account-funding-sources-response.schema.js' +import { validate as CreatePlannedFeesRequestValidator } from './schemas/create-planned-fees-request.schema.js' +import { validate as CreatePlannedFeesResponseValidator } from './schemas/create-planned-fees-response.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as GetAllAuthorizationHoldsResponseValidator } from './schemas/get-all-authorization-holds-response.schema.js' +import { validate as GetAllCardsResponseValidator } from './schemas/get-all-cards-response.schema.js' +import { validate as GetAllPlannedFeesResponseValidator } from './schemas/get-all-planned-fees-response.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' +import { validate as GetLoanAccountDocumentResponseValidator } from './schemas/get-loan-account-document-response.schema.js' +import { validate as GetVersionsByIdResponseValidator } from './schemas/get-versions-by-id-response.schema.js' +import { validate as LoanAccountActionValidator } from './schemas/loan-account-action.schema.js' +import { validate as LoanAccountPayOffInputValidator } from './schemas/loan-account-pay-off-input.schema.js' +import { validate as LoanAccountScheduleValidator } from './schemas/loan-account-schedule.schema.js' +import { validate as LoanAccountSearchCriteriaValidator } from './schemas/loan-account-search-criteria.schema.js' +import { validate as LoanAccountValidator } from './schemas/loan-account.schema.js' +import { validate as LoanActionDetailsValidator } from './schemas/loan-action-details.schema.js' +import { validate as PatchFundingSourceRequestValidator } from './schemas/patch-funding-source-request.schema.js' +import { validate as PatchRequestValidator } from './schemas/patch-request.schema.js' +import { validate as PlannedFeeKeysValidator } from './schemas/planned-fee-keys.schema.js' +import { validate as PreviewLoanAccountScheduleValidator } from './schemas/preview-loan-account-schedule.schema.js' +import { validate as PreviewPayOffDueAmountsInAFutureDateInputValidator } from './schemas/preview-pay-off-due-amounts-in-a-future-date-input.schema.js' +import { validate as PreviewPayOffDueAmountsInAFutureDateWrapperValidator } from './schemas/preview-pay-off-due-amounts-in-a-future-date-wrapper.schema.js' +import { validate as RefinanceLoanAccountActionValidator } from './schemas/refinance-loan-account-action.schema.js' +import { validate as RescheduleLoanAccountActionValidator } from './schemas/reschedule-loan-account-action.schema.js' +import { validate as SearchResponseValidator } from './schemas/search-response.schema.js' +import { validate as TerminateLoanAccountInputValidator } from './schemas/terminate-loan-account-input.schema.js' +import { validate as UpdateLoanAccountFundingSourcesRequestValidator } from './schemas/update-loan-account-funding-sources-request.schema.js' +import { validate as UpdateLoanAccountFundingSourcesResponseValidator } from './schemas/update-loan-account-funding-sources-response.schema.js' +import { validate as UpdatePlannedFeesRequestValidator } from './schemas/update-planned-fees-request.schema.js' +import { validate as UpdatePlannedFeesResponseValidator } from './schemas/update-planned-fees-response.schema.js' /** * The account arrears settings, holds the required information for the arrears settings of an account. @@ -17,34 +59,35 @@ export interface AccountArrearsSettings { | 'ACCOUNT_FIRST_WENT_TO_ARREARS' | 'LAST_LATE_REPAYMENT' | 'ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD' + | undefined /** * The encoded key of the arrears base settings, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Defines monthly arrears tolerance day value. */ - monthlyToleranceDay?: number + monthlyToleranceDay?: number | undefined /** * Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears */ - nonWorkingDaysMethod?: 'INCLUDED' | 'EXCLUDED' + nonWorkingDaysMethod?: 'INCLUDED' | 'EXCLUDED' | undefined /** * Defines the tolerance calculation method */ - toleranceCalculationMethod?: 'ARREARS_TOLERANCE_PERIOD' | 'MONTHLY_ARREARS_TOLERANCE_DAY' + toleranceCalculationMethod?: 'ARREARS_TOLERANCE_PERIOD' | 'MONTHLY_ARREARS_TOLERANCE_DAY' | undefined /** * The tolerance floor amount. */ - toleranceFloorAmount?: number + toleranceFloorAmount?: number | undefined /** * Defines the arrears tolerance amount. */ - tolerancePercentageOfOutstandingPrincipal?: number + tolerancePercentageOfOutstandingPrincipal?: number | undefined /** * Defines the arrears tolerance period value. */ - tolerancePeriod?: number + tolerancePeriod?: number | undefined } /** @@ -54,27 +97,27 @@ export interface AccountBalances { /** * The unique account identifier */ - accountId?: string + accountId?: string | undefined /** * The available balance of a deposit or credit account */ - availableBalance?: number + availableBalance?: number | undefined /** * The card type either DEBIT or CREDIT */ - cardType?: 'DEBIT' | 'CREDIT' + cardType?: 'DEBIT' | 'CREDIT' | undefined /** * The overdraft limit of a deposit account or the loan amount in case of a credit account */ - creditLimit?: number + creditLimit?: number | undefined /** * Currency code used for the account */ - currencyCode?: string + currencyCode?: string | undefined /** * The current balance of a deposit account or principal balance of a revolving credit */ - totalBalance?: number + totalBalance?: number | undefined } /** @@ -84,31 +127,31 @@ export interface AccountInterestRateSettings { /** * The encoded key of the interest rate settings, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Index rate source key. */ - indexSourceKey?: string + indexSourceKey?: string | undefined /** * Interest rate value. */ - interestRate?: number + interestRate?: number | undefined /** * Maximum value allowed for index based interest rate. Valid only for index interest rate. */ - interestRateCeilingValue?: number + interestRateCeilingValue?: number | undefined /** * Minimum value allowed for index based interest rate. Valid only for index interest rate. */ - interestRateFloorValue?: number + interestRateFloorValue?: number | undefined /** * Interest rate review frequency unit count. Valid only for index interest rate. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * Interest rate review frequency measurement unit. Valid only for index interest rate. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * Interest calculation method: fixed or indexed(interest spread + active organization index interest rate) */ @@ -116,7 +159,7 @@ export interface AccountInterestRateSettings { /** * Interest spread value. */ - interestSpread?: number + interestSpread?: number | undefined /** * Date since an interest rate is valid */ @@ -130,15 +173,15 @@ export interface Amount { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined } /** @@ -148,19 +191,19 @@ export interface AmountWithReduced { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined /** * The reduced amount. */ - reduced?: number + reduced?: number | undefined } /** @@ -174,19 +217,19 @@ export interface ApplyInterestInput { /** * 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. */ - isPaymentHolidaysInterest?: boolean + isPaymentHolidaysInterest?: boolean | undefined /** * Additional information for this action */ - notes?: string + notes?: string | undefined /** * The amount of the Payment Holidays interest to apply */ - paymentHolidaysInterestAmount?: number + paymentHolidaysInterestAmount?: number | undefined } export const ApplyInterestInput = { - validate: (await import('./schemas/apply-interest-input.schema.js')).validate as ValidateFunction, + validate: ApplyInterestInputValidator as ValidateFunction, get schema() { return ApplyInterestInput.validate.schema }, @@ -194,18 +237,18 @@ export const ApplyInterestInput = { return ApplyInterestInput.validate.errors ?? undefined }, is: (o: unknown): o is ApplyInterestInput => ApplyInterestInput.validate(o) === true, - assert: (o: unknown) => { - if (!ApplyInterestInput.validate(o)) { - throw new ValidationError(ApplyInterestInput.errors ?? []) + parse: (o: unknown): { right: ApplyInterestInput } | { left: DefinedError[] } => { + if (ApplyInterestInput.is(o)) { + return { right: o } } + return { left: (ApplyInterestInput.errors ?? []) as DefinedError[] } }, } as const export type ApplyPlannedFeesResponse = LoanTransaction[] export const ApplyPlannedFeesResponse = { - validate: (await import('./schemas/apply-planned-fees-response.schema.js')) - .validate as ValidateFunction, + validate: ApplyPlannedFeesResponseValidator as ValidateFunction, get schema() { return ApplyPlannedFeesResponse.validate.schema }, @@ -213,6 +256,12 @@ export const ApplyPlannedFeesResponse = { return ApplyPlannedFeesResponse.validate.errors ?? undefined }, is: (o: unknown): o is ApplyPlannedFeesResponse => ApplyPlannedFeesResponse.validate(o) === true, + parse: (o: unknown): { right: ApplyPlannedFeesResponse } | { left: DefinedError[] } => { + if (ApplyPlannedFeesResponse.is(o)) { + return { right: o } + } + return { left: (ApplyPlannedFeesResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -230,24 +279,24 @@ export interface Asset { /** * The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null. */ - depositAccountKey?: string + depositAccountKey?: string | undefined /** * The encoded key of the security, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The key of the client/group used as the guarantor. */ - guarantorKey?: string + guarantorKey?: string | undefined /** * The type of the guarantor (client/group) */ - guarantorType?: 'CLIENT' | 'GROUP' + guarantorType?: 'CLIENT' | 'GROUP' | undefined /** * The original amount used by the client for a collateral asset */ - originalAmount?: number - originalCurrency?: Currency + originalAmount?: number | undefined + originalCurrency?: Currency | undefined } /** @@ -257,71 +306,71 @@ export interface Balances { /** * The fees balance. Represents the total fees expected to be paid on this account at a given moment. */ - feesBalance?: number + feesBalance?: number | undefined /** * The fees due. Representing the total fees due for the account. */ - feesDue?: number + feesDue?: number | undefined /** * The fees paid. Represents the total fees paid for the account. */ - feesPaid?: number + feesPaid?: number | undefined /** * The sum of all the authorization hold amounts on this account. */ - holdBalance?: number + holdBalance?: number | undefined /** * Represents the total interest owed by the client (total interest applied for account minus interest paid). */ - interestBalance?: number + interestBalance?: number | undefined /** * The interest due. Indicates how much interest it's due for the account at this moment. */ - interestDue?: number + interestDue?: number | undefined /** * 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). */ - interestFromArrearsBalance?: number + interestFromArrearsBalance?: number | undefined /** * The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment. */ - interestFromArrearsDue?: number + interestFromArrearsDue?: number | undefined /** * The interest from arrears paid, indicates total interest from arrears paid into the account. */ - interestFromArrearsPaid?: number + interestFromArrearsPaid?: number | undefined /** * The interest paid, indicates total interest paid into the account. */ - interestPaid?: number + interestPaid?: number | undefined /** * The penalty balance. Represents the total penalty expected to be paid on this account at a given moment. */ - penaltyBalance?: number + penaltyBalance?: number | undefined /** * The penalty due. Represents the total penalty amount due for the account. */ - penaltyDue?: number + penaltyDue?: number | undefined /** * The Penalty paid. Represents the total penalty amount paid for the account. */ - penaltyPaid?: number + penaltyPaid?: number | undefined /** * The total principal owned by the client, from now on (principal disbursed - principal paid). */ - principalBalance?: number + principalBalance?: number | undefined /** * The principal due, indicates how much principal it's due at this moment. */ - principalDue?: number + principalDue?: number | undefined /** * The principal paid, holds the value of the total paid into the account. */ - principalPaid?: number + principalPaid?: number | undefined /** * The total redraw amount owned by the client, from now on. */ - redrawBalance?: number + redrawBalance?: number | undefined } /** @@ -331,7 +380,7 @@ export interface BillingCycleDays { /** * The billing cycle start days in case it is enabled */ - days?: number[] + days?: number[] | undefined } /** @@ -345,7 +394,7 @@ export interface Card { } export const Card = { - validate: (await import('./schemas/card.schema.js')).validate as ValidateFunction, + validate: CardValidator as ValidateFunction, get schema() { return Card.validate.schema }, @@ -353,10 +402,11 @@ export const Card = { return Card.validate.errors ?? undefined }, is: (o: unknown): o is Card => Card.validate(o) === true, - assert: (o: unknown) => { - if (!Card.validate(o)) { - throw new ValidationError(Card.errors ?? []) + parse: (o: unknown): { right: Card } | { left: DefinedError[] } => { + if (Card.is(o)) { + return { right: o } } + return { left: (Card.errors ?? []) as DefinedError[] } }, } as const @@ -367,31 +417,31 @@ export interface CardAcceptor { /** * The city in which the card acceptor has the business. */ - city?: string + city?: string | undefined /** * The country in which the card acceptor has the business. */ - country?: string + country?: string | undefined /** * The Merchant Category Code of the card acceptor. */ - mcc?: number + mcc?: number | undefined /** * The name of the card acceptor. */ - name?: string + name?: string | undefined /** * The state in which the card acceptor has the business. */ - state?: string + state?: string | undefined /** * The street in which the card acceptor has the business. */ - street?: string + street?: string | undefined /** * The ZIP code of the location in which the card acceptor has the business. */ - zip?: string + zip?: string | undefined } /** @@ -406,23 +456,23 @@ export interface CardTransaction { * The amount of money to be withdrawn in the financial transaction. */ amount: number - cardAcceptor?: CardAcceptor + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * 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. */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external authorization hold reference ID, which relates this card transaction to a previous authorization hold. */ - externalAuthorizationReferenceId?: string + externalAuthorizationReferenceId?: string | undefined /** * The external reference ID to be used to reference the card transaction in subsequent requests. */ @@ -430,7 +480,7 @@ export interface CardTransaction { /** * The formatted time at which the user made this card transaction. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } /** @@ -448,12 +498,11 @@ export interface ChangeArrearsSettingsInput { /** * The notes for the change arrears settings action performed on the loan account */ - notes?: string + notes?: string | undefined } export const ChangeArrearsSettingsInput = { - validate: (await import('./schemas/change-arrears-settings-input.schema.js')) - .validate as ValidateFunction, + validate: ChangeArrearsSettingsInputValidator as ValidateFunction, get schema() { return ChangeArrearsSettingsInput.validate.schema }, @@ -461,10 +510,11 @@ export const ChangeArrearsSettingsInput = { return ChangeArrearsSettingsInput.validate.errors ?? undefined }, is: (o: unknown): o is ChangeArrearsSettingsInput => ChangeArrearsSettingsInput.validate(o) === true, - assert: (o: unknown) => { - if (!ChangeArrearsSettingsInput.validate(o)) { - throw new ValidationError(ChangeArrearsSettingsInput.errors ?? []) + parse: (o: unknown): { right: ChangeArrearsSettingsInput } | { left: DefinedError[] } => { + if (ChangeArrearsSettingsInput.is(o)) { + return { right: o } } + return { left: (ChangeArrearsSettingsInput.errors ?? []) as DefinedError[] } }, } as const @@ -475,7 +525,7 @@ export interface ChangeDueDatesSettingsInput { /** * The date when to change the due dates settings - deprecated, use valueDate instead */ - entryDate?: string + entryDate?: string | undefined /** * The new fixed days of month to be used on the account */ @@ -483,16 +533,15 @@ export interface ChangeDueDatesSettingsInput { /** * The notes for the change due dates settings action performed on the loan account */ - notes?: string + notes?: string | undefined /** * The date when to change the due dates settings */ - valueDate?: string + valueDate?: string | undefined } export const ChangeDueDatesSettingsInput = { - validate: (await import('./schemas/change-due-dates-settings-input.schema.js')) - .validate as ValidateFunction, + validate: ChangeDueDatesSettingsInputValidator as ValidateFunction, get schema() { return ChangeDueDatesSettingsInput.validate.schema }, @@ -500,10 +549,11 @@ export const ChangeDueDatesSettingsInput = { return ChangeDueDatesSettingsInput.validate.errors ?? undefined }, is: (o: unknown): o is ChangeDueDatesSettingsInput => ChangeDueDatesSettingsInput.validate(o) === true, - assert: (o: unknown) => { - if (!ChangeDueDatesSettingsInput.validate(o)) { - throw new ValidationError(ChangeDueDatesSettingsInput.errors ?? []) + parse: (o: unknown): { right: ChangeDueDatesSettingsInput } | { left: DefinedError[] } => { + if (ChangeDueDatesSettingsInput.is(o)) { + return { right: o } } + return { left: (ChangeDueDatesSettingsInput.errors ?? []) as DefinedError[] } }, } as const @@ -514,15 +564,15 @@ export interface ChangeInterestRateLoanAccountInput { /** * The new interest rate to be available on the account */ - interestRate?: number + interestRate?: number | undefined /** * The new interest spread to be available on the account */ - interestSpread?: number + interestSpread?: number | undefined /** * The notes for the change interest rate action performed on the loan account */ - notes?: string + notes?: string | undefined /** * The date when to change the interest rate (as Organization Time) */ @@ -530,8 +580,7 @@ export interface ChangeInterestRateLoanAccountInput { } export const ChangeInterestRateLoanAccountInput = { - validate: (await import('./schemas/change-interest-rate-loan-account-input.schema.js')) - .validate as ValidateFunction, + validate: ChangeInterestRateLoanAccountInputValidator as ValidateFunction, get schema() { return ChangeInterestRateLoanAccountInput.validate.schema }, @@ -539,10 +588,11 @@ export const ChangeInterestRateLoanAccountInput = { return ChangeInterestRateLoanAccountInput.validate.errors ?? undefined }, is: (o: unknown): o is ChangeInterestRateLoanAccountInput => ChangeInterestRateLoanAccountInput.validate(o) === true, - assert: (o: unknown) => { - if (!ChangeInterestRateLoanAccountInput.validate(o)) { - throw new ValidationError(ChangeInterestRateLoanAccountInput.errors ?? []) + parse: (o: unknown): { right: ChangeInterestRateLoanAccountInput } | { left: DefinedError[] } => { + if (ChangeInterestRateLoanAccountInput.is(o)) { + return { right: o } } + return { left: (ChangeInterestRateLoanAccountInput.errors ?? []) as DefinedError[] } }, } as const @@ -553,7 +603,7 @@ export interface ChangePeriodicPaymentLoanAccountInput { /** * The notes for the change periodic payment action performed on the loan account */ - notes?: string + notes?: string | undefined /** * The new periodic payment to be available on the account */ @@ -565,8 +615,7 @@ export interface ChangePeriodicPaymentLoanAccountInput { } export const ChangePeriodicPaymentLoanAccountInput = { - validate: (await import('./schemas/change-periodic-payment-loan-account-input.schema.js')) - .validate as ValidateFunction, + validate: ChangePeriodicPaymentLoanAccountInputValidator as ValidateFunction, get schema() { return ChangePeriodicPaymentLoanAccountInput.validate.schema }, @@ -574,10 +623,11 @@ export const ChangePeriodicPaymentLoanAccountInput = { return ChangePeriodicPaymentLoanAccountInput.validate.errors ?? undefined }, is: (o: unknown): o is ChangePeriodicPaymentLoanAccountInput => ChangePeriodicPaymentLoanAccountInput.validate(o) === true, - assert: (o: unknown) => { - if (!ChangePeriodicPaymentLoanAccountInput.validate(o)) { - throw new ValidationError(ChangePeriodicPaymentLoanAccountInput.errors ?? []) + parse: (o: unknown): { right: ChangePeriodicPaymentLoanAccountInput } | { left: DefinedError[] } => { + if (ChangePeriodicPaymentLoanAccountInput.is(o)) { + return { right: o } } + return { left: (ChangePeriodicPaymentLoanAccountInput.errors ?? []) as DefinedError[] } }, } as const @@ -588,15 +638,15 @@ export interface ChangeRepaymentValueLoanAccountInput { /** * Fixed amount for being used for the repayments principal due */ - amount?: number + amount?: number | undefined /** * Notes for the repayment value change action performed on the loan account */ - notes?: string + notes?: string | undefined /** * Percentage of principal amount used for the repayments principal due */ - percentage?: number + percentage?: number | undefined /** * Date when to change the repayment value (as Organization Time) */ @@ -604,8 +654,7 @@ export interface ChangeRepaymentValueLoanAccountInput { } export const ChangeRepaymentValueLoanAccountInput = { - validate: (await import('./schemas/change-repayment-value-loan-account-input.schema.js')) - .validate as ValidateFunction, + validate: ChangeRepaymentValueLoanAccountInputValidator as ValidateFunction, get schema() { return ChangeRepaymentValueLoanAccountInput.validate.schema }, @@ -613,10 +662,11 @@ export const ChangeRepaymentValueLoanAccountInput = { return ChangeRepaymentValueLoanAccountInput.validate.errors ?? undefined }, is: (o: unknown): o is ChangeRepaymentValueLoanAccountInput => ChangeRepaymentValueLoanAccountInput.validate(o) === true, - assert: (o: unknown) => { - if (!ChangeRepaymentValueLoanAccountInput.validate(o)) { - throw new ValidationError(ChangeRepaymentValueLoanAccountInput.errors ?? []) + parse: (o: unknown): { right: ChangeRepaymentValueLoanAccountInput } | { left: DefinedError[] } => { + if (ChangeRepaymentValueLoanAccountInput.is(o)) { + return { right: o } } + return { left: (ChangeRepaymentValueLoanAccountInput.errors ?? []) as DefinedError[] } }, } as const @@ -627,19 +677,19 @@ export interface CollateralAssetFilter { /** * Assets of the loan accounts that will be filtered by the branch keys in the background process */ - branchKeys?: string[] + branchKeys?: string[] | undefined /** * Assets of the loan accounts that will be filtered by the currency codes in the background process */ - currencies?: string[] + currencies?: string[] | undefined /** * Assets of the loan accounts that will be filtered by the product keys in the background process */ - productKeys?: string[] + productKeys?: string[] | undefined } export const CollateralAssetFilter = { - validate: (await import('./schemas/collateral-asset-filter.schema.js')).validate as ValidateFunction, + validate: CollateralAssetFilterValidator as ValidateFunction, get schema() { return CollateralAssetFilter.validate.schema }, @@ -647,10 +697,11 @@ export const CollateralAssetFilter = { return CollateralAssetFilter.validate.errors ?? undefined }, is: (o: unknown): o is CollateralAssetFilter => CollateralAssetFilter.validate(o) === true, - assert: (o: unknown) => { - if (!CollateralAssetFilter.validate(o)) { - throw new ValidationError(CollateralAssetFilter.errors ?? []) + parse: (o: unknown): { right: CollateralAssetFilter } | { left: DefinedError[] } => { + if (CollateralAssetFilter.is(o)) { + return { right: o } } + return { left: (CollateralAssetFilter.errors ?? []) as DefinedError[] } }, } as const @@ -661,7 +712,7 @@ export interface CollateralAssetsReevaluationResponse { /** * The encoded key of the collateral assets reevaluation task */ - bulkProcessKey?: string + bulkProcessKey?: string | undefined /** * The collateral assets reevaluation status */ @@ -677,11 +728,11 @@ export interface CollateralAssetsReevaluationResponse { | 'TRANSIENT_ERROR' | 'OVERRIDDEN' | 'RECOVERABLE_ERROR' + | undefined } export const CollateralAssetsReevaluationResponse = { - validate: (await import('./schemas/collateral-assets-reevaluation-response.schema.js')) - .validate as ValidateFunction, + validate: CollateralAssetsReevaluationResponseValidator as ValidateFunction, get schema() { return CollateralAssetsReevaluationResponse.validate.schema }, @@ -689,13 +740,18 @@ export const CollateralAssetsReevaluationResponse = { return CollateralAssetsReevaluationResponse.validate.errors ?? undefined }, is: (o: unknown): o is CollateralAssetsReevaluationResponse => CollateralAssetsReevaluationResponse.validate(o) === true, + parse: (o: unknown): { right: CollateralAssetsReevaluationResponse } | { left: DefinedError[] } => { + if (CollateralAssetsReevaluationResponse.is(o)) { + return { right: o } + } + return { left: (CollateralAssetsReevaluationResponse.errors ?? []) as DefinedError[] } + }, } as const export type CreateLoanAccountFundingSourcesRequest = InvestorFund[] export const CreateLoanAccountFundingSourcesRequest = { - validate: (await import('./schemas/create-loan-account-funding-sources-request.schema.js')) - .validate as ValidateFunction, + validate: CreateLoanAccountFundingSourcesRequestValidator as ValidateFunction, get schema() { return CreateLoanAccountFundingSourcesRequest.validate.schema }, @@ -703,18 +759,18 @@ export const CreateLoanAccountFundingSourcesRequest = { return CreateLoanAccountFundingSourcesRequest.validate.errors ?? undefined }, is: (o: unknown): o is CreateLoanAccountFundingSourcesRequest => CreateLoanAccountFundingSourcesRequest.validate(o) === true, - assert: (o: unknown) => { - if (!CreateLoanAccountFundingSourcesRequest.validate(o)) { - throw new ValidationError(CreateLoanAccountFundingSourcesRequest.errors ?? []) + parse: (o: unknown): { right: CreateLoanAccountFundingSourcesRequest } | { left: DefinedError[] } => { + if (CreateLoanAccountFundingSourcesRequest.is(o)) { + return { right: o } } + return { left: (CreateLoanAccountFundingSourcesRequest.errors ?? []) as DefinedError[] } }, } as const export type CreateLoanAccountFundingSourcesResponse = InvestorFund[] export const CreateLoanAccountFundingSourcesResponse = { - validate: (await import('./schemas/create-loan-account-funding-sources-response.schema.js')) - .validate as ValidateFunction, + validate: CreateLoanAccountFundingSourcesResponseValidator as ValidateFunction, get schema() { return CreateLoanAccountFundingSourcesResponse.validate.schema }, @@ -723,13 +779,18 @@ export const CreateLoanAccountFundingSourcesResponse = { }, is: (o: unknown): o is CreateLoanAccountFundingSourcesResponse => CreateLoanAccountFundingSourcesResponse.validate(o) === true, + parse: (o: unknown): { right: CreateLoanAccountFundingSourcesResponse } | { left: DefinedError[] } => { + if (CreateLoanAccountFundingSourcesResponse.is(o)) { + return { right: o } + } + return { left: (CreateLoanAccountFundingSourcesResponse.errors ?? []) as DefinedError[] } + }, } as const export type CreatePlannedFeesRequest = PlannedInstallmentFee[] export const CreatePlannedFeesRequest = { - validate: (await import('./schemas/create-planned-fees-request.schema.js')) - .validate as ValidateFunction, + validate: CreatePlannedFeesRequestValidator as ValidateFunction, get schema() { return CreatePlannedFeesRequest.validate.schema }, @@ -737,18 +798,18 @@ export const CreatePlannedFeesRequest = { return CreatePlannedFeesRequest.validate.errors ?? undefined }, is: (o: unknown): o is CreatePlannedFeesRequest => CreatePlannedFeesRequest.validate(o) === true, - assert: (o: unknown) => { - if (!CreatePlannedFeesRequest.validate(o)) { - throw new ValidationError(CreatePlannedFeesRequest.errors ?? []) + parse: (o: unknown): { right: CreatePlannedFeesRequest } | { left: DefinedError[] } => { + if (CreatePlannedFeesRequest.is(o)) { + return { right: o } } + return { left: (CreatePlannedFeesRequest.errors ?? []) as DefinedError[] } }, } as const export type CreatePlannedFeesResponse = PlannedInstallmentFee[] export const CreatePlannedFeesResponse = { - validate: (await import('./schemas/create-planned-fees-response.schema.js')) - .validate as ValidateFunction, + validate: CreatePlannedFeesResponseValidator as ValidateFunction, get schema() { return CreatePlannedFeesResponse.validate.schema }, @@ -756,6 +817,12 @@ export const CreatePlannedFeesResponse = { return CreatePlannedFeesResponse.validate.errors ?? undefined }, is: (o: unknown): o is CreatePlannedFeesResponse => CreatePlannedFeesResponse.validate(o) === true, + parse: (o: unknown): { right: CreatePlannedFeesResponse } | { left: DefinedError[] } => { + if (CreatePlannedFeesResponse.is(o)) { + return { right: o } + } + return { left: (CreatePlannedFeesResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -949,15 +1016,17 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } /** @@ -982,11 +1051,11 @@ export interface CustomPaymentAmount { /** * The encodedKey of the predefined fee to be paid. */ - predefinedFeeKey?: string + predefinedFeeKey?: string | undefined /** * The amount of the taxes paid in the transaction for the given type. */ - taxOnAmount?: number + taxOnAmount?: number | undefined } /** @@ -996,19 +1065,19 @@ export interface CustomPredefinedFee { /** * The amount of the custom fee. */ - amount?: number + amount?: number | undefined /** * The encoded key of the custom predefined fee, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The percentage of the custom fee. */ - percentage?: number + percentage?: number | undefined /** * The encoded key of the predefined fee */ - predefinedFeeEncodedKey?: string + predefinedFeeEncodedKey?: string | undefined } /** @@ -1018,11 +1087,11 @@ export interface DaysInMonth { /** * 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. */ - daysInMonth?: number[] + daysInMonth?: number[] | undefined /** * 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. */ - shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' + shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' | undefined } /** @@ -1032,24 +1101,24 @@ export interface DisbursementDetails { /** * The activation date, the date when the disbursement actually took place. */ - disbursementDate?: string + disbursementDate?: string | undefined /** * The encoded key of the disbursement details, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The date of the expected disbursement.Stored as Organization Time. */ - expectedDisbursementDate?: string + expectedDisbursementDate?: string | undefined /** * List of fees that should be applied at the disbursement time. */ - fees?: CustomPredefinedFee[] + fees?: CustomPredefinedFee[] | undefined /** * The date of the expected first repayment. Stored as Organization Time. */ - firstRepaymentDate?: string - transactionDetails?: LoanTransactionDetails + firstRepaymentDate?: string | undefined + transactionDetails?: LoanTransactionDetails | undefined } /** @@ -1059,23 +1128,23 @@ export interface DisbursementDetailsForSchedulePreview { /** * The date of the expected disbursement.Stored as Organization Time. */ - expectedDisbursementDate?: string + expectedDisbursementDate?: string | undefined /** * List of fees that should be applied at the disbursement time. */ - fees?: CustomPredefinedFee[] + fees?: CustomPredefinedFee[] | undefined /** * The date of the expected first repayment. Stored as Organization Time. */ - firstRepaymentDate?: string + firstRepaymentDate?: string | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -1083,10 +1152,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -1097,11 +1167,11 @@ export interface Fee { /** * The amount of the fee that was applied/paid in the transaction for the given predefined fee. */ - amount?: number + amount?: number | undefined /** * The name of the predefined fee */ - name?: string + name?: string | undefined /** * The encoded key of the predefined fee, auto generated, unique */ @@ -1109,7 +1179,7 @@ export interface Fee { /** * The amount of the taxes on fee that was applied/paid in the transaction. */ - taxAmount?: number + taxAmount?: number | undefined /** * Shows the event that will trigger a fee */ @@ -1125,6 +1195,7 @@ export interface Fee { | 'ARBITRARY' | 'IOF' | 'EARLY_REPAYMENT_CHARGE' + | undefined } /** @@ -1134,26 +1205,25 @@ export interface FeeAmount { /** * The due amount. */ - due?: number + due?: number | undefined /** * The expected amount, which is sum of paid and due amounts. */ - expected?: number + expected?: number | undefined /** * The expected amount, which is the sum of unapplied fee and planned fee due amounts. */ - expectedUnapplied?: number + expectedUnapplied?: number | undefined /** * The paid amount. */ - paid?: number + paid?: number | undefined } export type GetAllAuthorizationHoldsResponse = GetAuthorizationHold[] export const GetAllAuthorizationHoldsResponse = { - validate: (await import('./schemas/get-all-authorization-holds-response.schema.js')) - .validate as ValidateFunction, + validate: GetAllAuthorizationHoldsResponseValidator as ValidateFunction, get schema() { return GetAllAuthorizationHoldsResponse.validate.schema }, @@ -1161,12 +1231,18 @@ export const GetAllAuthorizationHoldsResponse = { return GetAllAuthorizationHoldsResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllAuthorizationHoldsResponse => GetAllAuthorizationHoldsResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllAuthorizationHoldsResponse } | { left: DefinedError[] } => { + if (GetAllAuthorizationHoldsResponse.is(o)) { + return { right: o } + } + return { left: (GetAllAuthorizationHoldsResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetAllCardsResponse = Card[] export const GetAllCardsResponse = { - validate: (await import('./schemas/get-all-cards-response.schema.js')).validate as ValidateFunction, + validate: GetAllCardsResponseValidator as ValidateFunction, get schema() { return GetAllCardsResponse.validate.schema }, @@ -1174,13 +1250,18 @@ export const GetAllCardsResponse = { return GetAllCardsResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllCardsResponse => GetAllCardsResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllCardsResponse } | { left: DefinedError[] } => { + if (GetAllCardsResponse.is(o)) { + return { right: o } + } + return { left: (GetAllCardsResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetAllPlannedFeesResponse = PlannedInstallmentFee[] export const GetAllPlannedFeesResponse = { - validate: (await import('./schemas/get-all-planned-fees-response.schema.js')) - .validate as ValidateFunction, + validate: GetAllPlannedFeesResponseValidator as ValidateFunction, get schema() { return GetAllPlannedFeesResponse.validate.schema }, @@ -1188,12 +1269,18 @@ export const GetAllPlannedFeesResponse = { return GetAllPlannedFeesResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllPlannedFeesResponse => GetAllPlannedFeesResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllPlannedFeesResponse } | { left: DefinedError[] } => { + if (GetAllPlannedFeesResponse.is(o)) { + return { right: o } + } + return { left: (GetAllPlannedFeesResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetAllResponse = LoanAccount[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -1201,6 +1288,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -1210,7 +1303,7 @@ export interface GetAuthorizationHold { /** * The key of the account linked with the authorization hold. */ - accountKey?: string + accountKey?: string | undefined /** * Whether the given request should be accepted without balance validations. */ @@ -1219,36 +1312,36 @@ export interface GetAuthorizationHold { * The amount of money to be held as a result of the authorization hold request. */ amount: number - balances?: AccountBalances - cardAcceptor?: CardAcceptor + balances?: AccountBalances | undefined + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * The organization time when the authorization hold was created */ - creationDate?: string + creationDate?: string | undefined /** * Indicates whether the authorization hold amount is credited or debited.If not provided, the default values is DBIT. */ - creditDebitIndicator?: 'DBIT' | 'CRDT' + creditDebitIndicator?: 'DBIT' | 'CRDT' | undefined /** * The ISO currency code in which the hold was created. The amounts are stored in the base currency, but the user could have enter it in a foreign currency. */ - currencyCode?: string + currencyCode?: string | undefined /** * The custom expiration period for the hold which overwrites mcc and default expiration periods */ - customExpirationPeriod?: number + customExpirationPeriod?: number | undefined /** * The internal ID of the authorization hold, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The exchange rate for the original currency. */ - exchangeRate?: number + exchangeRate?: number | undefined /** * The external reference ID to be used to reference the account hold in subsequent requests. */ @@ -1256,38 +1349,37 @@ export interface GetAuthorizationHold { /** * The original amount of money to be held as a result of the authorization hold request. */ - originalAmount?: number + originalAmount?: number | undefined /** * The original currency in which the hold was created. */ - originalCurrency?: string + originalCurrency?: string | undefined /** * Indicates whether the authorization is partial or not */ - partial?: boolean + partial?: boolean | undefined /** * The date to consider as start date when calculating the number of days passed until expiration */ - referenceDateForExpiration?: string + referenceDateForExpiration?: string | undefined /** * Indicates the source of the authorization hold, the default values is CARD. */ - source?: 'CARD' | 'ACCOUNT' + source?: 'CARD' | 'ACCOUNT' | undefined /** * The authorization hold status. */ - status?: 'PENDING' | 'REVERSED' | 'SETTLED' | 'EXPIRED' + status?: 'PENDING' | 'REVERSED' | 'SETTLED' | 'EXPIRED' | undefined /** * The formatted time at which the user made this authorization hold. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } export type GetLoanAccountDocumentResponse = string export const GetLoanAccountDocumentResponse = { - validate: (await import('./schemas/get-loan-account-document-response.schema.js')) - .validate as ValidateFunction, + validate: GetLoanAccountDocumentResponseValidator as ValidateFunction, get schema() { return GetLoanAccountDocumentResponse.validate.schema }, @@ -1295,13 +1387,18 @@ export const GetLoanAccountDocumentResponse = { return GetLoanAccountDocumentResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetLoanAccountDocumentResponse => GetLoanAccountDocumentResponse.validate(o) === true, + parse: (o: unknown): { right: GetLoanAccountDocumentResponse } | { left: DefinedError[] } => { + if (GetLoanAccountDocumentResponse.is(o)) { + return { right: o } + } + return { left: (GetLoanAccountDocumentResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetVersionsByIdResponse = LoanAccount[] export const GetVersionsByIdResponse = { - validate: (await import('./schemas/get-versions-by-id-response.schema.js')) - .validate as ValidateFunction, + validate: GetVersionsByIdResponseValidator as ValidateFunction, get schema() { return GetVersionsByIdResponse.validate.schema }, @@ -1309,6 +1406,12 @@ export const GetVersionsByIdResponse = { return GetVersionsByIdResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetVersionsByIdResponse => GetVersionsByIdResponse.validate(o) === true, + parse: (o: unknown): { right: GetVersionsByIdResponse } | { left: DefinedError[] } => { + if (GetVersionsByIdResponse.is(o)) { + return { right: o } + } + return { left: (GetVersionsByIdResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -1322,15 +1425,15 @@ export interface Guarantor { /** * The name of a value the client guarantees with (populated when the guaranty type is ASSET) */ - assetName?: string + assetName?: string | undefined /** * The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null. */ - depositAccountKey?: string + depositAccountKey?: string | undefined /** * The encoded key of the security, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The key of the client/group used as the guarantor. */ @@ -1348,108 +1451,94 @@ export interface Installment { /** * The installment due date. */ - dueDate?: string + dueDate?: string | undefined /** * The encoded key of the installment, which is auto generated, and unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The expected closing balance is the remaining amount per installment only applicable for interest only equal installment products. */ - expectedClosingBalance?: number - fee?: InstallmentFee + expectedClosingBalance?: number | undefined + fee?: InstallmentFee | undefined /** * The breakdown of the fee amounts that have been applied to the loan account. */ - feeDetails?: InstallmentFeeDetails[] - interest?: InstallmentAllocationElementTaxableAmount + feeDetails?: InstallmentFeeDetails[] | undefined + interest?: InstallmentAllocationElementTaxableAmount | undefined /** * The interest accrued calculated on previous repayment closing balance only applicable interest only equal installment products. */ - interestAccrued?: number + interestAccrued?: number | undefined /** * `TRUE` if a payment holiday is offered for the installment, `FALSE` otherwise. */ - isPaymentHoliday?: boolean + isPaymentHoliday?: boolean | undefined /** * The installment last paid date. */ - lastPaidDate?: string + lastPaidDate?: string | undefined /** * The order number of an installment among all the installments generated for a loan. Loan installments are put in ascending order by due date. The order number only applies to the content of a particular JSON response therefore it is not unique. */ - number?: string + number?: string | undefined /** * The parent account key of the installment. */ - parentAccountKey?: string - penalty?: InstallmentAllocationElementTaxableAmount - principal?: InstallmentAllocationElementAmount + parentAccountKey?: string | undefined + penalty?: InstallmentAllocationElementTaxableAmount | undefined + principal?: InstallmentAllocationElementAmount | undefined /** * The installment repaid date. */ - repaidDate?: string + repaidDate?: string | undefined /** * The installment state. */ - state?: 'PENDING' | 'LATE' | 'PAID' | 'PARTIALLY_PAID' | 'GRACE' + state?: 'PENDING' | 'LATE' | 'PAID' | 'PARTIALLY_PAID' | 'GRACE' | undefined } /** * Represents an installment allocation element amount structure. */ export interface InstallmentAllocationElementAmount { - amount?: Amount + amount?: Amount | undefined } /** * Represents an installment allocation element taxable amount structure. */ export interface InstallmentAllocationElementTaxableAmount { - amount?: Amount - tax?: Amount + amount?: Amount | undefined + tax?: Amount | undefined } /** * Represents an installment fee structure. */ export interface InstallmentFee { - amount?: FeeAmount - tax?: Amount + amount?: FeeAmount | undefined + tax?: Amount | undefined } /** * Represents fee details for an installment. */ export interface InstallmentFeeDetails { - amount?: AmountWithReduced + amount?: AmountWithReduced | undefined /** * The encoded key of the predefined fee, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The id of the fee, provided by the client */ - id?: string + id?: string | undefined /** * The name of the fee */ - name?: string - tax?: AmountWithReduced -} - -/** - * Represents interest rate change threshold settings for loan accounts and loan products. - */ -export interface InterestRateChangePMTAdjustmentThreshold { - /** - * The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS - */ - method?: 'WORKING_DAYS' | 'CALENDAR_DAYS' - /** - * The number of days that trigger an interest rate change. - */ - numberOfDays?: number + name?: string | undefined + tax?: AmountWithReduced | undefined } /** @@ -1459,57 +1548,64 @@ export interface InterestSettings { /** * Adjustable interest rates settings for loan account */ - accountInterestRateSettings?: AccountInterestRateSettings[] + accountInterestRateSettings?: AccountInterestRateSettings[] | undefined /** * The accrue interest after maturity. If the product support this option, specify if the interest should be accrued after the account maturity date. */ - accrueInterestAfterMaturity?: boolean + accrueInterestAfterMaturity?: boolean | undefined /** * Indicates whether late interest is accrued for this loan account */ - accrueLateInterest?: boolean - interestApplicationDays?: DaysInMonth + accrueLateInterest?: boolean | 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. */ - interestApplicationMethod?: 'AFTER_DISBURSEMENT' | 'REPAYMENT_DUE_DATE' | 'FIXED_DAYS_OF_MONTH' + interestApplicationMethod?: 'AFTER_DISBURSEMENT' | 'REPAYMENT_DUE_DATE' | 'FIXED_DAYS_OF_MONTH' | undefined /** * The interest balance calculation method. Represents the option which determines the way the balance for the account's interest is computed. */ - interestBalanceCalculationMethod?: 'ONLY_PRINCIPAL' | 'PRINCIPAL_AND_INTEREST' + interestBalanceCalculationMethod?: 'ONLY_PRINCIPAL' | 'PRINCIPAL_AND_INTEREST' | undefined /** * The interest calculation method. Holds the type of interest calculation method. */ - interestCalculationMethod?: 'FLAT' | 'DECLINING_BALANCE' | 'DECLINING_BALANCE_DISCOUNTED' | 'EQUAL_INSTALLMENTS' + interestCalculationMethod?: 'FLAT' | 'DECLINING_BALANCE' | 'DECLINING_BALANCE_DISCOUNTED' | 'EQUAL_INSTALLMENTS' | undefined /** * The interest change frequency. Holds the possible values for how often is interest charged on loan or deposit accounts */ - interestChargeFrequency?: 'ANNUALIZED' | 'EVERY_MONTH' | 'EVERY_FOUR_WEEKS' | 'EVERY_WEEK' | 'EVERY_DAY' | 'EVERY_X_DAYS' + interestChargeFrequency?: + | 'ANNUALIZED' + | 'EVERY_MONTH' + | 'EVERY_FOUR_WEEKS' + | 'EVERY_WEEK' + | 'EVERY_DAY' + | 'EVERY_X_DAYS' + | undefined /** * 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. */ - interestRate?: number - interestRateChangePMTAdjustmentThreshold?: InterestRateChangePMTAdjustmentThreshold + interestRate?: number | undefined /** * Interest rate update frequency unit count. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * The interest rate review unit. Defines the interest rate update frequency measurement unit. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * The interest rate source. Represents the interest calculation method: fixed or (interest spread + active organization index interest rate) */ - interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' + interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' | undefined /** * Interest to be added to active organization index interest rate in order to find out actual interest rate */ - interestSpread?: number + interestSpread?: number | undefined /** * The possible values for how we compute and apply the interest */ - interestType?: 'SIMPLE_INTEREST' | 'CAPITALIZED_INTEREST' | 'COMPOUNDING_INTEREST' + interestType?: 'SIMPLE_INTEREST' | 'CAPITALIZED_INTEREST' | 'COMPOUNDING_INTEREST' | undefined + pmtAdjustmentThreshold?: PMTAdjustmentThreshold | undefined } /** @@ -1519,15 +1615,15 @@ export interface InterestSettingsForSchedulePreview { /** * The interest settings details for schedule preview. */ - accountInterestRateSettings?: AccountInterestRateSettings[] + accountInterestRateSettings?: AccountInterestRateSettings[] | undefined /** * 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. */ - interestRate?: number + interestRate?: number | undefined /** * Interest to be added to active organization index interest rate in order to find out actual interest rate */ - interestSpread?: number + interestSpread?: number | undefined } /** @@ -1541,15 +1637,15 @@ export interface InvestorFund { /** * The name of a value the client guarantees with (populated when the guaranty type is ASSET) */ - assetName?: string + assetName?: string | undefined /** * The key of the deposit account used by the guarantor (populated when the guaranty type is GUARANTOR). It can be null. */ - depositAccountKey?: string + depositAccountKey?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The key of the client/group used as the guarantor. */ @@ -1561,22 +1657,22 @@ export interface InvestorFund { /** * Investor fund unique identifier. All versions of an investor fund will have same id. */ - id?: string + id?: string | undefined /** * The constraint minimum value */ - interestCommission?: number + interestCommission?: number | undefined /** * Percentage of loan shares this investor owns */ - sharePercentage?: number + sharePercentage?: number | undefined } /** * 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. */ export interface LoanAccount { - accountArrearsSettings?: AccountArrearsSettings + accountArrearsSettings?: AccountArrearsSettings | undefined /** * The encoded key of the account holder. */ @@ -1588,7 +1684,7 @@ export interface LoanAccount { /** * The state of the loan account. */ - accountState?: 'PARTIAL_APPLICATION' | 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'ACTIVE_IN_ARREARS' | 'CLOSED' + accountState?: 'PARTIAL_APPLICATION' | 'PENDING_APPROVAL' | 'APPROVED' | 'ACTIVE' | 'ACTIVE_IN_ARREARS' | 'CLOSED' | undefined /** * 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`. */ @@ -1603,134 +1699,139 @@ export interface LoanAccount { | 'REJECTED' | 'WRITTEN_OFF' | 'TERMINATED' + | undefined /** * The amount of interest that has been accrued in the loan account. */ - accruedInterest?: number + accruedInterest?: number | undefined /** * The accrued penalty, represents the amount of penalty that has been accrued in the loan account. */ - accruedPenalty?: number + accruedPenalty?: number | undefined /** * The encoded key of the transaction that activated the loan account. */ - activationTransactionKey?: string + activationTransactionKey?: string | undefined /** * DEPRECATED - Will always be false. */ - allowOffset?: boolean + allowOffset?: boolean | undefined /** * The date the loan account was approved. */ - approvedDate?: string + approvedDate?: string | undefined /** * The arrears tolerance (period or day of month) depending on the product settings. */ - arrearsTolerancePeriod?: number + arrearsTolerancePeriod?: number | undefined /** * The list of assets associated with the current loan account. */ - assets?: Asset[] + assets?: Asset[] | undefined /** * The key of the branch this loan account is assigned to. The branch is set to unassigned if no branch field is set. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * The key of the centre this account is assigned to. */ - assignedCentreKey?: string + assignedCentreKey?: string | undefined /** * The key of the user this loan account is assigned to. */ - assignedUserKey?: string - balances?: Balances + assignedUserKey?: string | undefined + balances?: Balances | undefined /** * The date the loan was closed. */ - closedDate?: string + closedDate?: string | undefined /** * The date the loan account was created. */ - creationDate?: string + creationDate?: string | undefined /** * The key to the line of credit where this account is registered to. */ - creditArrangementKey?: string - currency?: Currency + creditArrangementKey?: string | undefined + currency?: Currency | undefined /** * The number of days the loan account is in arrears. */ - daysInArrears?: number + daysInArrears?: number | undefined /** * The number of days a repayment for the loan account is late. */ - daysLate?: number - disbursementDetails?: DisbursementDetails + daysLate?: number | undefined + disbursementDetails?: DisbursementDetails | undefined /** * The encoded key of the loan account, it is auto generated, and must be unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The list of funds associated with the loan account. */ - fundingSources?: InvestorFund[] + fundingSources?: InvestorFund[] | undefined /** * Shows whether the repayment transactions with entry date set in the future are allowed or not for this loan account. */ - futurePaymentsAcceptance?: 'NO_FUTURE_PAYMENTS' | 'ACCEPT_FUTURE_PAYMENTS' | 'ACCEPT_OVERPAYMENTS' + futurePaymentsAcceptance?: 'NO_FUTURE_PAYMENTS' | 'ACCEPT_FUTURE_PAYMENTS' | 'ACCEPT_OVERPAYMENTS' | undefined /** * The list of guarantees associated with the loan account. */ - guarantors?: Guarantor[] + guarantors?: Guarantor[] | undefined /** * The ID of the loan account, it can be generated and customized, and must be unique. */ - id?: string + id?: string | undefined /** * The interest that is accrued in the current billing cycle. */ - interestAccruedInBillingCycle?: number + interestAccruedInBillingCycle?: number | undefined /** * The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enabled. */ - interestCommission?: number + interestCommission?: number | undefined /** * The amount of interest from arrears that has been accrued in the loan account. */ - interestFromArrearsAccrued?: number - interestSettings?: InterestSettings + interestFromArrearsAccrued?: number | undefined + interestSettings?: InterestSettings | undefined /** * 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. */ - lastAccountAppraisalDate?: string + lastAccountAppraisalDate?: string | undefined /** * 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. */ - lastInterestAppliedDate?: string + lastInterestAppliedDate?: string | undefined /** * The date the interest was reviewed last time, stored in the organization time format and time zone. */ - lastInterestReviewDate?: string + lastInterestReviewDate?: string | undefined /** * 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. */ - lastLockedDate?: string + lastLockedDate?: string | undefined /** * The last date the loan was updated. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * 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. */ - lastSetToArrearsDate?: string + lastSetToArrearsDate?: string | undefined /** * The date the tax rate on the loan account was last checked, expressed in the organization time format and time zone. */ - lastTaxRateReviewDate?: string + lastTaxRateReviewDate?: string | undefined /** * The overdue payments recalculation method inherited from the loan product on which this loan account is based. */ - latePaymentsRecalculationMethod?: 'OVERDUE_INSTALLMENTS_INCREASE' | 'LAST_INSTALLMENT_INCREASE' + latePaymentsRecalculationMethod?: + | 'OVERDUE_INSTALLMENTS_INCREASE' + | 'LAST_INSTALLMENT_INCREASE' + | 'NO_RECALCULATION' + | undefined /** * The loan amount. */ @@ -1738,76 +1839,76 @@ export interface LoanAccount { /** * The name of the loan account. */ - loanName?: string + loanName?: string | undefined /** * The locked account total due type. */ - lockedAccountTotalDueType?: 'BALANCE_AMOUNT' | 'DUE_AMOUNT_ON_LATE_INSTALLMENTS' + lockedAccountTotalDueType?: 'BALANCE_AMOUNT' | 'DUE_AMOUNT_ON_LATE_INSTALLMENTS' | undefined /** * A list with operations which are locked when the account is in the AccountState.LOCKED substate. */ - lockedOperations?: ('APPLY_INTEREST' | 'APPLY_FEES' | 'APPLY_PENALTIES')[] + lockedOperations?: ('APPLY_INTEREST' | 'APPLY_FEES' | 'APPLY_PENALTIES')[] | undefined /** * The migration event encoded key associated with this loan account. If this account was imported, track which 'migration event' they came from. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency */ - modifyInterestForFirstInstallment?: boolean + modifyInterestForFirstInstallment?: boolean | undefined /** * The notes about this loan account. */ - notes?: string + notes?: string | undefined /** * The key of the original rescheduled or refinanced loan account. */ - originalAccountKey?: string + originalAccountKey?: string | undefined /** * The amount of interest that has been accrued during payment holidays in the loan account. */ - paymentHolidaysAccruedInterest?: number + paymentHolidaysAccruedInterest?: number | undefined /** * The interest payment method that determines whether the payments are made horizontally (on the repayments) or vertically (on the loan account). */ - paymentMethod?: 'HORIZONTAL' | 'VERTICAL' - penaltySettings?: PenaltySettings + paymentMethod?: 'HORIZONTAL' | 'VERTICAL' | undefined + penaltySettings?: PenaltySettings | undefined /** * The list with manual fees planned on the installments of the loan account. */ - plannedInstallmentFees?: PlannedInstallmentFee[] - prepaymentSettings?: PrepaymentSettings - principalPaymentSettings?: PrincipalPaymentAccountSettings + plannedInstallmentFees?: PlannedInstallmentFee[] | undefined + prepaymentSettings?: PrepaymentSettings | undefined + principalPaymentSettings?: PrincipalPaymentAccountSettings | undefined /** * The key for the type of loan product that this loan account is based on. */ productTypeKey: string - redrawSettings?: LoanAccountRedrawSettings + redrawSettings?: LoanAccountRedrawSettings | undefined /** * The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled. */ - rescheduledAccountKey?: string + rescheduledAccountKey?: string | undefined scheduleSettings: ScheduleSettings /** * The encoded key of the settlement account. */ - settlementAccountKey?: string + settlementAccountKey?: string | undefined /** * The tax rate. */ - taxRate?: number + taxRate?: number | undefined /** * The date this loan account was terminated. */ - terminationDate?: string + terminationDate?: string | undefined /** * The list of disbursement tranches available for the loan account. */ - tranches?: LoanTranche[] + tranches?: LoanTranche[] | undefined } export const LoanAccount = { - validate: (await import('./schemas/loan-account.schema.js')).validate as ValidateFunction, + validate: LoanAccountValidator as ValidateFunction, get schema() { return LoanAccount.validate.schema }, @@ -1815,10 +1916,11 @@ export const LoanAccount = { return LoanAccount.validate.errors ?? undefined }, is: (o: unknown): o is LoanAccount => LoanAccount.validate(o) === true, - assert: (o: unknown) => { - if (!LoanAccount.validate(o)) { - throw new ValidationError(LoanAccount.errors ?? []) + parse: (o: unknown): { right: LoanAccount } | { left: DefinedError[] } => { + if (LoanAccount.is(o)) { + return { right: o } } + return { left: (LoanAccount.errors ?? []) as DefinedError[] } }, } as const @@ -1843,11 +1945,11 @@ export interface LoanAccountAction { /** * The notes related to the action performed. */ - notes?: string + notes?: string | undefined } export const LoanAccountAction = { - validate: (await import('./schemas/loan-account-action.schema.js')).validate as ValidateFunction, + validate: LoanAccountActionValidator as ValidateFunction, get schema() { return LoanAccountAction.validate.schema }, @@ -1855,10 +1957,11 @@ export const LoanAccountAction = { return LoanAccountAction.validate.errors ?? undefined }, is: (o: unknown): o is LoanAccountAction => LoanAccountAction.validate(o) === true, - assert: (o: unknown) => { - if (!LoanAccountAction.validate(o)) { - throw new ValidationError(LoanAccountAction.errors ?? []) + parse: (o: unknown): { right: LoanAccountAction } | { left: DefinedError[] } => { + if (LoanAccountAction.is(o)) { + return { right: o } } + return { left: (LoanAccountAction.errors ?? []) as DefinedError[] } }, } as const @@ -1989,15 +2092,15 @@ export interface LoanAccountFilterCriteria { /** * The second value to match the searching criteria, when the `BETWEEN` operator is used. */ - secondValue?: string + secondValue?: string | undefined /** * The value to match the searching criteria. */ - value?: string + value?: string | undefined /** * List of values when the `IN` operator is used. */ - values?: string[] + values?: string[] | undefined } /** @@ -2007,18 +2110,17 @@ export interface LoanAccountPayOffInput { /** * The external ID for the repayment transaction. */ - externalId?: string + externalId?: string | undefined /** * The notes for the repayment transaction logged for the pay off action. */ - notes?: string - payOffAdjustableAmounts?: PayOffAdjustableAmounts - transactionDetails?: TransactionDetails + notes?: string | undefined + payOffAdjustableAmounts?: PayOffAdjustableAmounts | undefined + transactionDetails?: TransactionDetails | undefined } export const LoanAccountPayOffInput = { - validate: (await import('./schemas/loan-account-pay-off-input.schema.js')) - .validate as ValidateFunction, + validate: LoanAccountPayOffInputValidator as ValidateFunction, get schema() { return LoanAccountPayOffInput.validate.schema }, @@ -2026,10 +2128,11 @@ export const LoanAccountPayOffInput = { return LoanAccountPayOffInput.validate.errors ?? undefined }, is: (o: unknown): o is LoanAccountPayOffInput => LoanAccountPayOffInput.validate(o) === true, - assert: (o: unknown) => { - if (!LoanAccountPayOffInput.validate(o)) { - throw new ValidationError(LoanAccountPayOffInput.errors ?? []) + parse: (o: unknown): { right: LoanAccountPayOffInput } | { left: DefinedError[] } => { + if (LoanAccountPayOffInput.is(o)) { + return { right: o } } + return { left: (LoanAccountPayOffInput.errors ?? []) as DefinedError[] } }, } as const @@ -2047,15 +2150,15 @@ export interface LoanAccountRedrawSettings { * Represents a single loan account schedule structure. */ export interface LoanAccountSchedule { - currency?: Currency + currency?: Currency | undefined /** * The loan account schedule installments list. */ - installments?: Installment[] + installments?: Installment[] | undefined } export const LoanAccountSchedule = { - validate: (await import('./schemas/loan-account-schedule.schema.js')).validate as ValidateFunction, + validate: LoanAccountScheduleValidator as ValidateFunction, get schema() { return LoanAccountSchedule.validate.schema }, @@ -2063,6 +2166,12 @@ export const LoanAccountSchedule = { return LoanAccountSchedule.validate.errors ?? undefined }, is: (o: unknown): o is LoanAccountSchedule => LoanAccountSchedule.validate(o) === true, + parse: (o: unknown): { right: LoanAccountSchedule } | { left: DefinedError[] } => { + if (LoanAccountSchedule.is(o)) { + return { right: o } + } + return { left: (LoanAccountSchedule.errors ?? []) as DefinedError[] } + }, } as const /** @@ -2072,13 +2181,12 @@ export interface LoanAccountSearchCriteria { /** * The list of filtering criteria */ - filterCriteria?: LoanAccountFilterCriteria[] - sortingCriteria?: LoanAccountSortingCriteria + filterCriteria?: LoanAccountFilterCriteria[] | undefined + sortingCriteria?: LoanAccountSortingCriteria | undefined } export const LoanAccountSearchCriteria = { - validate: (await import('./schemas/loan-account-search-criteria.schema.js')) - .validate as ValidateFunction, + validate: LoanAccountSearchCriteriaValidator as ValidateFunction, get schema() { return LoanAccountSearchCriteria.validate.schema }, @@ -2086,10 +2194,11 @@ export const LoanAccountSearchCriteria = { return LoanAccountSearchCriteria.validate.errors ?? undefined }, is: (o: unknown): o is LoanAccountSearchCriteria => LoanAccountSearchCriteria.validate(o) === true, - assert: (o: unknown) => { - if (!LoanAccountSearchCriteria.validate(o)) { - throw new ValidationError(LoanAccountSearchCriteria.errors ?? []) + parse: (o: unknown): { right: LoanAccountSearchCriteria } | { left: DefinedError[] } => { + if (LoanAccountSearchCriteria.is(o)) { + return { right: o } } + return { left: (LoanAccountSearchCriteria.errors ?? []) as DefinedError[] } }, } as const @@ -2161,7 +2270,7 @@ export interface LoanAccountSortingCriteria { /** * The sorting order: `ASC` or `DESC`. The default order is `DESC`. */ - order?: 'ASC' | 'DESC' + order?: 'ASC' | 'DESC' | undefined } /** @@ -2171,11 +2280,11 @@ export interface LoanActionDetails { /** * The notes for the action performed on a loan account. */ - notes?: string + notes?: string | undefined } export const LoanActionDetails = { - validate: (await import('./schemas/loan-action-details.schema.js')).validate as ValidateFunction, + validate: LoanActionDetailsValidator as ValidateFunction, get schema() { return LoanActionDetails.validate.schema }, @@ -2183,10 +2292,11 @@ export const LoanActionDetails = { return LoanActionDetails.validate.errors ?? undefined }, is: (o: unknown): o is LoanActionDetails => LoanActionDetails.validate(o) === true, - assert: (o: unknown) => { - if (!LoanActionDetails.validate(o)) { - throw new ValidationError(LoanActionDetails.errors ?? []) + parse: (o: unknown): { right: LoanActionDetails } | { left: DefinedError[] } => { + if (LoanActionDetails.is(o)) { + return { right: o } } + return { left: (LoanActionDetails.errors ?? []) as DefinedError[] } }, } as const @@ -2197,58 +2307,58 @@ export interface LoanAffectedAmounts { /** * How much interest pre-paid was added/removed in account, within this transaction (including taxes). */ - deferredInterestAmount?: number + deferredInterestAmount?: number | undefined /** * How much fees was added/removed in account, within this transaction. */ - feesAmount?: number + feesAmount?: number | undefined /** * How much interest is given to the investors, within this transaction (only for p2p products) */ - fundersInterestAmount?: number + fundersInterestAmount?: number | undefined /** * 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. */ - interestAmount?: number + interestAmount?: number | undefined /** * How much interest from arrears was added/removed in account, within this transaction (including taxes). */ - interestFromArrearsAmount?: number + interestFromArrearsAmount?: number | undefined /** * How much interest is given to the organization, within this transaction (only for p2p products) */ - organizationCommissionAmount?: number + organizationCommissionAmount?: number | undefined /** * How much Payment Holidays interest was added/removed in account, within this transaction (including taxes). */ - paymentHolidaysInterestAmount?: number + paymentHolidaysInterestAmount?: number | undefined /** * How much penalties was added/removed in account, within this transaction. */ - penaltyAmount?: number + penaltyAmount?: number | undefined /** * How much principal was added/removed in account, within this transaction. */ - principalAmount?: number + principalAmount?: number | undefined } /** * The loan transaction terms */ export interface LoanTerms { - interestSettings?: TransactionInterestSettings + interestSettings?: TransactionInterestSettings | undefined /** * The periodic payment value logged when changing it for a Balloon Payments account */ - periodicPayment?: number + periodicPayment?: number | undefined /** * The principal payment flat amount logged when changing it for a Revolving Credit account */ - principalPaymentAmount?: number + principalPaymentAmount?: number | undefined /** * The principal payment percentage value logged when changing it for a Revolving Credit account */ - principalPaymentPercentage?: number + principalPaymentPercentage?: number | undefined } /** @@ -2259,105 +2369,105 @@ export interface LoanTranche { * The amount this tranche has available for disburse */ amount: number - disbursementDetails?: TrancheDisbursementDetails + disbursementDetails?: TrancheDisbursementDetails | undefined /** * The encoded key of the transaction details , auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Fees that are associated with this tranche */ - fees?: CustomPredefinedFee[] + fees?: CustomPredefinedFee[] | undefined /** * Index indicating the tranche number */ - trancheNumber?: number + trancheNumber?: number | undefined } /** * Represents the action performed on a loan account after which the account's amount changes its value. */ export interface LoanTransaction { - accountBalances?: TransactionBalances + accountBalances?: TransactionBalances | undefined /** * The key of the loan transaction where the adjustment for the transaction was made (if any adjustment was involved). */ - adjustmentTransactionKey?: string - affectedAmounts?: LoanAffectedAmounts + adjustmentTransactionKey?: string | undefined + affectedAmounts?: LoanAffectedAmounts | undefined /** * The amount that was added or removed on the loan account. */ - amount?: number + amount?: number | undefined /** * The date when the corresponding journal entry is booked. */ - bookingDate?: string + bookingDate?: string | undefined /** * The branch where the transaction was performed. */ - branchKey?: string - cardTransaction?: CardTransaction + branchKey?: string | undefined + cardTransaction?: CardTransaction | undefined /** * The center where the transaction was performed. */ - centreKey?: string + centreKey?: string | undefined /** * The date when this loan transaction was created. */ - creationDate?: string - currency?: Currency + creationDate?: string | undefined + currency?: Currency | undefined /** * The list of custom amounts which the user has paid as part of this transaction. */ - customPaymentAmounts?: CustomPaymentAmount[] + customPaymentAmounts?: CustomPaymentAmount[] | undefined /** * The encoded key of the loan transaction, which is auto generated, and must be unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The external ID of the loan transaction, it is customizable, and must be unique. */ - externalId?: string + externalId?: string | undefined /** * The amounts that have been applied or paid as part of this transaction and involved predefined fees. */ - fees?: Fee[] + fees?: Fee[] | undefined /** * The ID of the loan transaction, can be generated and customized, and must be unique. */ - id?: string + id?: string | undefined /** * The specific installment encoded key associated to the loan transaction. */ - installmentEncodedKey?: string + installmentEncodedKey?: string | undefined /** * The migration event encoded key associated with the loan account. If the account was imported, track which 'migration event' it came from. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * The notes or description for the loan transaction. */ - notes?: string + notes?: string | undefined /** * 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. */ - originalAmount?: number + originalAmount?: number | undefined /** * 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. */ - originalCurrencyCode?: string + originalCurrencyCode?: string | undefined /** * The encoded key of the transaction that was adjusted as part of this one. Available only for adjustment transactions. */ - originalTransactionKey?: string + originalTransactionKey?: string | undefined /** * The key of the parent loan account. */ - parentAccountKey?: string + parentAccountKey?: string | undefined /** * The key of the parent loan transaction. */ - parentLoanTransactionKey?: string + parentLoanTransactionKey?: string | undefined /** * The prepayment recalculation method of the loan transaction. */ @@ -2370,14 +2480,15 @@ export interface LoanTransaction { | 'REDUCE_AMOUNT_PER_INSTALLMENT' | 'REDUCE_NUMBER_OF_INSTALLMENTS' | 'REDUCE_NUMBER_OF_INSTALLMENTS_NEW' - taxes?: Taxes - terms?: LoanTerms + | undefined + taxes?: Taxes | undefined + terms?: LoanTerms | undefined /** * The till key associated with the transaction. */ - tillKey?: string - transactionDetails?: TransactionDetails - transferDetails?: TransferDetails + tillKey?: string | undefined + transactionDetails?: TransactionDetails | undefined + transferDetails?: TransferDetails | undefined /** * The type of loan transaction. */ @@ -2433,14 +2544,15 @@ export interface LoanTransaction { | 'DUE_DATE_CHANGED_ADJUSTMENT' | 'ACCOUNT_TERMINATED' | 'ACCOUNT_TERMINATED_ADJUSTMENT' + | undefined /** * The user that performed the transaction. */ - userKey?: string + userKey?: string | undefined /** * The date of the entry in the organization time format and timezone. */ - valueDate?: string + valueDate?: string | undefined } /** @@ -2450,30 +2562,29 @@ export interface LoanTransactionDetails { /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Whether the transaction was transferred between loans or deposit accounts */ - internalTransfer?: boolean + internalTransfer?: boolean | undefined /** * In case of a transaction to a deposit account this represent the deposit account key to which the transaction was made. */ - targetDepositAccountKey?: string + targetDepositAccountKey?: string | undefined /** * The ID of the transaction channel associated with the transaction details. */ - transactionChannelId?: string + transactionChannelId?: string | undefined /** * The encoded key of the transaction channel associated with the transaction details. */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } export type PatchFundingSourceRequest = PatchOperation[] export const PatchFundingSourceRequest = { - validate: (await import('./schemas/patch-funding-source-request.schema.js')) - .validate as ValidateFunction, + validate: PatchFundingSourceRequestValidator as ValidateFunction, get schema() { return PatchFundingSourceRequest.validate.schema }, @@ -2481,10 +2592,11 @@ export const PatchFundingSourceRequest = { return PatchFundingSourceRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchFundingSourceRequest => PatchFundingSourceRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchFundingSourceRequest.validate(o)) { - throw new ValidationError(PatchFundingSourceRequest.errors ?? []) + parse: (o: unknown): { right: PatchFundingSourceRequest } | { left: DefinedError[] } => { + if (PatchFundingSourceRequest.is(o)) { + return { right: o } } + return { left: (PatchFundingSourceRequest.errors ?? []) as DefinedError[] } }, } as const @@ -2495,7 +2607,7 @@ export interface PatchOperation { /** * The field from where a value should be moved, when using move */ - from?: string + from?: string | undefined /** * The change to perform */ @@ -2507,15 +2619,13 @@ export interface PatchOperation { /** * The value of the field, can be null */ - value?: { - [k: string]: unknown | undefined - } + value?: unknown } export type PatchRequest = PatchOperation[] export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, + validate: PatchRequestValidator as ValidateFunction, get schema() { return PatchRequest.validate.schema }, @@ -2523,10 +2633,11 @@ export const PatchRequest = { return PatchRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } }, } as const @@ -2537,15 +2648,15 @@ export interface PayOffAdjustableAmounts { /** * The fee amount to be paid for Pay Off action */ - feesPaid?: number + feesPaid?: number | undefined /** * The interest amount to be paid for Pay Off action */ - interestPaid?: number + interestPaid?: number | undefined /** * The penalty amount to be paid for Pay Off action */ - penaltyPaid?: number + penaltyPaid?: number | undefined } /** @@ -2555,11 +2666,16 @@ export interface PenaltySettings { /** * The last penalty calculation method, represents on what amount are the penalties calculated. */ - loanPenaltyCalculationMethod?: 'NONE' | 'OVERDUE_BALANCE' | 'OVERDUE_BALANCE_AND_INTEREST' | 'OUTSTANDING_PRINCIPAL' + loanPenaltyCalculationMethod?: + | 'NONE' + | 'OVERDUE_BALANCE' + | 'OVERDUE_BALANCE_AND_INTEREST' + | 'OUTSTANDING_PRINCIPAL' + | undefined /** * The penalty rate, represents the rate (in percent) which is charged as a penalty. */ - penaltyRate?: number + penaltyRate?: number | undefined } /** @@ -2573,7 +2689,7 @@ export interface PeriodicPayment { /** * The encoded key of the periodic payment, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The installment's position up to which the PMT will be used */ @@ -2605,7 +2721,7 @@ export interface PlannedFeeKeys { } export const PlannedFeeKeys = { - validate: (await import('./schemas/planned-fee-keys.schema.js')).validate as ValidateFunction, + validate: PlannedFeeKeysValidator as ValidateFunction, get schema() { return PlannedFeeKeys.validate.schema }, @@ -2613,10 +2729,11 @@ export const PlannedFeeKeys = { return PlannedFeeKeys.validate.errors ?? undefined }, is: (o: unknown): o is PlannedFeeKeys => PlannedFeeKeys.validate(o) === true, - assert: (o: unknown) => { - if (!PlannedFeeKeys.validate(o)) { - throw new ValidationError(PlannedFeeKeys.errors ?? []) + parse: (o: unknown): { right: PlannedFeeKeys } | { left: DefinedError[] } => { + if (PlannedFeeKeys.is(o)) { + return { right: o } } + return { left: (PlannedFeeKeys.errors ?? []) as DefinedError[] } }, } as const @@ -2627,29 +2744,43 @@ export interface PlannedInstallmentFee { /** * The amount of the planned fee. */ - amount?: number + amount?: number | undefined /** * 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. */ - applyOnDate?: string + applyOnDate?: string | undefined /** * The encoded key of the planned installment fee, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The encoded key of the installment on which the predefined fee is planned. */ - installmentKey?: string + installmentKey?: string | undefined /** * 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. */ - installmentNumber?: number + installmentNumber?: number | undefined /** * The encoded key of the predefined fee which is planned. */ predefinedFeeKey: string } +/** + * Represents PMT Adjustment threshold settings for loan accounts and loan products. + */ +export interface PMTAdjustmentThreshold { + /** + * The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS + */ + method?: 'WORKING_DAYS' | 'CALENDAR_DAYS' | undefined + /** + * The number of days that trigger a PMT Adjustment. + */ + numberOfDays?: number | undefined +} + /** * The prepayment settings, holds all prepayment properties. */ @@ -2657,16 +2788,16 @@ export interface PrepaymentSettings { /** * Apply interest on prepayment method copied from loan product on which this account is based. */ - applyInterestOnPrepaymentMethod?: 'AUTOMATIC' | 'MANUAL' + applyInterestOnPrepaymentMethod?: 'AUTOMATIC' | 'MANUAL' | undefined /** * The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated. */ - elementsRecalculationMethod?: 'PRINCIPAL_EXPECTED_FIXED' | 'TOTAL_EXPECTED_FIXED' - ercFreeAllowanceAmount?: number + elementsRecalculationMethod?: 'PRINCIPAL_EXPECTED_FIXED' | 'TOTAL_EXPECTED_FIXED' | undefined + ercFreeAllowanceAmount?: number | undefined /** * Early repayment charge fee free allowance in percentage per year */ - ercFreeAllowancePercentage?: number + ercFreeAllowancePercentage?: number | undefined /** * Prepayment recalculation method copied from the loan product on which this account is based. */ @@ -2679,22 +2810,23 @@ export interface PrepaymentSettings { | 'REDUCE_AMOUNT_PER_INSTALLMENT' | 'REDUCE_NUMBER_OF_INSTALLMENTS' | 'REDUCE_NUMBER_OF_INSTALLMENTS_NEW' + | undefined /** * Installment status for the case when principal is paid off (copied from loan product). */ - principalPaidInstallmentStatus?: 'PARTIALLY_PAID' | 'PAID' | 'ORIGINAL_TOTAL_EXPECTED_PAID' + principalPaidInstallmentStatus?: 'PARTIALLY_PAID' | 'PAID' | 'ORIGINAL_TOTAL_EXPECTED_PAID' | undefined } /** * Payload structure to preview loan account schedule. */ export interface PreviewLoanAccountSchedule { - disbursementDetails?: DisbursementDetailsForSchedulePreview + disbursementDetails?: DisbursementDetailsForSchedulePreview | undefined /** * The value of the interest booked by the organization from the accounts funded by investors. Null if the funds are not enable */ - interestCommission?: number - interestSettings?: InterestSettingsForSchedulePreview + interestCommission?: number | undefined + interestSettings?: InterestSettingsForSchedulePreview | undefined /** * The loan amount */ @@ -2702,25 +2834,24 @@ export interface PreviewLoanAccountSchedule { /** * A list with planned manual fees to be applied on the installments for schedule preview. */ - plannedInstallmentFees?: PlannedInstallmentFee[] + plannedInstallmentFees?: PlannedInstallmentFee[] | undefined /** * The key to the type of product that this account is based on. */ productTypeKey: string - scheduleSettings?: ScheduleSettingsForSchedulePreview + scheduleSettings?: ScheduleSettingsForSchedulePreview | undefined /** * The top up amount in case of a refinanced account */ - topUpAmount?: number + topUpAmount?: number | undefined /** * List of tranches to be considered for schedule preview. */ - tranches?: LoanTranche[] + tranches?: LoanTranche[] | undefined } export const PreviewLoanAccountSchedule = { - validate: (await import('./schemas/preview-loan-account-schedule.schema.js')) - .validate as ValidateFunction, + validate: PreviewLoanAccountScheduleValidator as ValidateFunction, get schema() { return PreviewLoanAccountSchedule.validate.schema }, @@ -2728,10 +2859,11 @@ export const PreviewLoanAccountSchedule = { return PreviewLoanAccountSchedule.validate.errors ?? undefined }, is: (o: unknown): o is PreviewLoanAccountSchedule => PreviewLoanAccountSchedule.validate(o) === true, - assert: (o: unknown) => { - if (!PreviewLoanAccountSchedule.validate(o)) { - throw new ValidationError(PreviewLoanAccountSchedule.errors ?? []) + parse: (o: unknown): { right: PreviewLoanAccountSchedule } | { left: DefinedError[] } => { + if (PreviewLoanAccountSchedule.is(o)) { + return { right: o } } + return { left: (PreviewLoanAccountSchedule.errors ?? []) as DefinedError[] } }, } as const @@ -2746,8 +2878,7 @@ export interface PreviewPayOffDueAmountsInAFutureDateInput { } export const PreviewPayOffDueAmountsInAFutureDateInput = { - validate: (await import('./schemas/preview-pay-off-due-amounts-in-a-future-date-input.schema.js')) - .validate as ValidateFunction, + validate: PreviewPayOffDueAmountsInAFutureDateInputValidator as ValidateFunction, get schema() { return PreviewPayOffDueAmountsInAFutureDateInput.validate.schema }, @@ -2756,10 +2887,11 @@ export const PreviewPayOffDueAmountsInAFutureDateInput = { }, is: (o: unknown): o is PreviewPayOffDueAmountsInAFutureDateInput => PreviewPayOffDueAmountsInAFutureDateInput.validate(o) === true, - assert: (o: unknown) => { - if (!PreviewPayOffDueAmountsInAFutureDateInput.validate(o)) { - throw new ValidationError(PreviewPayOffDueAmountsInAFutureDateInput.errors ?? []) + parse: (o: unknown): { right: PreviewPayOffDueAmountsInAFutureDateInput } | { left: DefinedError[] } => { + if (PreviewPayOffDueAmountsInAFutureDateInput.is(o)) { + return { right: o } } + return { left: (PreviewPayOffDueAmountsInAFutureDateInput.errors ?? []) as DefinedError[] } }, } as const @@ -2770,32 +2902,32 @@ export interface PreviewPayOffDueAmountsInAFutureDateWrapper { /** * The early repayment charge balance due when pay off the account in a future date */ - earlyRepaymentCharge?: number + earlyRepaymentCharge?: number | undefined /** * The fee balance due when pay off the account in a future date */ - feeBalance?: number + feeBalance?: number | undefined /** * The interest balance due when pay off the account in a future date */ - interestBalance?: number + interestBalance?: number | undefined /** * The penalty balance due when pay off the account in a future date */ - penaltyBalance?: number + penaltyBalance?: number | undefined /** * The principal balance due when pay off the account in a future date */ - principalBalance?: number + principalBalance?: number | undefined /** * The total balance due when pay off the account in a future date */ - totalBalance?: number + totalBalance?: number | undefined } export const PreviewPayOffDueAmountsInAFutureDateWrapper = { - validate: (await import('./schemas/preview-pay-off-due-amounts-in-a-future-date-wrapper.schema.js')) - .validate as ValidateFunction, + validate: + PreviewPayOffDueAmountsInAFutureDateWrapperValidator as ValidateFunction, get schema() { return PreviewPayOffDueAmountsInAFutureDateWrapper.validate.schema }, @@ -2804,6 +2936,12 @@ export const PreviewPayOffDueAmountsInAFutureDateWrapper = { }, is: (o: unknown): o is PreviewPayOffDueAmountsInAFutureDateWrapper => PreviewPayOffDueAmountsInAFutureDateWrapper.validate(o) === true, + parse: (o: unknown): { right: PreviewPayOffDueAmountsInAFutureDateWrapper } | { left: DefinedError[] } => { + if (PreviewPayOffDueAmountsInAFutureDateWrapper.is(o)) { + return { right: o } + } + return { left: (PreviewPayOffDueAmountsInAFutureDateWrapper.errors ?? []) as DefinedError[] } + }, } as const /** @@ -2813,31 +2951,31 @@ export interface PrincipalPaymentAccountSettings { /** * Fixed amount for being used for the repayments principal due. */ - amount?: number + amount?: number | undefined /** * The encoded key of the principal payment base settings, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Boolean flag, if true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account */ - includeFeesInFloorAmount?: boolean + includeFeesInFloorAmount?: boolean | undefined /** * Boolean flag, if true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account */ - includeInterestInFloorAmount?: boolean + includeInterestInFloorAmount?: boolean | undefined /** * Percentage of principal amount used for the repayments principal due. */ - percentage?: number + percentage?: number | undefined /** * The maximum principal due amount a repayment made with this settings can have */ - principalCeilingValue?: number + principalCeilingValue?: number | undefined /** * The minimum principal due amount a repayment made with this settings can have */ - principalFloorValue?: number + principalFloorValue?: number | undefined /** * The method of principal payment for revolving credit. */ @@ -2848,10 +2986,11 @@ export interface PrincipalPaymentAccountSettings { | 'TOTAL_BALANCE_PERCENTAGE' | 'TOTAL_BALANCE_FLAT' | 'TOTAL_PRINCIPAL_PERCENTAGE' + | undefined /** * The minimum total due amount a repayment made with this settings can have */ - totalDueAmountFloor?: number + totalDueAmountFloor?: number | undefined /** * The method of total due payment for revolving credit */ @@ -2862,6 +3001,7 @@ export interface PrincipalPaymentAccountSettings { | 'TOTAL_BALANCE_PERCENTAGE' | 'TOTAL_BALANCE_FLAT' | 'TOTAL_PRINCIPAL_PERCENTAGE' + | undefined } /** @@ -2871,11 +3011,11 @@ export interface RefinanceDisbursementDetails { /** * The date of the expected disbursement */ - expectedDisbursementDate?: string + expectedDisbursementDate?: string | undefined /** * List of fees that should be applied at the disbursement time. */ - fees?: CustomPredefinedFee[] + fees?: CustomPredefinedFee[] | undefined /** * The date of the expected first payment */ @@ -2886,36 +3026,36 @@ export interface RefinanceDisbursementDetails { * The new loan account settings, allowed on the loan account refinance */ export interface RefinanceLoanAccount { - accountArrearsSettings?: RestructureAccountArrearsSettings + accountArrearsSettings?: RestructureAccountArrearsSettings | undefined disbursementDetails: RefinanceDisbursementDetails /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The guarantees associated with the refinanced loan account */ - guarantors?: Guarantor[] + guarantors?: Guarantor[] | undefined /** * Id of the new loan account. */ - id?: string - interestSettings?: RestructureInterestSettings + id?: string | undefined + interestSettings?: RestructureInterestSettings | undefined /** * The name of the new loan account. */ - loanName?: string + loanName?: string | undefined /** * The loan account notes */ - notes?: string - penaltySettings?: RestructurePenaltySettings - principalPaymentSettings?: RestructurePrincipalPaymentAccountSettings + notes?: string | undefined + penaltySettings?: RestructurePenaltySettings | undefined + principalPaymentSettings?: RestructurePrincipalPaymentAccountSettings | undefined /** * The key of the loan product that this account is based on */ productTypeKey: string - scheduleSettings?: RestructureScheduleSettings + scheduleSettings?: RestructureScheduleSettings | undefined } /** @@ -2925,18 +3065,17 @@ export interface RefinanceLoanAccountAction { /** * Keep same account ID option */ - keepSameAccountId?: boolean + keepSameAccountId?: boolean | undefined loanAccount: RefinanceLoanAccount /** * The top-up amount */ topUpAmount: number - writeOffAmounts?: RefinanceWriteOffAmounts + writeOffAmounts?: RefinanceWriteOffAmounts | undefined } export const RefinanceLoanAccountAction = { - validate: (await import('./schemas/refinance-loan-account-action.schema.js')) - .validate as ValidateFunction, + validate: RefinanceLoanAccountActionValidator as ValidateFunction, get schema() { return RefinanceLoanAccountAction.validate.schema }, @@ -2944,10 +3083,11 @@ export const RefinanceLoanAccountAction = { return RefinanceLoanAccountAction.validate.errors ?? undefined }, is: (o: unknown): o is RefinanceLoanAccountAction => RefinanceLoanAccountAction.validate(o) === true, - assert: (o: unknown) => { - if (!RefinanceLoanAccountAction.validate(o)) { - throw new ValidationError(RefinanceLoanAccountAction.errors ?? []) + parse: (o: unknown): { right: RefinanceLoanAccountAction } | { left: DefinedError[] } => { + if (RefinanceLoanAccountAction.is(o)) { + return { right: o } } + return { left: (RefinanceLoanAccountAction.errors ?? []) as DefinedError[] } }, } as const @@ -2958,15 +3098,15 @@ export interface RefinanceWriteOffAmounts { /** * Fee write-off amount */ - fee?: number + fee?: number | undefined /** * Interest write-off amount */ - interest?: number + interest?: number | undefined /** * Penalty write-off amount */ - penalty?: number + penalty?: number | undefined } /** @@ -2983,40 +3123,40 @@ export interface RescheduleDisbursementDetails { * The new loan account settings, allowed on the loan account reschedule */ export interface RescheduleLoanAccount { - accountArrearsSettings?: RestructureAccountArrearsSettings + accountArrearsSettings?: RestructureAccountArrearsSettings | undefined disbursementDetails: RescheduleDisbursementDetails /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The guarantees associated with the rescheduled loan account */ - guarantors?: Guarantor[] + guarantors?: Guarantor[] | undefined /** * Id of the new loan account. */ - id?: string + id?: string | undefined /** * The interest commission */ - interestCommission?: number - interestSettings?: RestructureInterestSettings + interestCommission?: number | undefined + interestSettings?: RestructureInterestSettings | undefined /** * The name of the new loan account. */ - loanName?: string + loanName?: string | undefined /** * Notes for the rescheduled loan account */ - notes?: string - penaltySettings?: RestructurePenaltySettings - principalPaymentSettings?: RestructurePrincipalPaymentAccountSettings + notes?: string | undefined + penaltySettings?: RestructurePenaltySettings | undefined + principalPaymentSettings?: RestructurePrincipalPaymentAccountSettings | undefined /** * The key of the loan product that this account is based on */ productTypeKey: string - scheduleSettings?: RestructureScheduleSettings + scheduleSettings?: RestructureScheduleSettings | undefined } /** @@ -3026,14 +3166,13 @@ export interface RescheduleLoanAccountAction { /** * Keep same account ID option */ - keepSameAccountId?: boolean + keepSameAccountId?: boolean | undefined loanAccount: RescheduleLoanAccount - writeOffAmounts?: RescheduleWriteOffAmounts + writeOffAmounts?: RescheduleWriteOffAmounts | undefined } export const RescheduleLoanAccountAction = { - validate: (await import('./schemas/reschedule-loan-account-action.schema.js')) - .validate as ValidateFunction, + validate: RescheduleLoanAccountActionValidator as ValidateFunction, get schema() { return RescheduleLoanAccountAction.validate.schema }, @@ -3041,10 +3180,11 @@ export const RescheduleLoanAccountAction = { return RescheduleLoanAccountAction.validate.errors ?? undefined }, is: (o: unknown): o is RescheduleLoanAccountAction => RescheduleLoanAccountAction.validate(o) === true, - assert: (o: unknown) => { - if (!RescheduleLoanAccountAction.validate(o)) { - throw new ValidationError(RescheduleLoanAccountAction.errors ?? []) + parse: (o: unknown): { right: RescheduleLoanAccountAction } | { left: DefinedError[] } => { + if (RescheduleLoanAccountAction.is(o)) { + return { right: o } } + return { left: (RescheduleLoanAccountAction.errors ?? []) as DefinedError[] } }, } as const @@ -3055,25 +3195,25 @@ export interface RescheduleWriteOffAmounts { /** * Fee write-off amount */ - fee?: number + fee?: number | undefined /** * Interest write-off amount */ - interest?: number + interest?: number | undefined /** * Penalty write-off amount */ - penalty?: number + penalty?: number | undefined /** * Principal write-off amount */ - principal?: number + principal?: number | undefined } export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -3083,11 +3223,11 @@ export interface RestructureAccountArrearsSettings { /** * The arrears tolerance amount */ - tolerancePercentageOfOutstandingPrincipal?: number + tolerancePercentageOfOutstandingPrincipal?: number | undefined /** * The arrears tolerance period value */ - tolerancePeriod?: number + tolerancePeriod?: number | undefined } /** @@ -3097,15 +3237,16 @@ export interface RestructureInterestSettings { /** * Adjustable interest rates settings for loan account */ - accountInterestRateSettings?: AccountInterestRateSettings[] + accountInterestRateSettings?: AccountInterestRateSettings[] | undefined /** * The interest rate for the restructured loan account */ - interestRate?: number + interestRate?: number | undefined /** * The interest spread for the restructured loan account */ - interestSpread?: number + interestSpread?: number | undefined + pmtAdjustmentThreshold?: PMTAdjustmentThreshold | undefined } /** @@ -3115,7 +3256,7 @@ export interface RestructurePenaltySettings { /** * The penalty rate */ - penaltyRate?: number + penaltyRate?: number | undefined } /** @@ -3125,47 +3266,51 @@ export interface RestructurePrincipalPaymentAccountSettings { /** * Fixed principal payment amount */ - amount?: number + amount?: number | undefined /** * Principal payment percentage */ - percentage?: number + percentage?: number | undefined } /** * The schedule settings, allowed on the loan account restructure */ export interface RestructureScheduleSettings { - billingCycleDays?: BillingCycleDays + /** + * The PMT is calculated as the loan would have [amortizationPeriod] installments. + */ + amortizationPeriod?: number | undefined + billingCycleDays?: BillingCycleDays | undefined /** * The days of the month, when the repayment due dates should be */ - fixedDaysOfMonth?: number[] + fixedDaysOfMonth?: number[] | undefined /** * The grace period */ - gracePeriod?: number + gracePeriod?: number | undefined /** * A list of periodic payments for the current loan account. */ - paymentPlan?: PeriodicPayment[] + paymentPlan?: PeriodicPayment[] | undefined /** * The periodic payment */ - periodicPayment?: number - previewSchedule?: RevolvingAccountSettings + periodicPayment?: number | undefined + previewSchedule?: RevolvingAccountSettings | undefined /** * The number of installments */ - repaymentInstallments?: number + repaymentInstallments?: number | undefined /** * The payments frequency per set period of time */ - repaymentPeriodCount?: number + repaymentPeriodCount?: number | undefined /** * The period of time, within which the payments frequency is set */ - repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' + repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' | undefined } /** @@ -3175,7 +3320,7 @@ export interface RevolvingAccountSettings { /** * The number of previewed instalments */ - numberOfPreviewedInstalments?: number + numberOfPreviewedInstalments?: number | undefined } /** @@ -3185,16 +3330,16 @@ export interface ScheduleSettings { /** * The PMT is calculated as the loan would have [amortizationPeriod] installments. */ - amortizationPeriod?: number - billingCycle?: BillingCycleDays + amortizationPeriod?: number | undefined + billingCycle?: BillingCycleDays | undefined /** * 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) */ - defaultFirstRepaymentDueDateOffset?: number + defaultFirstRepaymentDueDateOffset?: number | undefined /** * Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH. */ - fixedDaysOfMonth?: number[] + fixedDaysOfMonth?: number[] | undefined /** * The grace period. Represents the grace period for loan repayment - in number of installments. */ @@ -3202,48 +3347,48 @@ export interface ScheduleSettings { /** * The grace period type. Representing the type of grace period which is possible for a loan account. */ - gracePeriodType?: 'NONE' | 'PAY_INTEREST_ONLY' | 'INTEREST_FORGIVENESS' + gracePeriodType?: 'NONE' | 'PAY_INTEREST_ONLY' | 'INTEREST_FORGIVENESS' | undefined /** * Flag used when the repayments schedule for the current account was determined by the user, by editing the due dates or the principal due */ - hasCustomSchedule?: boolean + hasCustomSchedule?: boolean | undefined /** * A list of periodic payments for the current loan account. */ - paymentPlan?: PeriodicPayment[] + paymentPlan?: PeriodicPayment[] | undefined /** * The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments */ - periodicPayment?: number - previewSchedule?: RevolvingAccountSettings + periodicPayment?: number | undefined + previewSchedule?: RevolvingAccountSettings | undefined /** * The principal repayment interval. Indicates the interval of repayments that the principal has to be paid. */ - principalRepaymentInterval?: number + principalRepaymentInterval?: number | undefined /** * The repayment installments. Represents how many installments are required to pay back the loan. */ - repaymentInstallments?: number + repaymentInstallments?: number | undefined /** * The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option. */ - repaymentPeriodCount?: number + repaymentPeriodCount?: number | undefined /** * The repayment period unit. Represents the frequency of loan repayment. */ - repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' + repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' | undefined /** * 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. */ - repaymentScheduleMethod?: 'NONE' | 'FIXED' | 'DYNAMIC' + repaymentScheduleMethod?: 'NONE' | 'FIXED' | 'DYNAMIC' | undefined /** * The schedule due dates method. Represents the methodology used by this account to compute the due dates of the repayments. */ - scheduleDueDatesMethod?: 'INTERVAL' | 'FIXED_DAYS_OF_MONTH' + scheduleDueDatesMethod?: 'INTERVAL' | 'FIXED_DAYS_OF_MONTH' | undefined /** * 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. */ - shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' + shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' | undefined } /** @@ -3253,41 +3398,41 @@ export interface ScheduleSettingsForSchedulePreview { /** * Specifies the days of the month when the repayment due dates should be. Only available if the Repayment Methodology is FIXED_DAYS_OF_MONTH. */ - fixedDaysOfMonth?: number[] + fixedDaysOfMonth?: number[] | undefined /** * The grace period. Represents the grace period for loan repayment - in number of installments. */ - gracePeriod?: number + gracePeriod?: number | undefined /** * A list of periodic payments for the current loan account. */ - paymentPlan?: PeriodicPaymentForSchedulePreview[] + paymentPlan?: PeriodicPaymentForSchedulePreview[] | undefined /** * The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments */ - periodicPayment?: number + periodicPayment?: number | undefined /** * The principal repayment interval. Indicates the interval of repayments that the principal has to be paid. */ - principalRepaymentInterval?: number + principalRepaymentInterval?: number | undefined /** * The repayment installments. Represents how many installments are required to pay back the loan. */ - repaymentInstallments?: number + repaymentInstallments?: number | undefined /** * The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option. */ - repaymentPeriodCount?: number + repaymentPeriodCount?: number | undefined /** * The repayment period unit. Represents the frequency of loan repayment. */ - repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' + repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' | undefined } export type SearchResponse = LoanAccount[] export const SearchResponse = { - validate: (await import('./schemas/search-response.schema.js')).validate as ValidateFunction, + validate: SearchResponseValidator as ValidateFunction, get schema() { return SearchResponse.validate.schema }, @@ -3295,6 +3440,12 @@ export const SearchResponse = { return SearchResponse.validate.errors ?? undefined }, is: (o: unknown): o is SearchResponse => SearchResponse.validate(o) === true, + parse: (o: unknown): { right: SearchResponse } | { left: DefinedError[] } => { + if (SearchResponse.is(o)) { + return { right: o } + } + return { left: (SearchResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -3304,31 +3455,31 @@ export interface Taxes { /** * 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. */ - deferredTaxOnInterestAmount?: number + deferredTaxOnInterestAmount?: number | undefined /** * How much taxes on the fees that were paid in this transaction were added/removed in account, within this transaction. */ - taxOnFeesAmount?: number + taxOnFeesAmount?: number | undefined /** * How much taxes on the interest that was paid in this transaction were added/removed in account, within this transaction. */ - taxOnInterestAmount?: number + taxOnInterestAmount?: number | undefined /** * The amount of taxes on the interest from arrears that were applied/paid in account, within this transaction. */ - taxOnInterestFromArrearsAmount?: number + taxOnInterestFromArrearsAmount?: number | undefined /** * The amount of taxes on the Payment Holidays interest that were added/removed in account, within this transaction. */ - taxOnPaymentHolidaysInterest?: number + taxOnPaymentHolidaysInterest?: number | undefined /** * How much taxes on the penalties that were paid in this transaction were added/removed in account, within this transaction. */ - taxOnPenaltyAmount?: number + taxOnPenaltyAmount?: number | undefined /** * The tax rate that was set or changed in this transaction. */ - taxRate?: number + taxRate?: number | undefined } /** @@ -3338,7 +3489,7 @@ export interface TerminateLoanAccountInput { /** * The notes for the terminate action performed on the loan account */ - notes?: string + notes?: string | undefined /** * The date when terminate the loan account */ @@ -3346,8 +3497,7 @@ export interface TerminateLoanAccountInput { } export const TerminateLoanAccountInput = { - validate: (await import('./schemas/terminate-loan-account-input.schema.js')) - .validate as ValidateFunction, + validate: TerminateLoanAccountInputValidator as ValidateFunction, get schema() { return TerminateLoanAccountInput.validate.schema }, @@ -3355,10 +3505,11 @@ export const TerminateLoanAccountInput = { return TerminateLoanAccountInput.validate.errors ?? undefined }, is: (o: unknown): o is TerminateLoanAccountInput => TerminateLoanAccountInput.validate(o) === true, - assert: (o: unknown) => { - if (!TerminateLoanAccountInput.validate(o)) { - throw new ValidationError(TerminateLoanAccountInput.errors ?? []) + parse: (o: unknown): { right: TerminateLoanAccountInput } | { left: DefinedError[] } => { + if (TerminateLoanAccountInput.is(o)) { + return { right: o } } + return { left: (TerminateLoanAccountInput.errors ?? []) as DefinedError[] } }, } as const @@ -3369,11 +3520,11 @@ export interface TrancheDisbursementDetails { /** * The key of the disbursement transaction logged when this tranche was disbursed. This field will be null until the tranche disbursement */ - disbursementTransactionKey?: string + disbursementTransactionKey?: string | undefined /** * The date when this tranche is supposed to be disbursed (as Organization Time) */ - expectedDisbursementDate?: string + expectedDisbursementDate?: string | undefined } /** @@ -3383,27 +3534,27 @@ export interface TransactionBalances { /** * Captures the advance (prepaid) amount. */ - advancePosition?: number + advancePosition?: number | undefined /** * Captures the arrears position amount for the account in arrears. */ - arrearsPosition?: number + arrearsPosition?: number | undefined /** * The difference between principal balance and redraw balance after each transaction performed on the loan account. */ - expectedPrincipalRedraw?: number + expectedPrincipalRedraw?: number | undefined /** * The account redraw balance captured after the transaction update. */ - principalBalance?: number + principalBalance?: number | undefined /** * The account redraw balance captured after the transaction update. */ - redrawBalance?: number + redrawBalance?: number | undefined /** * The running balance still owed for the loan. */ - totalBalance?: number + totalBalance?: number | undefined } /** @@ -3413,11 +3564,11 @@ export interface TransactionDetails { /** * The id of the transaction channel associated with the transaction details. */ - transactionChannelId?: string + transactionChannelId?: string | undefined /** * The encoded key of the transaction channel associated with the transaction details. */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } /** @@ -3427,11 +3578,11 @@ export interface TransactionInterestSettings { /** * The value of the index interest rate */ - indexInterestRate?: number + indexInterestRate?: number | undefined /** * 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. */ - interestRate?: number + interestRate?: number | undefined } /** @@ -3441,18 +3592,17 @@ export interface TransferDetails { /** * The key of the related deposit transaction */ - linkedDepositTransactionKey?: string + linkedDepositTransactionKey?: string | undefined /** * The key of the related loan transaction */ - linkedLoanTransactionKey?: string + linkedLoanTransactionKey?: string | undefined } export type UpdateLoanAccountFundingSourcesRequest = InvestorFund[] export const UpdateLoanAccountFundingSourcesRequest = { - validate: (await import('./schemas/update-loan-account-funding-sources-request.schema.js')) - .validate as ValidateFunction, + validate: UpdateLoanAccountFundingSourcesRequestValidator as ValidateFunction, get schema() { return UpdateLoanAccountFundingSourcesRequest.validate.schema }, @@ -3460,18 +3610,18 @@ export const UpdateLoanAccountFundingSourcesRequest = { return UpdateLoanAccountFundingSourcesRequest.validate.errors ?? undefined }, is: (o: unknown): o is UpdateLoanAccountFundingSourcesRequest => UpdateLoanAccountFundingSourcesRequest.validate(o) === true, - assert: (o: unknown) => { - if (!UpdateLoanAccountFundingSourcesRequest.validate(o)) { - throw new ValidationError(UpdateLoanAccountFundingSourcesRequest.errors ?? []) + parse: (o: unknown): { right: UpdateLoanAccountFundingSourcesRequest } | { left: DefinedError[] } => { + if (UpdateLoanAccountFundingSourcesRequest.is(o)) { + return { right: o } } + return { left: (UpdateLoanAccountFundingSourcesRequest.errors ?? []) as DefinedError[] } }, } as const export type UpdateLoanAccountFundingSourcesResponse = InvestorFund[] export const UpdateLoanAccountFundingSourcesResponse = { - validate: (await import('./schemas/update-loan-account-funding-sources-response.schema.js')) - .validate as ValidateFunction, + validate: UpdateLoanAccountFundingSourcesResponseValidator as ValidateFunction, get schema() { return UpdateLoanAccountFundingSourcesResponse.validate.schema }, @@ -3480,13 +3630,18 @@ export const UpdateLoanAccountFundingSourcesResponse = { }, is: (o: unknown): o is UpdateLoanAccountFundingSourcesResponse => UpdateLoanAccountFundingSourcesResponse.validate(o) === true, + parse: (o: unknown): { right: UpdateLoanAccountFundingSourcesResponse } | { left: DefinedError[] } => { + if (UpdateLoanAccountFundingSourcesResponse.is(o)) { + return { right: o } + } + return { left: (UpdateLoanAccountFundingSourcesResponse.errors ?? []) as DefinedError[] } + }, } as const export type UpdatePlannedFeesRequest = PlannedInstallmentFee[] export const UpdatePlannedFeesRequest = { - validate: (await import('./schemas/update-planned-fees-request.schema.js')) - .validate as ValidateFunction, + validate: UpdatePlannedFeesRequestValidator as ValidateFunction, get schema() { return UpdatePlannedFeesRequest.validate.schema }, @@ -3494,18 +3649,18 @@ export const UpdatePlannedFeesRequest = { return UpdatePlannedFeesRequest.validate.errors ?? undefined }, is: (o: unknown): o is UpdatePlannedFeesRequest => UpdatePlannedFeesRequest.validate(o) === true, - assert: (o: unknown) => { - if (!UpdatePlannedFeesRequest.validate(o)) { - throw new ValidationError(UpdatePlannedFeesRequest.errors ?? []) + parse: (o: unknown): { right: UpdatePlannedFeesRequest } | { left: DefinedError[] } => { + if (UpdatePlannedFeesRequest.is(o)) { + return { right: o } } + return { left: (UpdatePlannedFeesRequest.errors ?? []) as DefinedError[] } }, } as const export type UpdatePlannedFeesResponse = PlannedInstallmentFee[] export const UpdatePlannedFeesResponse = { - validate: (await import('./schemas/update-planned-fees-response.schema.js')) - .validate as ValidateFunction, + validate: UpdatePlannedFeesResponseValidator as ValidateFunction, get schema() { return UpdatePlannedFeesResponse.validate.schema }, @@ -3513,4 +3668,10 @@ export const UpdatePlannedFeesResponse = { return UpdatePlannedFeesResponse.validate.errors ?? undefined }, is: (o: unknown): o is UpdatePlannedFeesResponse => UpdatePlannedFeesResponse.validate(o) === true, + parse: (o: unknown): { right: UpdatePlannedFeesResponse } | { left: DefinedError[] } => { + if (UpdatePlannedFeesResponse.is(o)) { + return { right: o } + } + return { left: (UpdatePlannedFeesResponse.errors ?? []) as DefinedError[] } + }, } as const diff --git a/src/loan-accounts/schemas/apply-interest-input.schema.js b/src/loan-accounts/schemas/apply-interest-input.schema.js index f0a86c4..29f88b4 100644 --- a/src/loan-accounts/schemas/apply-interest-input.schema.js +++ b/src/loan-accounts/schemas/apply-interest-input.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";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","title":"interestApplicationDate","description":"The date up to which interest is to be posted","format":"date-time"},"isPaymentHolidaysInterest":{"type":"boolean","title":"isPaymentHolidaysInterest","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","title":"notes","description":"Additional information for this action"},"paymentHolidaysInterestAmount":{"type":"number","title":"paymentHolidaysInterestAmount","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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"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};const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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){let data0 = data.interestApplicationDate;const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(typeof data0 === "string"){if(!(formats0.validate(data0))){validate10.errors = [{instancePath:instancePath+"/interestApplicationDate",schemaPath:"#/properties/interestApplicationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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 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 77705ac..8fc1d4f 100644 --- a/src/loan-accounts/schemas/apply-planned-fees-response.schema.js +++ b/src/loan-accounts/schemas/apply-planned-fees-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"applyPlannedFeesResponse","type":"array","items":{"$ref":"#/$defs/LoanTransactionaf30"},"$defs":{"LoanTransactionaf30":{"type":"object","title":"LoanTransactionaf30","description":"Represents the action performed on a loan account after which the account's amount changes its value.","properties":{"accountBalances":{"title":"accountBalances","$ref":"#/$defs/TransactionBalancesaf30"},"adjustmentTransactionKey":{"type":"string","title":"adjustmentTransactionKey","description":"The key of the loan transaction where the adjustment for the transaction was made (if any adjustment was involved)."},"affectedAmounts":{"title":"affectedAmounts","$ref":"#/$defs/LoanAffectedAmountsaf30"},"amount":{"type":"number","title":"amount","description":"The amount that was added or removed on the loan account."},"bookingDate":{"type":"string","title":"bookingDate","description":"The date when the corresponding journal entry is booked.","format":"date-time"},"branchKey":{"type":"string","title":"branchKey","description":"The branch where the transaction was performed."},"cardTransaction":{"title":"cardTransaction","$ref":"#/$defs/CardTransactionaf30"},"centreKey":{"type":"string","title":"centreKey","description":"The center where the transaction was performed."},"creationDate":{"type":"string","title":"creationDate","description":"The date when this loan transaction was created.","format":"date-time"},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"customPaymentAmounts":{"type":"array","title":"customPaymentAmounts","description":"The list of custom amounts which the user has paid as part of this transaction.","items":{"$ref":"#/$defs/CustomPaymentAmountaf30"}},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the loan transaction, which is auto generated, and must be unique."},"externalId":{"type":"string","title":"externalId","description":"The external ID of the loan transaction, it is customizable, and must be unique."},"fees":{"type":"array","title":"fees","description":"The amounts that have been applied or paid as part of this transaction and involved predefined fees.","items":{"$ref":"#/$defs/Feeaf30"}},"id":{"type":"string","title":"id","description":"The ID of the loan transaction, can be generated and customized, and must be unique."},"installmentEncodedKey":{"type":"string","title":"installmentEncodedKey","description":"The specific installment encoded key associated to the loan transaction."},"migrationEventKey":{"type":"string","title":"migrationEventKey","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","title":"notes","description":"The notes or description for the loan transaction."},"originalAmount":{"type":"number","title":"originalAmount","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","title":"originalCurrencyCode","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","title":"originalTransactionKey","description":"The encoded key of the transaction that was adjusted as part of this one. Available only for adjustment transactions."},"parentAccountKey":{"type":"string","title":"parentAccountKey","description":"The key of the parent loan account."},"parentLoanTransactionKey":{"type":"string","title":"parentLoanTransactionKey","description":"The key of the parent loan transaction."},"prepaymentRecalculationMethod":{"title":"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":{"title":"taxes","$ref":"#/$defs/Taxesaf30"},"terms":{"title":"terms","$ref":"#/$defs/LoanTermsaf30"},"tillKey":{"type":"string","title":"tillKey","description":"The till key associated with the transaction."},"transactionDetails":{"title":"transactionDetails","$ref":"#/$defs/TransactionDetailsaf30"},"transferDetails":{"title":"transferDetails","$ref":"#/$defs/TransferDetailsaf30"},"type":{"title":"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","title":"userKey","description":"The user that performed the transaction."},"valueDate":{"type":"string","title":"valueDate","description":"The date of the entry in the organization time format and timezone.","format":"date-time"}},"additionalProperties":true},"TransactionBalancesaf30":{"type":"object","title":"TransactionBalancesaf30","description":"The balances changed within a transaction.","properties":{"advancePosition":{"type":"number","title":"advancePosition","description":"Captures the advance (prepaid) amount."},"arrearsPosition":{"type":"number","title":"arrearsPosition","description":"Captures the arrears position amount for the account in arrears."},"expectedPrincipalRedraw":{"type":"number","title":"expectedPrincipalRedraw","description":"The difference between principal balance and redraw balance after each transaction performed on the loan account."},"principalBalance":{"type":"number","title":"principalBalance","description":"The account redraw balance captured after the transaction update."},"redrawBalance":{"type":"number","title":"redrawBalance","description":"The account redraw balance captured after the transaction update."},"totalBalance":{"type":"number","title":"totalBalance","description":"The running balance still owed for the loan."}},"additionalProperties":true},"LoanAffectedAmountsaf30":{"type":"object","title":"LoanAffectedAmountsaf30","description":"The amounts affected after completing the loan transaction","properties":{"deferredInterestAmount":{"type":"number","title":"deferredInterestAmount","description":"How much interest pre-paid was added/removed in account, within this transaction (including taxes)."},"feesAmount":{"type":"number","title":"feesAmount","description":" How much fees was added/removed in account, within this transaction."},"fundersInterestAmount":{"type":"number","title":"fundersInterestAmount","description":"How much interest is given to the investors, within this transaction (only for p2p products)"},"interestAmount":{"type":"number","title":"interestAmount","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","title":"interestFromArrearsAmount","description":"How much interest from arrears was added/removed in account, within this transaction (including taxes)."},"organizationCommissionAmount":{"type":"number","title":"organizationCommissionAmount","description":"How much interest is given to the organization, within this transaction (only for p2p products)"},"paymentHolidaysInterestAmount":{"type":"number","title":"paymentHolidaysInterestAmount","description":"How much Payment Holidays interest was added/removed in account, within this transaction (including taxes)."},"penaltyAmount":{"type":"number","title":"penaltyAmount","description":"How much penalties was added/removed in account, within this transaction."},"principalAmount":{"type":"number","title":"principalAmount","description":"How much principal was added/removed in account, within this transaction."}},"additionalProperties":true},"CardTransactionaf30":{"type":"object","title":"CardTransactionaf30","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","title":"advice","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","title":"amount","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"title":"cardAcceptor","$ref":"#/$defs/CardAcceptoraf30"},"cardToken":{"type":"string","title":"cardToken","description":"The reference token of the card."},"currencyCode":{"type":"string","title":"currencyCode","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","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","title":"externalAuthorizationReferenceId","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","title":"externalReferenceId","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","title":"userTransactionTime","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true},"CardAcceptoraf30":{"type":"object","title":"CardAcceptoraf30","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","title":"city","description":"The city in which the card acceptor has the business."},"country":{"type":"string","title":"country","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","title":"mcc","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","title":"name","description":"The name of the card acceptor."},"state":{"type":"string","title":"state","description":"The state in which the card acceptor has the business."},"street":{"type":"string","title":"street","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","title":"zip","description":"The ZIP code of the location in which the card acceptor has the business."}},"additionalProperties":true},"Currencyaf30":{"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true},"CustomPaymentAmountaf30":{"type":"object","title":"CustomPaymentAmountaf30","description":"Custom payment amount for a specific element type","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the payment paid in the transaction for the given type."},"customPaymentAmountType":{"title":"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","title":"predefinedFeeKey","description":"The encodedKey of the predefined fee to be paid."},"taxOnAmount":{"type":"number","title":"taxOnAmount","description":"The amount of the taxes paid in the transaction for the given type."}},"required":["amount","customPaymentAmountType"],"additionalProperties":true},"Feeaf30":{"type":"object","title":"Feeaf30","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","title":"name","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","title":"predefinedFeeKey","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","title":"taxAmount","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"title":"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},"Taxesaf30":{"type":"object","title":"Taxesaf30","description":"The taxes applied within a transaction.","properties":{"deferredTaxOnInterestAmount":{"type":"number","title":"deferredTaxOnInterestAmount","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","title":"taxOnFeesAmount","description":"How much taxes on the fees that were paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestAmount":{"type":"number","title":"taxOnInterestAmount","description":"How much taxes on the interest that was paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestFromArrearsAmount":{"type":"number","title":"taxOnInterestFromArrearsAmount","description":"The amount of taxes on the interest from arrears that were applied/paid in account, within this transaction."},"taxOnPaymentHolidaysInterest":{"type":"number","title":"taxOnPaymentHolidaysInterest","description":"The amount of taxes on the Payment Holidays interest that were added/removed in account, within this transaction."},"taxOnPenaltyAmount":{"type":"number","title":"taxOnPenaltyAmount","description":"How much taxes on the penalties that were paid in this transaction were added/removed in account, within this transaction."},"taxRate":{"type":"number","title":"taxRate","description":"The tax rate that was set or changed in this transaction."}},"additionalProperties":true},"LoanTermsaf30":{"type":"object","title":"LoanTermsaf30","description":"The loan transaction terms","properties":{"interestSettings":{"title":"interestSettings","$ref":"#/$defs/TransactionInterestSettingsaf30"},"periodicPayment":{"type":"number","title":"periodicPayment","description":"The periodic payment value logged when changing it for a Balloon Payments account"},"principalPaymentAmount":{"type":"number","title":"principalPaymentAmount","description":"The principal payment flat amount logged when changing it for a Revolving Credit account"},"principalPaymentPercentage":{"type":"number","title":"principalPaymentPercentage","description":"The principal payment percentage value logged when changing it for a Revolving Credit account"}},"additionalProperties":true},"TransactionInterestSettingsaf30":{"type":"object","title":"TransactionInterestSettingsaf30","description":"The interest settings, holds all the properties regarding interests for the loan account.","properties":{"indexInterestRate":{"type":"number","title":"indexInterestRate","description":"The value of the index interest rate"},"interestRate":{"type":"number","title":"interestRate","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},"TransactionDetailsaf30":{"type":"object","title":"TransactionDetailsaf30","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","title":"transactionChannelId","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true},"TransferDetailsaf30":{"type":"object","title":"TransferDetailsaf30","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","title":"linkedDepositTransactionKey","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","title":"linkedLoanTransactionKey","description":"The key of the related loan transaction"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"LoanTransactionaf30","description":"Represents the action performed on a loan account after which the account's amount changes its value.","properties":{"accountBalances":{"title":"accountBalances","$ref":"#/$defs/TransactionBalancesaf30"},"adjustmentTransactionKey":{"type":"string","title":"adjustmentTransactionKey","description":"The key of the loan transaction where the adjustment for the transaction was made (if any adjustment was involved)."},"affectedAmounts":{"title":"affectedAmounts","$ref":"#/$defs/LoanAffectedAmountsaf30"},"amount":{"type":"number","title":"amount","description":"The amount that was added or removed on the loan account."},"bookingDate":{"type":"string","title":"bookingDate","description":"The date when the corresponding journal entry is booked.","format":"date-time"},"branchKey":{"type":"string","title":"branchKey","description":"The branch where the transaction was performed."},"cardTransaction":{"title":"cardTransaction","$ref":"#/$defs/CardTransactionaf30"},"centreKey":{"type":"string","title":"centreKey","description":"The center where the transaction was performed."},"creationDate":{"type":"string","title":"creationDate","description":"The date when this loan transaction was created.","format":"date-time"},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"customPaymentAmounts":{"type":"array","title":"customPaymentAmounts","description":"The list of custom amounts which the user has paid as part of this transaction.","items":{"$ref":"#/$defs/CustomPaymentAmountaf30"}},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the loan transaction, which is auto generated, and must be unique."},"externalId":{"type":"string","title":"externalId","description":"The external ID of the loan transaction, it is customizable, and must be unique."},"fees":{"type":"array","title":"fees","description":"The amounts that have been applied or paid as part of this transaction and involved predefined fees.","items":{"$ref":"#/$defs/Feeaf30"}},"id":{"type":"string","title":"id","description":"The ID of the loan transaction, can be generated and customized, and must be unique."},"installmentEncodedKey":{"type":"string","title":"installmentEncodedKey","description":"The specific installment encoded key associated to the loan transaction."},"migrationEventKey":{"type":"string","title":"migrationEventKey","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","title":"notes","description":"The notes or description for the loan transaction."},"originalAmount":{"type":"number","title":"originalAmount","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","title":"originalCurrencyCode","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","title":"originalTransactionKey","description":"The encoded key of the transaction that was adjusted as part of this one. Available only for adjustment transactions."},"parentAccountKey":{"type":"string","title":"parentAccountKey","description":"The key of the parent loan account."},"parentLoanTransactionKey":{"type":"string","title":"parentLoanTransactionKey","description":"The key of the parent loan transaction."},"prepaymentRecalculationMethod":{"title":"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":{"title":"taxes","$ref":"#/$defs/Taxesaf30"},"terms":{"title":"terms","$ref":"#/$defs/LoanTermsaf30"},"tillKey":{"type":"string","title":"tillKey","description":"The till key associated with the transaction."},"transactionDetails":{"title":"transactionDetails","$ref":"#/$defs/TransactionDetailsaf30"},"transferDetails":{"title":"transferDetails","$ref":"#/$defs/TransferDetailsaf30"},"type":{"title":"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","title":"userKey","description":"The user that performed the transaction."},"valueDate":{"type":"string","title":"valueDate","description":"The date of the entry in the organization time format and timezone.","format":"date-time"}},"additionalProperties":true};const schema13 = {"type":"object","title":"TransactionBalancesaf30","description":"The balances changed within a transaction.","properties":{"advancePosition":{"type":"number","title":"advancePosition","description":"Captures the advance (prepaid) amount."},"arrearsPosition":{"type":"number","title":"arrearsPosition","description":"Captures the arrears position amount for the account in arrears."},"expectedPrincipalRedraw":{"type":"number","title":"expectedPrincipalRedraw","description":"The difference between principal balance and redraw balance after each transaction performed on the loan account."},"principalBalance":{"type":"number","title":"principalBalance","description":"The account redraw balance captured after the transaction update."},"redrawBalance":{"type":"number","title":"redrawBalance","description":"The account redraw balance captured after the transaction update."},"totalBalance":{"type":"number","title":"totalBalance","description":"The running balance still owed for the loan."}},"additionalProperties":true};const schema14 = {"type":"object","title":"LoanAffectedAmountsaf30","description":"The amounts affected after completing the loan transaction","properties":{"deferredInterestAmount":{"type":"number","title":"deferredInterestAmount","description":"How much interest pre-paid was added/removed in account, within this transaction (including taxes)."},"feesAmount":{"type":"number","title":"feesAmount","description":" How much fees was added/removed in account, within this transaction."},"fundersInterestAmount":{"type":"number","title":"fundersInterestAmount","description":"How much interest is given to the investors, within this transaction (only for p2p products)"},"interestAmount":{"type":"number","title":"interestAmount","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","title":"interestFromArrearsAmount","description":"How much interest from arrears was added/removed in account, within this transaction (including taxes)."},"organizationCommissionAmount":{"type":"number","title":"organizationCommissionAmount","description":"How much interest is given to the organization, within this transaction (only for p2p products)"},"paymentHolidaysInterestAmount":{"type":"number","title":"paymentHolidaysInterestAmount","description":"How much Payment Holidays interest was added/removed in account, within this transaction (including taxes)."},"penaltyAmount":{"type":"number","title":"penaltyAmount","description":"How much penalties was added/removed in account, within this transaction."},"principalAmount":{"type":"number","title":"principalAmount","description":"How much principal was added/removed in account, within this transaction."}},"additionalProperties":true};const schema17 = {"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema18 = {"type":"object","title":"CustomPaymentAmountaf30","description":"Custom payment amount for a specific element type","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the payment paid in the transaction for the given type."},"customPaymentAmountType":{"title":"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","title":"predefinedFeeKey","description":"The encodedKey of the predefined fee to be paid."},"taxOnAmount":{"type":"number","title":"taxOnAmount","description":"The amount of the taxes paid in the transaction for the given type."}},"required":["amount","customPaymentAmountType"],"additionalProperties":true};const schema19 = {"type":"object","title":"Feeaf30","description":"An amount of predefined fee that was applied or paid on an account.","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the fee that was applied/paid in the transaction for the given predefined fee."},"name":{"type":"string","title":"name","description":"The name of the predefined fee"},"predefinedFeeKey":{"type":"string","title":"predefinedFeeKey","description":"The encoded key of the predefined fee, auto generated, unique"},"taxAmount":{"type":"number","title":"taxAmount","description":"The amount of the taxes on fee that was applied/paid in the transaction."},"trigger":{"title":"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","title":"Taxesaf30","description":"The taxes applied within a transaction.","properties":{"deferredTaxOnInterestAmount":{"type":"number","title":"deferredTaxOnInterestAmount","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","title":"taxOnFeesAmount","description":"How much taxes on the fees that were paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestAmount":{"type":"number","title":"taxOnInterestAmount","description":"How much taxes on the interest that was paid in this transaction were added/removed in account, within this transaction."},"taxOnInterestFromArrearsAmount":{"type":"number","title":"taxOnInterestFromArrearsAmount","description":"The amount of taxes on the interest from arrears that were applied/paid in account, within this transaction."},"taxOnPaymentHolidaysInterest":{"type":"number","title":"taxOnPaymentHolidaysInterest","description":"The amount of taxes on the Payment Holidays interest that were added/removed in account, within this transaction."},"taxOnPenaltyAmount":{"type":"number","title":"taxOnPenaltyAmount","description":"How much taxes on the penalties that were paid in this transaction were added/removed in account, within this transaction."},"taxRate":{"type":"number","title":"taxRate","description":"The tax rate that was set or changed in this transaction."}},"additionalProperties":true};const schema23 = {"type":"object","title":"TransactionDetailsaf30","description":"Contains the details about transaction including fields like transaction channel key and channel id","properties":{"transactionChannelId":{"type":"string","title":"transactionChannelId","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};const schema24 = {"type":"object","title":"TransferDetailsaf30","description":"Represents the transfer details, such as the linked transaction key","properties":{"linkedDepositTransactionKey":{"type":"string","title":"linkedDepositTransactionKey","description":"The key of the related deposit transaction"},"linkedLoanTransactionKey":{"type":"string","title":"linkedLoanTransactionKey","description":"The key of the related loan transaction"}},"additionalProperties":true};const schema15 = {"type":"object","title":"CardTransactionaf30","description":"A card transaction entry which will have a corresponding a financial transaction performed.","properties":{"advice":{"type":"boolean","title":"advice","description":"Whether the given request should be accepted without balance validations."},"amount":{"type":"number","title":"amount","description":"The amount of money to be withdrawn in the financial transaction."},"cardAcceptor":{"title":"cardAcceptor","$ref":"#/$defs/CardAcceptoraf30"},"cardToken":{"type":"string","title":"cardToken","description":"The reference token of the card."},"currencyCode":{"type":"string","title":"currencyCode","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","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"externalAuthorizationReferenceId":{"type":"string","title":"externalAuthorizationReferenceId","description":"The external authorization hold reference ID, which relates this card transaction to a previous authorization hold."},"externalReferenceId":{"type":"string","title":"externalReferenceId","description":"The external reference ID to be used to reference the card transaction in subsequent requests."},"userTransactionTime":{"type":"string","title":"userTransactionTime","description":"The formatted time at which the user made this card transaction."}},"required":["advice","amount","externalReferenceId"],"additionalProperties":true};const schema16 = {"type":"object","title":"CardAcceptoraf30","description":"The details of the card acceptor (merchant) in a transaction hold.","properties":{"city":{"type":"string","title":"city","description":"The city in which the card acceptor has the business."},"country":{"type":"string","title":"country","description":"The country in which the card acceptor has the business."},"mcc":{"type":"integer","title":"mcc","description":"The Merchant Category Code of the card acceptor."},"name":{"type":"string","title":"name","description":"The name of the card acceptor."},"state":{"type":"string","title":"state","description":"The state in which the card acceptor has the business."},"street":{"type":"string","title":"street","description":"The street in which the card acceptor has the business."},"zip":{"type":"string","title":"zip","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/CardAcceptoraf30/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/CardAcceptoraf30/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/CardAcceptoraf30/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/CardAcceptoraf30/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/CardAcceptoraf30/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/CardAcceptoraf30/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/CardAcceptoraf30/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/CardAcceptoraf30/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","title":"LoanTermsaf30","description":"The loan transaction terms","properties":{"interestSettings":{"title":"interestSettings","$ref":"#/$defs/TransactionInterestSettingsaf30"},"periodicPayment":{"type":"number","title":"periodicPayment","description":"The periodic payment value logged when changing it for a Balloon Payments account"},"principalPaymentAmount":{"type":"number","title":"principalPaymentAmount","description":"The principal payment flat amount logged when changing it for a Revolving Credit account"},"principalPaymentPercentage":{"type":"number","title":"principalPaymentPercentage","description":"The principal payment percentage value logged when changing it for a Revolving Credit account"}},"additionalProperties":true};const schema22 = {"type":"object","title":"TransactionInterestSettingsaf30","description":"The interest settings, holds all the properties regarding interests for the loan account.","properties":{"indexInterestRate":{"type":"number","title":"indexInterestRate","description":"The value of the index interest rate"},"interestRate":{"type":"number","title":"interestRate","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/TransactionInterestSettingsaf30/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/TransactionInterestSettingsaf30/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/TransactionInterestSettingsaf30/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 = require("ajv/dist/runtime/equal").default;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/TransactionBalancesaf30/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/TransactionBalancesaf30/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/TransactionBalancesaf30/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/TransactionBalancesaf30/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/TransactionBalancesaf30/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/TransactionBalancesaf30/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/TransactionBalancesaf30/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/LoanAffectedAmountsaf30/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/LoanAffectedAmountsaf30/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/LoanAffectedAmountsaf30/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/LoanAffectedAmountsaf30/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/LoanAffectedAmountsaf30/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/LoanAffectedAmountsaf30/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/LoanAffectedAmountsaf30/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/LoanAffectedAmountsaf30/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/LoanAffectedAmountsaf30/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/LoanAffectedAmountsaf30/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/Currencyaf30/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/Currencyaf30/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/Currencyaf30/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},"InterestRateChangePMTAdjustmentThresholdaf30":{"type":"object","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"additionalProperties":true},"PenaltySettingsaf30":{"type":"object","title":"PenaltySettingsaf30","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"title":"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","title":"penaltyRate","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFeeaf30":{"type":"object","title":"PlannedInstallmentFeeaf30","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","title":"applyOnDate","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","title":"encodedKey","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","title":"installmentKey","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","title":"installmentNumber","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","title":"predefinedFeeKey","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettingsaf30":{"type":"object","title":"PrepaymentSettingsaf30","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowanceAmount"},"ercFreeAllowancePercentage":{"type":"number","title":"ercFreeAllowancePercentage","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"title":"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":{"title":"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},"PrincipalPaymentAccountSettingsaf30":{"type":"object","title":"PrincipalPaymentAccountSettingsaf30","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","title":"amount","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","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","title":"percentage","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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},"LoanAccountRedrawSettingsaf30":{"type":"object","title":"LoanAccountRedrawSettingsaf30","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","title":"restrictNextDueWithdrawal","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettingsaf30":{"type":"object","title":"ScheduleSettingsaf30","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","title":"amortizationPeriod","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"title":"billingCycle","$ref":"#/$defs/BillingCycleDaysaf30"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","title":"defaultFirstRepaymentDueDateOffset","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","title":"fixedDaysOfMonth","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","title":"gracePeriod","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"title":"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","title":"hasCustomSchedule","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","title":"paymentPlan","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPaymentaf30"}},"periodicPayment":{"type":"number","title":"periodicPayment","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"title":"previewSchedule","$ref":"#/$defs/RevolvingAccountSettingsaf30"},"principalRepaymentInterval":{"type":"integer","title":"principalRepaymentInterval","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","title":"repaymentInstallments","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","title":"repaymentPeriodCount","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"title":"repaymentPeriodUnit","description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"title":"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":{"title":"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":{"title":"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},"BillingCycleDaysaf30":{"type":"object","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPaymentaf30":{"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettingsaf30":{"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTrancheaf30":{"type":"object","title":"LoanTrancheaf30","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","title":"amount","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/TrancheDisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","title":"fees","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"trancheNumber":{"type":"integer","title":"trancheNumber","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetailsaf30":{"type":"object","title":"TrancheDisbursementDetailsaf30","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","title":"disbursementTransactionKey","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","title":"expectedDisbursementDate","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"LoanAccount","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":{"title":"accountArrearsSettings","$ref":"#/$defs/AccountArrearsSettingsaf30"},"accountHolderKey":{"type":"string","title":"accountHolderKey","description":"The encoded key of the account holder."},"accountHolderType":{"title":"accountHolderType","description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"title":"accountState","description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"title":"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","title":"accruedInterest","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","title":"accruedPenalty","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","title":"activationTransactionKey","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","title":"allowOffset","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","title":"approvedDate","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","title":"arrearsTolerancePeriod","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","title":"assets","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Assetaf30"}},"assignedBranchKey":{"type":"string","title":"assignedBranchKey","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","title":"assignedCentreKey","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","title":"assignedUserKey","description":"The key of the user this loan account is assigned to."},"balances":{"title":"balances","$ref":"#/$defs/Balancesaf30"},"closedDate":{"type":"string","title":"closedDate","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","title":"creationDate","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","title":"creditArrangementKey","description":"The key to the line of credit where this account is registered to."},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"daysInArrears":{"type":"integer","title":"daysInArrears","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","title":"daysLate","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/DisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","title":"fundingSources","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFundaf30"}},"futurePaymentsAcceptance":{"title":"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","title":"guarantors","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantoraf30"}},"id":{"type":"string","title":"id","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","title":"interestAccruedInBillingCycle","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","title":"interestCommission","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","title":"interestFromArrearsAccrued","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"title":"interestSettings","$ref":"#/$defs/InterestSettingsaf30"},"lastAccountAppraisalDate":{"type":"string","title":"lastAccountAppraisalDate","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","title":"lastInterestAppliedDate","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","title":"lastInterestReviewDate","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","title":"lastLockedDate","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","title":"lastModifiedDate","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","title":"lastSetToArrearsDate","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","title":"lastTaxRateReviewDate","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":{"title":"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"]},"loanAmount":{"type":"number","title":"loanAmount","description":"The loan amount."},"loanName":{"type":"string","title":"loanName","description":"The name of the loan account."},"lockedAccountTotalDueType":{"title":"lockedAccountTotalDueType","description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","title":"lockedOperations","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","title":"migrationEventKey","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","title":"modifyInterestForFirstInstallment","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","title":"notes","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","title":"originalAccountKey","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","title":"paymentHolidaysAccruedInterest","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"title":"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":{"title":"penaltySettings","$ref":"#/$defs/PenaltySettingsaf30"},"plannedInstallmentFees":{"type":"array","title":"plannedInstallmentFees","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFeeaf30"}},"prepaymentSettings":{"title":"prepaymentSettings","$ref":"#/$defs/PrepaymentSettingsaf30"},"principalPaymentSettings":{"title":"principalPaymentSettings","$ref":"#/$defs/PrincipalPaymentAccountSettingsaf30"},"productTypeKey":{"type":"string","title":"productTypeKey","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"title":"redrawSettings","$ref":"#/$defs/LoanAccountRedrawSettingsaf30"},"rescheduledAccountKey":{"type":"string","title":"rescheduledAccountKey","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"title":"scheduleSettings","$ref":"#/$defs/ScheduleSettingsaf30"},"settlementAccountKey":{"type":"string","title":"settlementAccountKey","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","title":"taxRate","description":"The tax rate."},"terminationDate":{"type":"string","title":"terminationDate","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","title":"tranches","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTrancheaf30"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","title":"AccountArrearsSettingsaf30","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"title":"dateCalculationMethod","description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","title":"monthlyToleranceDay","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"title":"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":{"title":"toleranceCalculationMethod","description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","title":"toleranceFloorAmount","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","title":"tolerancePercentageOfOutstandingPrincipal","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","title":"tolerancePeriod","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","title":"Balancesaf30","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","title":"feesBalance","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","title":"feesDue","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","title":"feesPaid","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","title":"holdBalance","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","title":"interestBalance","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","title":"interestDue","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","title":"interestFromArrearsBalance","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","title":"interestFromArrearsDue","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","title":"interestFromArrearsPaid","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","title":"interestPaid","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","title":"penaltyBalance","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","title":"penaltyDue","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","title":"penaltyPaid","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","title":"principalBalance","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","title":"principalDue","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","title":"principalPaid","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","title":"redrawBalance","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","title":"InvestorFundaf30","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","title":"id","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","title":"interestCommission","description":"The constraint minimum value"},"sharePercentage":{"type":"number","title":"sharePercentage","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","title":"Guarantoraf30","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","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","title":"PenaltySettingsaf30","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"title":"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","title":"penaltyRate","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","title":"PlannedInstallmentFeeaf30","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","title":"applyOnDate","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","title":"encodedKey","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","title":"installmentKey","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","title":"installmentNumber","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","title":"predefinedFeeKey","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","title":"PrepaymentSettingsaf30","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowanceAmount"},"ercFreeAllowancePercentage":{"type":"number","title":"ercFreeAllowancePercentage","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"title":"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":{"title":"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","title":"PrincipalPaymentAccountSettingsaf30","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","title":"amount","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","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","title":"percentage","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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","title":"LoanAccountRedrawSettingsaf30","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","title":"restrictNextDueWithdrawal","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;const schema14 = {"type":"object","title":"Assetaf30","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","title":"originalAmount","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"title":"originalCurrency","$ref":"#/$defs/Currencyaf30"}},"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/Currencyaf30/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/Currencyaf30/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/Currencyaf30/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","title":"DisbursementDetailsaf30","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","title":"disbursementDate","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","title":"expectedDisbursementDate","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","title":"fees","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"firstRepaymentDate":{"type":"string","title":"firstRepaymentDate","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"title":"transactionDetails","$ref":"#/$defs/LoanTransactionDetailsaf30"}},"additionalProperties":true};const schema19 = {"type":"object","title":"CustomPredefinedFeeaf30","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","title":"amount","description":"The amount of the custom fee."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","title":"percentage","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","title":"predefinedFeeEncodedKey","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","title":"LoanTransactionDetailsaf30","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","title":"internalTransfer","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","title":"targetDepositAccountKey","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","title":"transactionChannelId","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","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","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"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","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","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/BillingCycleDaysaf30/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/BillingCycleDaysaf30/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDaysaf30/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 = require("ajv/dist/runtime/equal").default;const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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){let data0 = data.disbursementDate;const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(typeof data0 === "string"){if(!(formats0.validate(data0))){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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){let data2 = data.expectedDisbursementDate;const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(typeof data2 === "string"){if(!(formats0.validate(data2))){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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},"InterestRateChangePMTAdjustmentThresholdaf30":{"type":"object","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"additionalProperties":true},"PenaltySettingsaf30":{"type":"object","title":"PenaltySettingsaf30","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"title":"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","title":"penaltyRate","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFeeaf30":{"type":"object","title":"PlannedInstallmentFeeaf30","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","title":"applyOnDate","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","title":"encodedKey","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","title":"installmentKey","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","title":"installmentNumber","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","title":"predefinedFeeKey","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettingsaf30":{"type":"object","title":"PrepaymentSettingsaf30","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowanceAmount"},"ercFreeAllowancePercentage":{"type":"number","title":"ercFreeAllowancePercentage","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"title":"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":{"title":"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},"PrincipalPaymentAccountSettingsaf30":{"type":"object","title":"PrincipalPaymentAccountSettingsaf30","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","title":"amount","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","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","title":"percentage","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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},"LoanAccountRedrawSettingsaf30":{"type":"object","title":"LoanAccountRedrawSettingsaf30","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","title":"restrictNextDueWithdrawal","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettingsaf30":{"type":"object","title":"ScheduleSettingsaf30","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","title":"amortizationPeriod","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"title":"billingCycle","$ref":"#/$defs/BillingCycleDaysaf30"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","title":"defaultFirstRepaymentDueDateOffset","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","title":"fixedDaysOfMonth","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","title":"gracePeriod","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"title":"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","title":"hasCustomSchedule","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","title":"paymentPlan","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPaymentaf30"}},"periodicPayment":{"type":"number","title":"periodicPayment","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"title":"previewSchedule","$ref":"#/$defs/RevolvingAccountSettingsaf30"},"principalRepaymentInterval":{"type":"integer","title":"principalRepaymentInterval","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","title":"repaymentInstallments","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","title":"repaymentPeriodCount","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"title":"repaymentPeriodUnit","description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"title":"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":{"title":"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":{"title":"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},"BillingCycleDaysaf30":{"type":"object","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPaymentaf30":{"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettingsaf30":{"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTrancheaf30":{"type":"object","title":"LoanTrancheaf30","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","title":"amount","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/TrancheDisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","title":"fees","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"trancheNumber":{"type":"integer","title":"trancheNumber","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetailsaf30":{"type":"object","title":"TrancheDisbursementDetailsaf30","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","title":"disbursementTransactionKey","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","title":"expectedDisbursementDate","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"LoanAccount","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":{"title":"accountArrearsSettings","$ref":"#/$defs/AccountArrearsSettingsaf30"},"accountHolderKey":{"type":"string","title":"accountHolderKey","description":"The encoded key of the account holder."},"accountHolderType":{"title":"accountHolderType","description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"title":"accountState","description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"title":"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","title":"accruedInterest","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","title":"accruedPenalty","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","title":"activationTransactionKey","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","title":"allowOffset","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","title":"approvedDate","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","title":"arrearsTolerancePeriod","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","title":"assets","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Assetaf30"}},"assignedBranchKey":{"type":"string","title":"assignedBranchKey","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","title":"assignedCentreKey","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","title":"assignedUserKey","description":"The key of the user this loan account is assigned to."},"balances":{"title":"balances","$ref":"#/$defs/Balancesaf30"},"closedDate":{"type":"string","title":"closedDate","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","title":"creationDate","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","title":"creditArrangementKey","description":"The key to the line of credit where this account is registered to."},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"daysInArrears":{"type":"integer","title":"daysInArrears","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","title":"daysLate","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/DisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","title":"fundingSources","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFundaf30"}},"futurePaymentsAcceptance":{"title":"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","title":"guarantors","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantoraf30"}},"id":{"type":"string","title":"id","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","title":"interestAccruedInBillingCycle","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","title":"interestCommission","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","title":"interestFromArrearsAccrued","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"title":"interestSettings","$ref":"#/$defs/InterestSettingsaf30"},"lastAccountAppraisalDate":{"type":"string","title":"lastAccountAppraisalDate","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","title":"lastInterestAppliedDate","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","title":"lastInterestReviewDate","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","title":"lastLockedDate","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","title":"lastModifiedDate","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","title":"lastSetToArrearsDate","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","title":"lastTaxRateReviewDate","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":{"title":"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"]},"loanAmount":{"type":"number","title":"loanAmount","description":"The loan amount."},"loanName":{"type":"string","title":"loanName","description":"The name of the loan account."},"lockedAccountTotalDueType":{"title":"lockedAccountTotalDueType","description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","title":"lockedOperations","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","title":"migrationEventKey","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","title":"modifyInterestForFirstInstallment","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","title":"notes","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","title":"originalAccountKey","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","title":"paymentHolidaysAccruedInterest","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"title":"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":{"title":"penaltySettings","$ref":"#/$defs/PenaltySettingsaf30"},"plannedInstallmentFees":{"type":"array","title":"plannedInstallmentFees","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFeeaf30"}},"prepaymentSettings":{"title":"prepaymentSettings","$ref":"#/$defs/PrepaymentSettingsaf30"},"principalPaymentSettings":{"title":"principalPaymentSettings","$ref":"#/$defs/PrincipalPaymentAccountSettingsaf30"},"productTypeKey":{"type":"string","title":"productTypeKey","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"title":"redrawSettings","$ref":"#/$defs/LoanAccountRedrawSettingsaf30"},"rescheduledAccountKey":{"type":"string","title":"rescheduledAccountKey","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"title":"scheduleSettings","$ref":"#/$defs/ScheduleSettingsaf30"},"settlementAccountKey":{"type":"string","title":"settlementAccountKey","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","title":"taxRate","description":"The tax rate."},"terminationDate":{"type":"string","title":"terminationDate","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","title":"tranches","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTrancheaf30"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","title":"AccountArrearsSettingsaf30","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"title":"dateCalculationMethod","description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","title":"monthlyToleranceDay","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"title":"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":{"title":"toleranceCalculationMethod","description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","title":"toleranceFloorAmount","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","title":"tolerancePercentageOfOutstandingPrincipal","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","title":"tolerancePeriod","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","title":"Balancesaf30","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","title":"feesBalance","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","title":"feesDue","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","title":"feesPaid","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","title":"holdBalance","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","title":"interestBalance","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","title":"interestDue","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","title":"interestFromArrearsBalance","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","title":"interestFromArrearsDue","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","title":"interestFromArrearsPaid","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","title":"interestPaid","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","title":"penaltyBalance","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","title":"penaltyDue","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","title":"penaltyPaid","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","title":"principalBalance","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","title":"principalDue","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","title":"principalPaid","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","title":"redrawBalance","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","title":"InvestorFundaf30","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","title":"id","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","title":"interestCommission","description":"The constraint minimum value"},"sharePercentage":{"type":"number","title":"sharePercentage","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","title":"Guarantoraf30","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","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","title":"PenaltySettingsaf30","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"title":"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","title":"penaltyRate","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","title":"PlannedInstallmentFeeaf30","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","title":"applyOnDate","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","title":"encodedKey","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","title":"installmentKey","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","title":"installmentNumber","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","title":"predefinedFeeKey","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","title":"PrepaymentSettingsaf30","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowanceAmount"},"ercFreeAllowancePercentage":{"type":"number","title":"ercFreeAllowancePercentage","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"title":"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":{"title":"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","title":"PrincipalPaymentAccountSettingsaf30","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","title":"amount","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","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","title":"percentage","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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","title":"LoanAccountRedrawSettingsaf30","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","title":"restrictNextDueWithdrawal","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;const schema14 = {"type":"object","title":"Assetaf30","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","title":"originalAmount","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"title":"originalCurrency","$ref":"#/$defs/Currencyaf30"}},"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/Currencyaf30/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/Currencyaf30/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/Currencyaf30/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","title":"DisbursementDetailsaf30","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","title":"disbursementDate","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","title":"expectedDisbursementDate","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","title":"fees","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"firstRepaymentDate":{"type":"string","title":"firstRepaymentDate","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"title":"transactionDetails","$ref":"#/$defs/LoanTransactionDetailsaf30"}},"additionalProperties":true};const schema19 = {"type":"object","title":"CustomPredefinedFeeaf30","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","title":"amount","description":"The amount of the custom fee."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","title":"percentage","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","title":"predefinedFeeEncodedKey","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","title":"LoanTransactionDetailsaf30","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","title":"internalTransfer","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","title":"targetDepositAccountKey","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","title":"transactionChannelId","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","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","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"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","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","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/BillingCycleDaysaf30/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/BillingCycleDaysaf30/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDaysaf30/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 = require("ajv/dist/runtime/equal").default;const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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){let data0 = data.disbursementDate;const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(typeof data0 === "string"){if(!(formats0.validate(data0))){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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){let data2 = data.expectedDisbursementDate;const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(typeof data2 === "string"){if(!(formats0.validate(data2))){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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},"InterestRateChangePMTAdjustmentThresholdaf30":{"type":"object","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"additionalProperties":true},"PenaltySettingsaf30":{"type":"object","title":"PenaltySettingsaf30","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"title":"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","title":"penaltyRate","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFeeaf30":{"type":"object","title":"PlannedInstallmentFeeaf30","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","title":"applyOnDate","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","title":"encodedKey","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","title":"installmentKey","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","title":"installmentNumber","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","title":"predefinedFeeKey","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettingsaf30":{"type":"object","title":"PrepaymentSettingsaf30","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowanceAmount"},"ercFreeAllowancePercentage":{"type":"number","title":"ercFreeAllowancePercentage","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"title":"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":{"title":"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},"PrincipalPaymentAccountSettingsaf30":{"type":"object","title":"PrincipalPaymentAccountSettingsaf30","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","title":"amount","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","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","title":"percentage","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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},"LoanAccountRedrawSettingsaf30":{"type":"object","title":"LoanAccountRedrawSettingsaf30","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","title":"restrictNextDueWithdrawal","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettingsaf30":{"type":"object","title":"ScheduleSettingsaf30","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","title":"amortizationPeriod","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"title":"billingCycle","$ref":"#/$defs/BillingCycleDaysaf30"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","title":"defaultFirstRepaymentDueDateOffset","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","title":"fixedDaysOfMonth","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","title":"gracePeriod","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"title":"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","title":"hasCustomSchedule","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","title":"paymentPlan","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPaymentaf30"}},"periodicPayment":{"type":"number","title":"periodicPayment","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"title":"previewSchedule","$ref":"#/$defs/RevolvingAccountSettingsaf30"},"principalRepaymentInterval":{"type":"integer","title":"principalRepaymentInterval","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","title":"repaymentInstallments","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","title":"repaymentPeriodCount","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"title":"repaymentPeriodUnit","description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"title":"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":{"title":"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":{"title":"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},"BillingCycleDaysaf30":{"type":"object","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPaymentaf30":{"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettingsaf30":{"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTrancheaf30":{"type":"object","title":"LoanTrancheaf30","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","title":"amount","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/TrancheDisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","title":"fees","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"trancheNumber":{"type":"integer","title":"trancheNumber","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetailsaf30":{"type":"object","title":"TrancheDisbursementDetailsaf30","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","title":"disbursementTransactionKey","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","title":"expectedDisbursementDate","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"AccountArrearsSettingsaf30","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"title":"dateCalculationMethod","description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","title":"monthlyToleranceDay","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"title":"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":{"title":"toleranceCalculationMethod","description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","title":"toleranceFloorAmount","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","title":"tolerancePercentageOfOutstandingPrincipal","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","title":"tolerancePeriod","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema15 = {"type":"object","title":"Balancesaf30","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","title":"feesBalance","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","title":"feesDue","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","title":"feesPaid","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","title":"holdBalance","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","title":"interestBalance","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","title":"interestDue","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","title":"interestFromArrearsBalance","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","title":"interestFromArrearsDue","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","title":"interestFromArrearsPaid","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","title":"interestPaid","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","title":"penaltyBalance","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","title":"penaltyDue","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","title":"penaltyPaid","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","title":"principalBalance","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","title":"principalDue","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","title":"principalPaid","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","title":"redrawBalance","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema14 = {"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema20 = {"type":"object","title":"InvestorFundaf30","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","title":"id","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","title":"interestCommission","description":"The constraint minimum value"},"sharePercentage":{"type":"number","title":"sharePercentage","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema21 = {"type":"object","title":"Guarantoraf30","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","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema26 = {"type":"object","title":"PenaltySettingsaf30","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"title":"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","title":"penaltyRate","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema27 = {"type":"object","title":"PlannedInstallmentFeeaf30","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","title":"applyOnDate","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","title":"encodedKey","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","title":"installmentKey","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","title":"installmentNumber","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","title":"predefinedFeeKey","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema28 = {"type":"object","title":"PrepaymentSettingsaf30","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowanceAmount"},"ercFreeAllowancePercentage":{"type":"number","title":"ercFreeAllowancePercentage","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"title":"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":{"title":"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","title":"PrincipalPaymentAccountSettingsaf30","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","title":"amount","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","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","title":"percentage","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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","title":"LoanAccountRedrawSettingsaf30","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","title":"restrictNextDueWithdrawal","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;const schema13 = {"type":"object","title":"Assetaf30","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","title":"originalAmount","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"title":"originalCurrency","$ref":"#/$defs/Currencyaf30"}},"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/Currencyaf30/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/Currencyaf30/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/Currencyaf30/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","title":"DisbursementDetailsaf30","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","title":"disbursementDate","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","title":"expectedDisbursementDate","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","title":"fees","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"firstRepaymentDate":{"type":"string","title":"firstRepaymentDate","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"title":"transactionDetails","$ref":"#/$defs/LoanTransactionDetailsaf30"}},"additionalProperties":true};const schema18 = {"type":"object","title":"CustomPredefinedFeeaf30","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","title":"amount","description":"The amount of the custom fee."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","title":"percentage","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","title":"predefinedFeeEncodedKey","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema19 = {"type":"object","title":"LoanTransactionDetailsaf30","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","title":"internalTransfer","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","title":"targetDepositAccountKey","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","title":"transactionChannelId","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","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","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"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","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema33 = {"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema34 = {"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","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/BillingCycleDaysaf30/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/BillingCycleDaysaf30/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate17.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDaysaf30/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 = require("ajv/dist/runtime/equal").default;const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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){let data0 = data.disbursementDate;const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(typeof data0 === "string"){if(!(formats0.validate(data0))){validate13.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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){let data2 = data.expectedDisbursementDate;const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(typeof data2 === "string"){if(!(formats0.validate(data2))){validate13.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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 = data1[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/BillingCycleDaysaf30/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/BillingCycleDaysaf30/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate16.errors = [{instancePath:instancePath+"/billingCycleDays",schemaPath:"#/$defs/BillingCycleDaysaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data3 = data.fixedDaysOfMonth;const _errs10 = errors;if(errors === _errs10){if(Array.isArray(data3)){var valid5 = true;const len1 = data3.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 = data1[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/BillingCycleDaysaf30/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/BillingCycleDaysaf30/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate14.errors = [{instancePath:instancePath+"/billingCycleDays",schemaPath:"#/$defs/BillingCycleDaysaf30/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.fixedDaysOfMonth !== undefined){let data3 = data.fixedDaysOfMonth;const _errs10 = errors;if(errors === _errs10){if(Array.isArray(data3)){var valid5 = true;const len1 = data3.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},"InterestRateChangePMTAdjustmentThresholdaf30":{"type":"object","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"additionalProperties":true},"PenaltySettingsaf30":{"type":"object","title":"PenaltySettingsaf30","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"title":"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","title":"penaltyRate","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true},"PlannedInstallmentFeeaf30":{"type":"object","title":"PlannedInstallmentFeeaf30","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","title":"applyOnDate","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","title":"encodedKey","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","title":"installmentKey","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","title":"installmentNumber","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","title":"predefinedFeeKey","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true},"PrepaymentSettingsaf30":{"type":"object","title":"PrepaymentSettingsaf30","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowanceAmount"},"ercFreeAllowancePercentage":{"type":"number","title":"ercFreeAllowancePercentage","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"title":"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":{"title":"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},"PrincipalPaymentAccountSettingsaf30":{"type":"object","title":"PrincipalPaymentAccountSettingsaf30","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","title":"amount","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","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","title":"percentage","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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},"LoanAccountRedrawSettingsaf30":{"type":"object","title":"LoanAccountRedrawSettingsaf30","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","title":"restrictNextDueWithdrawal","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true},"ScheduleSettingsaf30":{"type":"object","title":"ScheduleSettingsaf30","description":"The schedule settings, holds all schedule properties.","properties":{"amortizationPeriod":{"type":"integer","title":"amortizationPeriod","description":"The PMT is calculated as the loan would have [amortizationPeriod] installments."},"billingCycle":{"title":"billingCycle","$ref":"#/$defs/BillingCycleDaysaf30"},"defaultFirstRepaymentDueDateOffset":{"type":"integer","title":"defaultFirstRepaymentDueDateOffset","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","title":"fixedDaysOfMonth","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","title":"gracePeriod","description":"The grace period. Represents the grace period for loan repayment - in number of installments."},"gracePeriodType":{"title":"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","title":"hasCustomSchedule","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","title":"paymentPlan","description":"A list of periodic payments for the current loan account.","items":{"$ref":"#/$defs/PeriodicPaymentaf30"}},"periodicPayment":{"type":"number","title":"periodicPayment","description":"The periodic payment amount for the accounts which have balloon payments or Reduce Number of Installments and Optimized Payments"},"previewSchedule":{"title":"previewSchedule","$ref":"#/$defs/RevolvingAccountSettingsaf30"},"principalRepaymentInterval":{"type":"integer","title":"principalRepaymentInterval","description":"The principal repayment interval. Indicates the interval of repayments that the principal has to be paid."},"repaymentInstallments":{"type":"integer","title":"repaymentInstallments","description":"The repayment installments. Represents how many installments are required to pay back the loan."},"repaymentPeriodCount":{"type":"integer","title":"repaymentPeriodCount","description":"The repayment period count. Represents how often the loan is to be repaid: stored based on the type repayment option."},"repaymentPeriodUnit":{"title":"repaymentPeriodUnit","description":"The repayment period unit. Represents the frequency of loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentScheduleMethod":{"title":"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":{"title":"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":{"title":"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},"BillingCycleDaysaf30":{"type":"object","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PeriodicPaymentaf30":{"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true},"RevolvingAccountSettingsaf30":{"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","description":"The number of previewed instalments"}},"additionalProperties":true},"LoanTrancheaf30":{"type":"object","title":"LoanTrancheaf30","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","title":"amount","description":"The amount this tranche has available for disburse"},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/TrancheDisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the transaction details , auto generated, unique."},"fees":{"type":"array","title":"fees","description":"Fees that are associated with this tranche","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"trancheNumber":{"type":"integer","title":"trancheNumber","description":"Index indicating the tranche number"}},"required":["amount"],"additionalProperties":true},"TrancheDisbursementDetailsaf30":{"type":"object","title":"TrancheDisbursementDetailsaf30","description":"The disbursement details regarding a loan tranche.","properties":{"disbursementTransactionKey":{"type":"string","title":"disbursementTransactionKey","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","title":"expectedDisbursementDate","description":"The date when this tranche is supposed to be disbursed (as Organization Time)","format":"date-time"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"LoanAccount","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":{"title":"accountArrearsSettings","$ref":"#/$defs/AccountArrearsSettingsaf30"},"accountHolderKey":{"type":"string","title":"accountHolderKey","description":"The encoded key of the account holder."},"accountHolderType":{"title":"accountHolderType","description":"The type of the account holder.","enum":["CLIENT","GROUP"]},"accountState":{"title":"accountState","description":"The state of the loan account.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"accountSubState":{"title":"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","title":"accruedInterest","description":"The amount of interest that has been accrued in the loan account."},"accruedPenalty":{"type":"number","title":"accruedPenalty","description":"The accrued penalty, represents the amount of penalty that has been accrued in the loan account."},"activationTransactionKey":{"type":"string","title":"activationTransactionKey","description":"The encoded key of the transaction that activated the loan account."},"allowOffset":{"type":"boolean","title":"allowOffset","description":"DEPRECATED - Will always be false."},"approvedDate":{"type":"string","title":"approvedDate","description":"The date the loan account was approved.","format":"date-time"},"arrearsTolerancePeriod":{"type":"integer","title":"arrearsTolerancePeriod","description":"The arrears tolerance (period or day of month) depending on the product settings."},"assets":{"type":"array","title":"assets","description":"The list of assets associated with the current loan account.","items":{"$ref":"#/$defs/Assetaf30"}},"assignedBranchKey":{"type":"string","title":"assignedBranchKey","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","title":"assignedCentreKey","description":"The key of the centre this account is assigned to."},"assignedUserKey":{"type":"string","title":"assignedUserKey","description":"The key of the user this loan account is assigned to."},"balances":{"title":"balances","$ref":"#/$defs/Balancesaf30"},"closedDate":{"type":"string","title":"closedDate","description":"The date the loan was closed.","format":"date-time"},"creationDate":{"type":"string","title":"creationDate","description":"The date the loan account was created.","format":"date-time"},"creditArrangementKey":{"type":"string","title":"creditArrangementKey","description":"The key to the line of credit where this account is registered to."},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"daysInArrears":{"type":"integer","title":"daysInArrears","description":"The number of days the loan account is in arrears."},"daysLate":{"type":"integer","title":"daysLate","description":"The number of days a repayment for the loan account is late."},"disbursementDetails":{"title":"disbursementDetails","$ref":"#/$defs/DisbursementDetailsaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the loan account, it is auto generated, and must be unique."},"fundingSources":{"type":"array","title":"fundingSources","description":"The list of funds associated with the loan account.","items":{"$ref":"#/$defs/InvestorFundaf30"}},"futurePaymentsAcceptance":{"title":"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","title":"guarantors","description":"The list of guarantees associated with the loan account.","items":{"$ref":"#/$defs/Guarantoraf30"}},"id":{"type":"string","title":"id","description":"The ID of the loan account, it can be generated and customized, and must be unique."},"interestAccruedInBillingCycle":{"type":"number","title":"interestAccruedInBillingCycle","description":"The interest that is accrued in the current billing cycle."},"interestCommission":{"type":"number","title":"interestCommission","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","title":"interestFromArrearsAccrued","description":"The amount of interest from arrears that has been accrued in the loan account."},"interestSettings":{"title":"interestSettings","$ref":"#/$defs/InterestSettingsaf30"},"lastAccountAppraisalDate":{"type":"string","title":"lastAccountAppraisalDate","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","title":"lastInterestAppliedDate","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","title":"lastInterestReviewDate","description":"The date the interest was reviewed last time, stored in the organization time format and time zone.","format":"date-time"},"lastLockedDate":{"type":"string","title":"lastLockedDate","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","title":"lastModifiedDate","description":"The last date the loan was updated.","format":"date-time"},"lastSetToArrearsDate":{"type":"string","title":"lastSetToArrearsDate","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","title":"lastTaxRateReviewDate","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":{"title":"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"]},"loanAmount":{"type":"number","title":"loanAmount","description":"The loan amount."},"loanName":{"type":"string","title":"loanName","description":"The name of the loan account."},"lockedAccountTotalDueType":{"title":"lockedAccountTotalDueType","description":"The locked account total due type.","enum":["BALANCE_AMOUNT","DUE_AMOUNT_ON_LATE_INSTALLMENTS"]},"lockedOperations":{"type":"array","title":"lockedOperations","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","title":"migrationEventKey","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","title":"modifyInterestForFirstInstallment","description":"Adjust the interest for the first repayment when the first repayment period is different than the repayment frequency"},"notes":{"type":"string","title":"notes","description":"The notes about this loan account."},"originalAccountKey":{"type":"string","title":"originalAccountKey","description":"The key of the original rescheduled or refinanced loan account."},"paymentHolidaysAccruedInterest":{"type":"number","title":"paymentHolidaysAccruedInterest","description":"The amount of interest that has been accrued during payment holidays in the loan account."},"paymentMethod":{"title":"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":{"title":"penaltySettings","$ref":"#/$defs/PenaltySettingsaf30"},"plannedInstallmentFees":{"type":"array","title":"plannedInstallmentFees","description":"The list with manual fees planned on the installments of the loan account.","items":{"$ref":"#/$defs/PlannedInstallmentFeeaf30"}},"prepaymentSettings":{"title":"prepaymentSettings","$ref":"#/$defs/PrepaymentSettingsaf30"},"principalPaymentSettings":{"title":"principalPaymentSettings","$ref":"#/$defs/PrincipalPaymentAccountSettingsaf30"},"productTypeKey":{"type":"string","title":"productTypeKey","description":"The key for the type of loan product that this loan account is based on."},"redrawSettings":{"title":"redrawSettings","$ref":"#/$defs/LoanAccountRedrawSettingsaf30"},"rescheduledAccountKey":{"type":"string","title":"rescheduledAccountKey","description":"The key pointing to where this loan account was rescheduled or refinanced to. This value is only not null if rescheduled."},"scheduleSettings":{"title":"scheduleSettings","$ref":"#/$defs/ScheduleSettingsaf30"},"settlementAccountKey":{"type":"string","title":"settlementAccountKey","description":"The encoded key of the settlement account."},"taxRate":{"type":"number","title":"taxRate","description":"The tax rate."},"terminationDate":{"type":"string","title":"terminationDate","description":"The date this loan account was terminated.","format":"date-time"},"tranches":{"type":"array","title":"tranches","description":"The list of disbursement tranches available for the loan account.","items":{"$ref":"#/$defs/LoanTrancheaf30"}}},"required":["accountHolderKey","accountHolderType","loanAmount","productTypeKey","scheduleSettings"],"additionalProperties":true};const schema13 = {"type":"object","title":"AccountArrearsSettingsaf30","description":"The account arrears settings, holds the required information for the arrears settings of an account.","properties":{"dateCalculationMethod":{"title":"dateCalculationMethod","description":"The arrears date calculation method.","enum":["ACCOUNT_FIRST_WENT_TO_ARREARS","LAST_LATE_REPAYMENT","ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD"]},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the arrears base settings, auto generated, unique."},"monthlyToleranceDay":{"type":"integer","title":"monthlyToleranceDay","description":"Defines monthly arrears tolerance day value."},"nonWorkingDaysMethod":{"title":"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":{"title":"toleranceCalculationMethod","description":"Defines the tolerance calculation method","enum":["ARREARS_TOLERANCE_PERIOD","MONTHLY_ARREARS_TOLERANCE_DAY"]},"toleranceFloorAmount":{"type":"number","title":"toleranceFloorAmount","description":"The tolerance floor amount."},"tolerancePercentageOfOutstandingPrincipal":{"type":"number","title":"tolerancePercentageOfOutstandingPrincipal","description":"Defines the arrears tolerance amount."},"tolerancePeriod":{"type":"integer","title":"tolerancePeriod","description":"Defines the arrears tolerance period value."}},"additionalProperties":true};const schema16 = {"type":"object","title":"Balancesaf30","description":"The loan account balance details.","properties":{"feesBalance":{"type":"number","title":"feesBalance","description":"The fees balance. Represents the total fees expected to be paid on this account at a given moment."},"feesDue":{"type":"number","title":"feesDue","description":"The fees due. Representing the total fees due for the account."},"feesPaid":{"type":"number","title":"feesPaid","description":"The fees paid. Represents the total fees paid for the account."},"holdBalance":{"type":"number","title":"holdBalance","description":"The sum of all the authorization hold amounts on this account."},"interestBalance":{"type":"number","title":"interestBalance","description":"Represents the total interest owed by the client (total interest applied for account minus interest paid)."},"interestDue":{"type":"number","title":"interestDue","description":"The interest due. Indicates how much interest it's due for the account at this moment."},"interestFromArrearsBalance":{"type":"number","title":"interestFromArrearsBalance","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","title":"interestFromArrearsDue","description":"The interest from arrears due. Indicates how much interest from arrears it's due for the account at this moment."},"interestFromArrearsPaid":{"type":"number","title":"interestFromArrearsPaid","description":"The interest from arrears paid, indicates total interest from arrears paid into the account."},"interestPaid":{"type":"number","title":"interestPaid","description":"The interest paid, indicates total interest paid into the account."},"penaltyBalance":{"type":"number","title":"penaltyBalance","description":"The penalty balance. Represents the total penalty expected to be paid on this account at a given moment."},"penaltyDue":{"type":"number","title":"penaltyDue","description":"The penalty due. Represents the total penalty amount due for the account."},"penaltyPaid":{"type":"number","title":"penaltyPaid","description":"The Penalty paid. Represents the total penalty amount paid for the account."},"principalBalance":{"type":"number","title":"principalBalance","description":"The total principal owned by the client, from now on (principal disbursed - principal paid)."},"principalDue":{"type":"number","title":"principalDue","description":"The principal due, indicates how much principal it's due at this moment."},"principalPaid":{"type":"number","title":"principalPaid","description":"The principal paid, holds the value of the total paid into the account."},"redrawBalance":{"type":"number","title":"redrawBalance","description":"The total redraw amount owned by the client, from now on."}},"additionalProperties":true};const schema15 = {"type":"object","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema21 = {"type":"object","title":"InvestorFundaf30","description":"Contains the details about an investor fund including fields like encoded key, guarantor type, amount and guarantor key","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"id":{"type":"string","title":"id","description":"Investor fund unique identifier. All versions of an investor fund will have same id."},"interestCommission":{"type":"number","title":"interestCommission","description":"The constraint minimum value"},"sharePercentage":{"type":"number","title":"sharePercentage","description":"Percentage of loan shares this investor owns"}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema22 = {"type":"object","title":"Guarantoraf30","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","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]}},"required":["amount","guarantorKey","guarantorType"],"additionalProperties":true};const schema27 = {"type":"object","title":"PenaltySettingsaf30","description":"The penalty settings, holds all the fields regarding penalties","properties":{"loanPenaltyCalculationMethod":{"title":"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","title":"penaltyRate","description":"The penalty rate, represents the rate (in percent) which is charged as a penalty."}},"additionalProperties":true};const schema28 = {"type":"object","title":"PlannedInstallmentFeeaf30","description":"The planned fee details holds the information related to the installment key, predefined fee key and amount","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the planned fee."},"applyOnDate":{"type":"string","title":"applyOnDate","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","title":"encodedKey","description":"The encoded key of the planned installment fee, auto generated, unique."},"installmentKey":{"type":"string","title":"installmentKey","description":"The encoded key of the installment on which the predefined fee is planned."},"installmentNumber":{"type":"integer","title":"installmentNumber","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","title":"predefinedFeeKey","description":"The encoded key of the predefined fee which is planned."}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema29 = {"type":"object","title":"PrepaymentSettingsaf30","description":"The prepayment settings, holds all prepayment properties.","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Apply interest on prepayment method copied from loan product on which this account is based.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowanceAmount"},"ercFreeAllowancePercentage":{"type":"number","title":"ercFreeAllowancePercentage","description":"Early repayment charge fee free allowance in percentage per year"},"prepaymentRecalculationMethod":{"title":"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":{"title":"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","title":"PrincipalPaymentAccountSettingsaf30","description":"The principal payment account settings, holds the required information for the principal payment process of an account.","properties":{"amount":{"type":"number","title":"amount","description":"Fixed amount for being used for the repayments principal due."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the principal payment base settings, auto generated, unique."},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","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","title":"percentage","description":"Percentage of principal amount used for the repayments principal due."},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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","title":"LoanAccountRedrawSettingsaf30","description":"Represents the redraw settings for a loan account.","properties":{"restrictNextDueWithdrawal":{"type":"boolean","title":"restrictNextDueWithdrawal","description":"`TRUE` if withdrawing amounts that reduce the next due instalment repayment is restricted, `FALSE` otherwise."}},"required":["restrictNextDueWithdrawal"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;const schema14 = {"type":"object","title":"Assetaf30","description":"Asset, holds information about a client asset entry.","properties":{"amount":{"type":"number","title":"amount","description":"The amount used by the client for the guaranty"},"assetName":{"type":"string","title":"assetName","description":"The name of a value the client guarantees with (populated when the guaranty type is ASSET)"},"depositAccountKey":{"type":"string","title":"depositAccountKey","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","title":"encodedKey","description":"The encoded key of the security, auto generated, unique."},"guarantorKey":{"type":"string","title":"guarantorKey","description":"The key of the client/group used as the guarantor."},"guarantorType":{"title":"guarantorType","description":"The type of the guarantor (client/group)","enum":["CLIENT","GROUP"]},"originalAmount":{"type":"number","title":"originalAmount","description":"The original amount used by the client for a collateral asset"},"originalCurrency":{"title":"originalCurrency","$ref":"#/$defs/Currencyaf30"}},"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/Currencyaf30/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/Currencyaf30/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/Currencyaf30/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","title":"DisbursementDetailsaf30","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","title":"disbursementDate","description":"The activation date, the date when the disbursement actually took place.","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the disbursement details, auto generated, unique"},"expectedDisbursementDate":{"type":"string","title":"expectedDisbursementDate","description":"The date of the expected disbursement.Stored as Organization Time.","format":"date-time"},"fees":{"type":"array","title":"fees","description":"List of fees that should be applied at the disbursement time.","items":{"$ref":"#/$defs/CustomPredefinedFeeaf30"}},"firstRepaymentDate":{"type":"string","title":"firstRepaymentDate","description":"The date of the expected first repayment. Stored as Organization Time.","format":"date-time"},"transactionDetails":{"title":"transactionDetails","$ref":"#/$defs/LoanTransactionDetailsaf30"}},"additionalProperties":true};const schema19 = {"type":"object","title":"CustomPredefinedFeeaf30","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","title":"amount","description":"The amount of the custom fee."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the custom predefined fee, auto generated, unique."},"percentage":{"type":"number","title":"percentage","description":"The percentage of the custom fee."},"predefinedFeeEncodedKey":{"type":"string","title":"predefinedFeeEncodedKey","description":"The encoded key of the predefined fee"}},"additionalProperties":true};const schema20 = {"type":"object","title":"LoanTransactionDetailsaf30","description":"Represents the loan transaction details.","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"internalTransfer":{"type":"boolean","title":"internalTransfer","description":"Whether the transaction was transferred between loans or deposit accounts"},"targetDepositAccountKey":{"type":"string","title":"targetDepositAccountKey","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","title":"transactionChannelId","description":"The ID of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","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","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"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","title":"BillingCycleDaysaf30","description":"Defines the billing cycles settings for a loan account","properties":{"days":{"type":"array","title":"days","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema34 = {"type":"object","title":"PeriodicPaymentaf30","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","title":"amount","description":"The PMT value used in periodic payment"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the periodic payment, auto generated, unique."},"toInstallment":{"type":"integer","title":"toInstallment","description":"The installment's position up to which the PMT will be used"}},"required":["amount","toInstallment"],"additionalProperties":true};const schema35 = {"type":"object","title":"RevolvingAccountSettingsaf30","description":"The number of previewed instalments for an account","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","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/BillingCycleDaysaf30/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/BillingCycleDaysaf30/properties/days/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate18.errors = [{instancePath:instancePath+"/billingCycle",schemaPath:"#/$defs/BillingCycleDaysaf30/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 = require("ajv/dist/runtime/equal").default;const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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){let data0 = data.disbursementDate;const _errs2 = errors;if(errors === _errs2){if(errors === _errs2){if(typeof data0 === "string"){if(!(formats0.validate(data0))){validate14.errors = [{instancePath:instancePath+"/disbursementDate",schemaPath:"#/properties/disbursementDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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){let data2 = data.expectedDisbursementDate;const _errs6 = errors;if(errors === _errs6){if(errors === _errs6){if(typeof data2 === "string"){if(!(formats0.validate(data2))){validate14.errors = [{instancePath:instancePath+"/expectedDisbursementDate",schemaPath:"#/properties/expectedDisbursementDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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 + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/loanproducts.yaml`, { + this.buildClient(auth).get('configuration/loanproducts.yaml', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update loan products configuration */ - public async update({ + public update({ headers, auth = [['apiKey'], ['basic']], - }: { headers?: { ['X-Mambu-Async']?: string; ['X-Mambu-Callback']?: string }; auth?: string[][] | string[] } = {}) { + }: { headers?: { 'X-Mambu-Async'?: string; 'X-Mambu-Callback'?: string }; auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | SuccessResponse<'202', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/loanproducts.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml', ...headers }, + this.buildClient(auth).put('configuration/loanproducts.yaml', { + headers: headers ?? {}, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 202: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 202: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -143,24 +179,52 @@ export class MambuLoanProductsConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/loan-products/index.ts b/src/loan-products/index.ts index 3dee5cc..374badb 100644 --- a/src/loan-products/index.ts +++ b/src/loan-products/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuLoanProducts } from './rest.client.js' export * as loanProducts from './rest.type.js' diff --git a/src/loan-products/rest.client.ts b/src/loan-products/rest.client.ts index 330a173..5355e39 100644 --- a/src/loan-products/rest.client.ts +++ b/src/loan-products/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ErrorResponse, GetAllResponse, LoanProduct, PatchRequest } from './rest.type.js' /** @@ -46,70 +49,104 @@ export class MambuLoanProducts { /** * Create loan product */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: LoanProduct - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanProduct, body) + }: { body: LoanProduct; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', LoanProduct> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanProduct, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`loanproducts`, { + this.buildClient(auth).post('loanproducts', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: LoanProduct, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete loan product */ - public async delete({ + public delete({ path, auth = [['apiKey'], ['basic']], - }: { - path: { loanProductId: string } - auth?: string[][] | string[] - }) { + }: { path: { loanProductId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`loanproducts/${path.loanProductId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get loan products */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { query?: { offset?: string; limit?: string; paginationDetails?: string; sortBy?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`loanproducts`, { + this.buildClient(auth).get('loanproducts', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -119,22 +156,31 @@ export class MambuLoanProducts { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get loan product */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { loanProductId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { loanProductId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', LoanProduct> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loanproducts/${path.loanProductId}`, { searchParams: query ?? {}, @@ -147,53 +193,78 @@ export class MambuLoanProducts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update loan product */ - public async patch({ + public patch({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: PatchRequest - path: { loanProductId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }: { body: PatchRequest; path: { loanProductId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`loanproducts/${path.loanProductId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update loan product */ - public async update({ + public update({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: LoanProduct - path: { loanProductId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanProduct, body) + }: { body: LoanProduct; path: { loanProductId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', LoanProduct> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanProduct, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`loanproducts/${path.loanProductId}`, { @@ -207,45 +278,66 @@ export class MambuLoanProducts { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -272,24 +364,52 @@ export class MambuLoanProducts { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/loan-products/rest.type.ts b/src/loan-products/rest.type.ts index a41f84c..489020e 100644 --- a/src/loan-products/rest.type.ts +++ b/src/loan-products/rest.type.ts @@ -3,8 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +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 LoanProductValidator } from './schemas/loan-product.schema.js' +import { validate as PatchRequestValidator } from './schemas/patch-request.schema.js' /** * Accounting settings, defines the accounting settings for the product. @@ -17,15 +22,15 @@ export interface AccountingSettings { /** * A list of accounting rules for the product. */ - accountingRules?: GLAccountingRule[] + accountingRules?: GLAccountingRule[] | undefined /** * The accounting interest calculation option selected for the product. */ - interestAccrualCalculation?: 'NONE' | 'AGGREGATED_AMOUNT' | 'BREAKDOWN_PER_ACCOUNT' + interestAccrualCalculation?: 'NONE' | 'AGGREGATED_AMOUNT' | 'BREAKDOWN_PER_ACCOUNT' | undefined /** * A list of accounting rules for a product. */ - interestAccruedAccountingMethod?: 'NONE' | 'DAILY' | 'END_OF_MONTH' + interestAccruedAccountingMethod?: 'NONE' | 'DAILY' | 'END_OF_MONTH' | undefined } /** @@ -39,15 +44,15 @@ export interface AccountLinkSettings { /** * 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. */ - linkableDepositProductKey?: string + linkableDepositProductKey?: string | undefined /** * A set of linked account options. */ - linkedAccountOptions?: ('AUTO_LINK_ACCOUNTS' | 'AUTO_CREATE_LINKED_ACCOUNTS')[] + linkedAccountOptions?: ('AUTO_LINK_ACCOUNTS' | 'AUTO_CREATE_LINKED_ACCOUNTS')[] | undefined /** * Set the option of automated transfer that should be made from linked deposit accounts into loan accounts create from this product. */ - settlementMethod?: 'FULL_DUE_AMOUNTS' | 'PARTIAL_DUE_AMOUNTS' | 'NO_AUTOMATED_TRANSFERS' + settlementMethod?: 'FULL_DUE_AMOUNTS' | 'PARTIAL_DUE_AMOUNTS' | 'NO_AUTOMATED_TRANSFERS' | undefined } /** @@ -57,19 +62,19 @@ export interface AmountDecimalConstraints { /** * The default value, will be used in case no other value was filled in by the user. */ - defaultValue?: number + defaultValue?: number | undefined /** * The encoded key of the decimal constraint, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The maximum value. */ - maxValue?: number + maxValue?: number | undefined /** * The minimum value. */ - minValue?: number + minValue?: number | undefined } /** @@ -79,11 +84,11 @@ export interface BillingCyclesProductSettings { /** * The billing cycle status if it is enabled or disabled */ - enabled?: boolean + enabled?: boolean | undefined /** * The billing cycle start days in case it is enabled */ - startDays?: number[] + startDays?: number[] | undefined } /** @@ -93,11 +98,11 @@ export interface BranchSettings { /** * Holds the encoded keys of the branches this product should be available for. */ - availableProductBranches?: string[] + availableProductBranches?: string[] | undefined /** * Indicates if this product should be available for all branches */ - forAllBranches?: boolean + forAllBranches?: boolean | undefined } /** @@ -107,7 +112,7 @@ export interface CreditArrangementSettings { /** * Shows whether accounts created after this product can/should be part of a line of credit. */ - creditArrangementRequirement?: 'OPTIONAL' | 'REQUIRED' | 'NOT_REQUIRED' + creditArrangementRequirement?: 'OPTIONAL' | 'REQUIRED' | 'NOT_REQUIRED' | undefined } /** @@ -301,15 +306,17 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } /** @@ -319,11 +326,11 @@ export interface DaysInMonth { /** * 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. */ - daysInMonth?: number[] + daysInMonth?: number[] | undefined /** * 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. */ - shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' + shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' | undefined } /** @@ -333,19 +340,19 @@ export interface DecimalConstraints { /** * The default value, will be used in case no other value was filled in by the user. */ - defaultValue?: number + defaultValue?: number | undefined /** * The encoded key of the decimal constraint, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The maximum value. */ - maxValue?: number + maxValue?: number | undefined /** * The minimum value. */ - minValue?: number + minValue?: number | undefined } /** @@ -355,15 +362,15 @@ export interface DecimalInterval { /** * The default value, will be used in case no other value was filled in by the user. */ - defaultValue?: number + defaultValue?: number | undefined /** * The maximum value. */ - maxValue?: number + maxValue?: number | undefined /** * The minimum value. */ - minValue?: number + minValue?: number | undefined } /** @@ -373,31 +380,31 @@ export interface DocumentTemplate { /** * The creation date of the document */ - creationDate?: string + creationDate?: string | undefined /** * The document encodedKey */ - encodedKey?: string + encodedKey?: string | undefined /** * The last modified date of the document */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The name the document */ - name?: string + name?: string | undefined /** * The type of the template */ - type?: 'ACCOUNT' | 'TRANSACTION' | 'ACCOUNT_WITH_TRANSACTIONS' + type?: 'ACCOUNT' | 'TRANSACTION' | 'ACCOUNT_WITH_TRANSACTIONS' | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -405,10 +412,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -419,11 +427,11 @@ export interface FeesSettings { /** * Only if true users will be able to apply fees, for current object, of type 'Other'; these fees can have any amount. */ - allowArbitraryFees?: boolean + allowArbitraryFees?: boolean | undefined /** * List of all fees that can be applied for accounts of this loan product. */ - fees?: PredefinedFee[] + fees?: PredefinedFee[] | undefined } /** @@ -433,7 +441,7 @@ export interface FeeTaxSettings { /** * Marks a specific fee as non-taxable (taxes are not calculated for it).Feature is in the Early Stage. To be enabled by request. */ - taxableCalculationMethod?: 'DEFAULT' | 'NON_TAXABLE' | 'CUSTOM_TAX' + taxableCalculationMethod?: 'DEFAULT' | 'NON_TAXABLE' | 'CUSTOM_TAX' | undefined } /** @@ -443,7 +451,7 @@ export interface FourEyesPrinciple { /** * Requires separate users to create and approve loan accounts */ - activeForLoanApproval?: boolean + activeForLoanApproval?: boolean | undefined } /** @@ -453,27 +461,27 @@ export interface FundingSettings { /** * Indicates whether the product has the investor funds enabled or not. */ - enabled?: boolean - funderInterestCommission?: DecimalConstraints + enabled?: boolean | undefined + funderInterestCommission?: DecimalConstraints | undefined /** * 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). */ - funderInterestCommissionAllocationType?: 'PERCENTAGE_OF_LOAN_FUNDING' | 'FIXED_INTEREST_COMMISSIONS' + funderInterestCommissionAllocationType?: 'PERCENTAGE_OF_LOAN_FUNDING' | 'FIXED_INTEREST_COMMISSIONS' | undefined /** * Shows whether investor funds are locked or not at the loan account's approval. */ - lockFundsAtApproval?: boolean - organizationInterestCommission?: DecimalConstraints + lockFundsAtApproval?: boolean | undefined + organizationInterestCommission?: DecimalConstraints | undefined /** * The required investor funds percentage, for opening an account with external funding. If null, the investor funds are not enabled. */ - requiredFunds?: number + requiredFunds?: number | undefined } export type GetAllResponse = LoanProduct[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -481,6 +489,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -490,7 +504,7 @@ export interface GLAccountingRule { /** * The encoded key of the accounting rule, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * General Ledger Financial Resources used to setup the product accounting rules and determine the credit and debit accounts when logging journal entries */ @@ -529,18 +543,18 @@ export interface GLAccountingRule { /** * The key of the transaction rule that uses this rule */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } /** * The funding settings, holds the settings regarding the funding for the loan product. */ export interface GracePeriodSettings { - gracePeriod?: IntegerIntervalConstraints + gracePeriod?: IntegerIntervalConstraints | undefined /** * The grace period type. Representing the type of grace period which is possible for a loan account. */ - gracePeriodType?: 'NONE' | 'PAY_INTEREST_ONLY' | 'INTEREST_FORGIVENESS' + gracePeriodType?: 'NONE' | 'PAY_INTEREST_ONLY' | 'INTEREST_FORGIVENESS' | undefined } /** @@ -550,19 +564,19 @@ export interface IntegerIntervalConstraints { /** * The default value, will be used in case no other value was filled in by the user. */ - defaultValue?: number + defaultValue?: number | undefined /** * The encoded key of the integer constraint, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The maximum value. */ - maxValue?: number + maxValue?: number | undefined /** * The minimum value. */ - minValue?: number + minValue?: number | undefined } /** @@ -572,70 +586,63 @@ export interface InterestProductSettings { /** * If the product supports this option, specify if the interest should be accrued after the account maturity date */ - accrueInterestAfterMaturity?: boolean + accrueInterestAfterMaturity?: boolean | undefined /** * Indicator whether the loan product allows negative values for interest rate or interest spread */ - allowNegativeInterestRate?: boolean + allowNegativeInterestRate?: boolean | undefined /** * The encoded key of the interest rate tier, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Index rate source key. */ - indexSourceKey?: string + indexSourceKey?: string | undefined /** * The interval used for determining how often is interest charged */ - interestChargeFrequency?: 'ANNUALIZED' | 'EVERY_MONTH' | 'EVERY_FOUR_WEEKS' | 'EVERY_WEEK' | 'EVERY_DAY' | 'EVERY_X_DAYS' + interestChargeFrequency?: + | 'ANNUALIZED' + | 'EVERY_MONTH' + | 'EVERY_FOUR_WEEKS' + | 'EVERY_WEEK' + | 'EVERY_DAY' + | 'EVERY_X_DAYS' + | undefined /** * the count of units to apply over the interval */ - interestChargeFrequencyCount?: number - interestRate?: DecimalInterval + interestChargeFrequencyCount?: number | undefined + interestRate?: DecimalInterval | undefined /** * Interest spread + index interest rate can't be more than this amount (valid only for index interest rate products). */ - interestRateCeilingValue?: number + interestRateCeilingValue?: number | undefined /** * Interest spread + index interest rate can't be less than this amount (valid only for index interest rate products). */ - interestRateFloorValue?: number + interestRateFloorValue?: number | undefined /** * Interest rate review frequency unit count */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * Interest rate review frequency measurement unit */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * Interest calculation method: fixed or (interest spread + active organization index interest rate) */ - interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' + interestRateSource?: 'FIXED_INTEREST_RATE' | 'INDEX_INTEREST_RATE' | undefined /** * The option for how is the interest rate determined when being accrued for an account */ - interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' + interestRateTerms?: 'FIXED' | 'TIERED' | 'TIERED_PERIOD' | 'TIERED_BAND' | undefined /** * The list of interest rate tiers available for the current settings instance */ - interestRateTiers?: InterestRateTier[] -} - -/** - * Represents interest rate change threshold settings for loan accounts and loan products. - */ -export interface InterestRateChangePMTAdjustmentThreshold { - /** - * The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS - */ - method?: 'WORKING_DAYS' | 'CALENDAR_DAYS' - /** - * The number of days that trigger an interest rate change. - */ - numberOfDays?: number + interestRateTiers?: InterestRateTier[] | undefined } /** @@ -645,11 +652,11 @@ export interface InterestRateTier { /** * The encoded key of the interest rate tier, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The top-limit value for the account balance in order to determine if this tier is used or not */ - endingBalance?: number + endingBalance?: number | undefined /** * The rate used for computing the interest for an account which has the balance less than the ending balance */ @@ -663,87 +670,94 @@ export interface InternalControls { /** * Specifies the number of days for an account to be fully paid in order to auto close it. */ - dormancyPeriodDays?: number - fourEyesPrinciple?: FourEyesPrinciple - lockSettings?: LockSettings + dormancyPeriodDays?: number | undefined + fourEyesPrinciple?: FourEyesPrinciple | undefined + lockSettings?: LockSettings | undefined } /** * The amount settings, holds all amount properties. */ export interface LoanAmountSettings { - loanAmount?: AmountDecimalConstraints - trancheSettings?: TrancheSettings + loanAmount?: AmountDecimalConstraints | undefined + trancheSettings?: TrancheSettings | undefined } /** * Represents a loan product. */ export interface LoanProduct { - accountingSettings?: AccountingSettings - accountLinkSettings?: AccountLinkSettings + accountingSettings?: AccountingSettings | undefined + accountLinkSettings?: AccountLinkSettings | undefined /** * `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. */ - adjustInterestForFirstInstallment?: boolean + adjustInterestForFirstInstallment?: boolean | undefined /** * `TRUE` if an additional payment may be allocated on the account, ignoring the default repayment allocation order, `FALSE` otherwise. */ - allowCustomRepaymentAllocation?: boolean - arrearsSettings?: ProductArrearsSettings - availabilitySettings?: ProductAvailabilitySettings + allowCustomRepaymentAllocation?: boolean | undefined + arrearsSettings?: ProductArrearsSettings | undefined + availabilitySettings?: ProductAvailabilitySettings | undefined /** * The category of the loan product. */ - category?: 'PERSONAL_LENDING' | 'PURCHASE_FINANCING' | 'RETAIL_MORTGAGES' | 'SME_LENDING' | 'COMMERCIAL' | 'UNCATEGORIZED' + category?: + | 'PERSONAL_LENDING' + | 'PURCHASE_FINANCING' + | 'RETAIL_MORTGAGES' + | 'SME_LENDING' + | 'COMMERCIAL' + | 'UNCATEGORIZED' + | undefined /** * The date the loan product was created. */ - creationDate?: string + creationDate?: string | undefined creditArrangementSettings: CreditArrangementSettings - currency?: Currency + currency?: Currency | undefined /** * The encoded key of the loan product, it is auto generated, and unique. */ - encodedKey?: string - feesSettings?: FeesSettings - fundingSettings?: FundingSettings - gracePeriodSettings?: GracePeriodSettings + encodedKey?: string | undefined + feesSettings?: FeesSettings | undefined + fundingSettings?: FundingSettings | undefined + gracePeriodSettings?: GracePeriodSettings | undefined /** * The ID of the loan product, can be generated and customized, and must be unique. */ id: string - interestSettings?: ProductInterestSettings - internalControls?: InternalControls + interestSettings?: ProductInterestSettings | undefined + internalControls?: InternalControls | undefined /** * The last date the loan product was updated. */ - lastModifiedDate?: string - loanAmountSettings?: LoanAmountSettings + lastModifiedDate?: string | undefined + loanAmountSettings?: LoanAmountSettings | undefined /** * The name of the loan product. */ name: string - newAccountSettings?: NewAccountSettings + newAccountSettings?: NewAccountSettings | undefined /** * The notes or description of the loan product. */ - notes?: string - offsetSettings?: OffsetSettings - paymentSettings?: PaymentSettings - penaltySettings?: ProductPenaltySettings - redrawSettings?: ProductRedrawSettings - scheduleSettings?: LoanProductScheduleSettings - securitySettings?: SecuritySettings + notes?: string | undefined + offsetSettings?: OffsetSettings | undefined + paymentSettings?: PaymentSettings | undefined + penaltySettings?: ProductPenaltySettings | undefined + redrawSettings?: ProductRedrawSettings | undefined + scheduleSettings?: LoanProductScheduleSettings | undefined + securitySettings?: SecuritySettings | undefined /** * The current state of the loan product. */ - state?: 'ACTIVE' | 'INACTIVE' - taxSettings?: TaxSettings + state?: 'ACTIVE' | 'INACTIVE' | undefined + taxSettings?: TaxSettings | undefined /** * The template documents of the loan product. */ - templates?: DocumentTemplate[] + templates?: DocumentTemplate[] | undefined /** * The type of the loan product. */ @@ -757,7 +771,7 @@ export interface LoanProduct { } export const LoanProduct = { - validate: (await import('./schemas/loan-product.schema.js')).validate as ValidateFunction, + validate: LoanProductValidator as ValidateFunction, get schema() { return LoanProduct.validate.schema }, @@ -765,10 +779,11 @@ export const LoanProduct = { return LoanProduct.validate.errors ?? undefined }, is: (o: unknown): o is LoanProduct => LoanProduct.validate(o) === true, - assert: (o: unknown) => { - if (!LoanProduct.validate(o)) { - throw new ValidationError(LoanProduct.errors ?? []) + parse: (o: unknown): { right: LoanProduct } | { left: DefinedError[] } => { + if (LoanProduct.is(o)) { + return { right: o } } + return { left: (LoanProduct.errors ?? []) as DefinedError[] } }, } as const @@ -776,31 +791,31 @@ export const LoanProduct = { * Defines the settings and constraints for schedule for the loans that are created based on this product. */ export interface LoanProductScheduleSettings { - amortizationPeriod?: ProductAmortizationPeriod - billingCycles?: BillingCyclesProductSettings + amortizationPeriod?: ProductAmortizationPeriod | undefined + billingCycles?: BillingCyclesProductSettings | undefined /** * Interval Repayment Methodology Settings. */ - defaultRepaymentPeriodCount?: number - firstRepaymentDueDateOffset?: IntegerIntervalConstraints + defaultRepaymentPeriodCount?: number | undefined + firstRepaymentDueDateOffset?: IntegerIntervalConstraints | undefined /** * 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. */ - fixedDaysOfMonth?: number[] + fixedDaysOfMonth?: number[] | undefined /** * Represents the moment the interest will start getting accrued. */ - interestAccrualSince?: 'DISBURSEMENT' | 'DUE_DATE' - numInstallments?: IntegerIntervalConstraints - previewSchedule?: PreviewScheduleSettings + interestAccrualSince?: 'DISBURSEMENT' | 'DUE_DATE' | undefined + numInstallments?: IntegerIntervalConstraints | undefined + previewSchedule?: PreviewScheduleSettings | undefined /** * The repayment method value */ - repaymentMethod?: 'AMOUNT' | 'INSTALLMENTS' + repaymentMethod?: 'AMOUNT' | 'INSTALLMENTS' | undefined /** * The frequency of the loan repayment. */ - repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' + repaymentPeriodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' | undefined /** * The repayment rescheduling method used in calculations. */ @@ -808,33 +823,23 @@ export interface LoanProductScheduleSettings { /** * Shows the properties from the repayment schedule can be edited. */ - repaymentScheduleEditOptions?: Local1[] + repaymentScheduleEditOptions?: RepaymentScheduleEditOptions[] | undefined /** * 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. */ repaymentScheduleMethod: 'NONE' | 'FIXED' | 'DYNAMIC' - roundingSettings?: RoundingSettings + roundingSettings?: RoundingSettings | undefined /** * The methodology used by this product to compute the due dates of the repayments. */ scheduleDueDatesMethod: 'INTERVAL' | 'FIXED_DAYS_OF_MONTH' + scheduleEditOptionDetails?: RepaymentScheduleEditOptionDetails | undefined /** * 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. */ - shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' + shortMonthHandlingMethod?: 'LAST_DAY_IN_MONTH' | 'FIRST_DAY_OF_NEXT_MONTH' | undefined } -type Local0 = 'PRINCIPAL' | 'INTEREST' | 'FEE' | 'PENALTY' - -type Local1 = - | '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' - /** * Settings applied when transitioning accounts to Locked state */ @@ -842,19 +847,19 @@ export interface LockSettings { /** * Specifies constraint types for capping charges. */ - cappingConstraintType?: 'SOFT_CAP' | 'HARD_CAP' + cappingConstraintType?: 'SOFT_CAP' | 'HARD_CAP' | undefined /** * Specifies how principal will be used when calculating capping charges. */ - cappingMethod?: 'OUTSTANDING_PRINCIPAL_PERCENTAGE' | 'ORIGINAL_PRINCIPAL_PERCENTAGE' + cappingMethod?: 'OUTSTANDING_PRINCIPAL_PERCENTAGE' | 'ORIGINAL_PRINCIPAL_PERCENTAGE' | undefined /** * Specifies the percentage of principal that cannot be exceeded by the sum of interest, fees and penalty balances. */ - cappingPercentage?: number + cappingPercentage?: number | undefined /** * Specifies the number of days for in which the account will be locked if it stays in arrears. */ - lockPeriodDays?: number + lockPeriodDays?: number | undefined } /** @@ -882,7 +887,7 @@ export interface OffsetSettings { /** * Indicates whether the product supports offset */ - allowOffset?: boolean + allowOffset?: boolean | undefined } /** @@ -892,7 +897,7 @@ export interface PatchOperation { /** * The field from where a value should be moved, when using move */ - from?: string + from?: string | undefined /** * The change to perform */ @@ -904,15 +909,13 @@ export interface PatchOperation { /** * The value of the field, can be null */ - value?: { - [k: string]: unknown | undefined - } + value?: unknown } export type PatchRequest = PatchOperation[] export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, + validate: PatchRequestValidator as ValidateFunction, get schema() { return PatchRequest.validate.schema }, @@ -920,13 +923,24 @@ export const PatchRequest = { return PatchRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } }, } as const +/** + * Holds Payment Holidays Settings + */ +export interface PaymentHolidaysSettings { + /** + * payment holiday option + */ + paymentHolidaysLoanTermOption?: 'EXTEND_LOAN_TERM' | 'KEEP_THE_SAME_LOAN_TERM' | undefined +} + /** * Defines the payment settings for the loan product and for loans crated based on this product. */ @@ -934,21 +948,21 @@ export interface PaymentSettings { /** * Payments Method used by loan accounts for repayments schedule generation. */ - amortizationMethod?: 'STANDARD_PAYMENTS' | 'BALLOON_PAYMENTS' | 'OPTIMIZED_PAYMENTS' | 'PAYMENT_PLAN' + amortizationMethod?: 'STANDARD_PAYMENTS' | 'BALLOON_PAYMENTS' | 'OPTIMIZED_PAYMENTS' | 'PAYMENT_PLAN' | undefined /** * Recalculate the schedule when late payments are posted on dynamic Equal Installments loans. */ - latePaymentsRecalculationMethod: 'OVERDUE_INSTALLMENTS_INCREASE' | 'LAST_INSTALLMENT_INCREASE' + latePaymentsRecalculationMethod: 'OVERDUE_INSTALLMENTS_INCREASE' | 'LAST_INSTALLMENT_INCREASE' | 'NO_RECALCULATION' /** * 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) */ paymentMethod: 'HORIZONTAL' | 'VERTICAL' - prepaymentSettings?: ProductPrepaymentSettings - principalPaymentSettings?: PrincipalPaymentProductSettings + prepaymentSettings?: ProductPrepaymentSettings | undefined + principalPaymentSettings?: PrincipalPaymentProductSettings | undefined /** * A list of basic repayment allocation elements such as the principal, interest & fees. */ - repaymentAllocationOrder: Local0[] + repaymentAllocationOrder: ('PRINCIPAL' | 'INTEREST' | 'FEE' | 'PENALTY')[] } /** @@ -958,37 +972,52 @@ export interface PeriodIntervalSettings { /** * Type of amortization profile used for fee */ - amortizationProfile?: 'NONE' | 'SUM_OF_YEARS_DIGITS' | 'STRAIGHT_LINE' | 'EFFECTIVE_INTEREST_RATE' + amortizationProfile?: 'NONE' | 'SUM_OF_YEARS_DIGITS' | 'STRAIGHT_LINE' | 'EFFECTIVE_INTEREST_RATE' | undefined /** * The encoded key of the period interval settings, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Flag for signaling if fee amortization should be continued or finished at account reschedule/refinance */ feeAmortizationUponRescheduleRefinanceOption?: | 'END_AMORTIZATION_ON_THE_ORIGINAL_ACCOUNT' | 'CONTINUE_AMORTIZATION_ON_THE_RESCHEDULED_REFINANCED_ACCOUNT' + | undefined /** * Frequency settings of the fee amortization */ - frequency?: 'ACCOUNT_INSTALLMENTS_DUE_DATES' | 'ACCOUNT_INSTALLMENTS_DUE_DATES_DAILY_BOOKING' | 'CUSTOM_INTERVAL' + frequency?: 'ACCOUNT_INSTALLMENTS_DUE_DATES' | 'ACCOUNT_INSTALLMENTS_DUE_DATES_DAILY_BOOKING' | 'CUSTOM_INTERVAL' | undefined /** * Total number of intervals */ - intervalCount?: number + intervalCount?: number | undefined /** * Defines the options for an interval */ - intervalType?: 'PREDEFINED_INTERVALS' | 'FULL_TERM' + intervalType?: 'PREDEFINED_INTERVALS' | 'FULL_TERM' | undefined /** * Period count used in conjunction with periodUnit to determine the next date of the interval */ - periodCount?: number + periodCount?: number | undefined /** * Amortization unit to determine the interval between amortizations */ - periodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' + periodUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS' | undefined +} + +/** + * Represents PMT Adjustment threshold settings for loan accounts and loan products. + */ +export interface PMTAdjustmentThreshold { + /** + * The method used to calculate the PMT Adjustment threshold. Supported value is CALENDAR_DAYS + */ + method?: 'WORKING_DAYS' | 'CALENDAR_DAYS' | undefined + /** + * The number of days that trigger a PMT Adjustment. + */ + numberOfDays?: number | undefined } /** @@ -998,16 +1027,16 @@ export interface PredefinedFee { /** * A list of accounting rules defined for this fee. If null, product default rules are selected. */ - accountingRules?: GLAccountingRule[] - amortizationSettings?: PeriodIntervalSettings + accountingRules?: GLAccountingRule[] | undefined + amortizationSettings?: PeriodIntervalSettings | undefined /** * The amount of the fee */ - amount?: number + amount?: number | undefined /** * Mambu Function name used for the fee calculation */ - amountCalculationFunctionName?: string + amountCalculationFunctionName?: string | undefined /** * The amount from which the fee is calculated using percentageAmount */ @@ -1021,18 +1050,19 @@ export interface PredefinedFee { | 'IOF_PERCENTAGE_OF_INSTALLMENT_PRINCIPAL' | 'IOF_PERCENTAGE_OF_LATE_INSTALLMENT_PRINCIPAL' | 'MAMBU_FUNCTION' + | undefined /** * Shows when a fee should be applied; to be used with monthly deposit fees */ - applyDateMethod?: 'MONTHLY_FROM_ACTIVATION' | 'FIRST_OF_EVERY_MONTH' + applyDateMethod?: 'MONTHLY_FROM_ACTIVATION' | 'FIRST_OF_EVERY_MONTH' | undefined /** * Shows the creation date of the fee */ - creationDate?: string + creationDate?: string | undefined /** * The encoded key of the predefined fee, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The type of fee application when disbursement is applied */ @@ -1040,24 +1070,24 @@ export interface PredefinedFee { /** * The id of the fee */ - id?: string + id?: string | undefined /** * Shows the last modified date of the fee */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The name of the fee */ - name?: string + name?: string | undefined /** * The amount of the fee in percents applied to percentSource */ - percentageAmount?: number + percentageAmount?: number | undefined /** * Indicates the state of the fee */ state: 'ACTIVE' | 'INACTIVE' - taxSettings?: FeeTaxSettings + taxSettings?: FeeTaxSettings | undefined /** * Shows the event that will trigger a fee */ @@ -1082,43 +1112,43 @@ export interface PreviewScheduleSettings { /** * Number of Previewed Instalments. */ - numberOfPreviewedInstalments?: number + numberOfPreviewedInstalments?: number | undefined /** * Preview Schedule status. */ - previewScheduleEnabled?: boolean + previewScheduleEnabled?: boolean | undefined } /** * Defines the principal payment settings constraints for the loans that will be created based on this product. */ export interface PrincipalPaymentProductSettings { - amount?: AmountDecimalConstraints + amount?: AmountDecimalConstraints | undefined /** * How many repayments the principal has to be paid */ - defaultPrincipalRepaymentInterval?: number + defaultPrincipalRepaymentInterval?: number | undefined /** * The encoded key of the settings, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * If true, the fees will be included along with the principal in the repayment floor amount, for a revolving credit account */ - includeFeesInFloorAmount?: boolean + includeFeesInFloorAmount?: boolean | undefined /** * If true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account */ - includeInterestInFloorAmount?: boolean - percentage?: DecimalConstraints + includeInterestInFloorAmount?: boolean | undefined + percentage?: DecimalConstraints | undefined /** * The maximum principal due amount a repayment made with this settings can have */ - principalCeilingValue?: number + principalCeilingValue?: number | undefined /** * The minimum principal due amount a repayment made with this settings can have */ - principalFloorValue?: number + principalFloorValue?: number | undefined /** * The method of principal payment for revolving credit */ @@ -1129,10 +1159,11 @@ export interface PrincipalPaymentProductSettings { | 'TOTAL_BALANCE_PERCENTAGE' | 'TOTAL_BALANCE_FLAT' | 'TOTAL_PRINCIPAL_PERCENTAGE' + | undefined /** * The minimum total due amount a repayment made with this settings can have */ - totalDueAmountFloor?: number + totalDueAmountFloor?: number | undefined /** * The method of total due payment for revolving credit */ @@ -1143,6 +1174,7 @@ export interface PrincipalPaymentProductSettings { | 'TOTAL_BALANCE_PERCENTAGE' | 'TOTAL_BALANCE_FLAT' | 'TOTAL_PRINCIPAL_PERCENTAGE' + | undefined } /** @@ -1152,15 +1184,15 @@ export interface ProductAmortizationPeriod { /** * default value */ - defaultValue?: number + defaultValue?: number | undefined /** * max value */ - maxValue?: number + maxValue?: number | undefined /** * min value */ - minValue?: number + minValue?: number | undefined } /** @@ -1174,28 +1206,29 @@ export interface ProductArrearsSettings { | 'ACCOUNT_FIRST_WENT_TO_ARREARS' | 'LAST_LATE_REPAYMENT' | 'ACCOUNT_FIRST_BREACHED_MATERIALITY_THRESHOLD' + | undefined /** * The encoded key of the arrears base settings, auto generated, unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * Defines the tolerance monthly date */ - monthlyToleranceDay?: number + monthlyToleranceDay?: number | undefined /** * Shows whether the non working days are taken in consideration or not when applying penaltees/late fees or when setting an account into arrears */ - nonWorkingDaysMethod?: 'INCLUDED' | 'EXCLUDED' + nonWorkingDaysMethod?: 'INCLUDED' | 'EXCLUDED' | undefined /** * Defines the tolerance calculation method */ - toleranceCalculationMethod?: 'ARREARS_TOLERANCE_PERIOD' | 'MONTHLY_ARREARS_TOLERANCE_DAY' + toleranceCalculationMethod?: 'ARREARS_TOLERANCE_PERIOD' | 'MONTHLY_ARREARS_TOLERANCE_DAY' | undefined /** * The tolerance floor amount. */ - toleranceFloorAmount?: number - tolerancePercentageOfOutstandingPrincipal?: DecimalInterval - tolerancePeriod?: IntegerIntervalConstraints + toleranceFloorAmount?: number | undefined + tolerancePercentageOfOutstandingPrincipal?: DecimalInterval | undefined + tolerancePeriod?: IntegerIntervalConstraints | undefined } /** @@ -1205,8 +1238,8 @@ export interface ProductAvailabilitySettings { /** * Holds the entities this product is available for. i.e Individuals */ - availableFor?: ('INDIVIDUALS' | 'PURE_GROUPS' | 'SOLIDARITY_GROUPS')[] - branchSettings?: BranchSettings + availableFor?: ('INDIVIDUALS' | 'PURE_GROUPS' | 'SOLIDARITY_GROUPS')[] | undefined + branchSettings?: BranchSettings | undefined } /** @@ -1216,28 +1249,28 @@ export interface ProductInterestRateSettings { /** * The encoded key of the interest rate settings, auto generated, unique */ - encodedKey?: string + encodedKey?: string | undefined /** * Index rate source key. */ - indexSourceKey?: string - interestRate?: DecimalInterval + indexSourceKey?: string | undefined + interestRate?: DecimalInterval | undefined /** * Maximum value allowed for index based interest rate. Valid only for index interest rate. */ - interestRateCeilingValue?: number + interestRateCeilingValue?: number | undefined /** * Minimum value allowed for index based interest rate. Valid only for index interest rate. */ - interestRateFloorValue?: number + interestRateFloorValue?: number | undefined /** * Interest rate review frequency unit count. Valid only for index interest rate. */ - interestRateReviewCount?: number + interestRateReviewCount?: number | undefined /** * Interest rate review frequency measurement unit. Valid only for index interest rate. */ - interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' + interestRateReviewUnit?: 'DAYS' | 'WEEKS' | 'MONTHS' | undefined /** * Interest calculation method: fixed or indexed(interest spread + active organization index interest rate) */ @@ -1251,38 +1284,38 @@ export interface ProductInterestSettings { /** * Whether late interest should be accrued, applied and paid */ - accrueLateInterest?: boolean + accrueLateInterest?: boolean | undefined /** * 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' + compoundingFrequency?: 'DAILY' | 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' - indexRateSettings?: InterestProductSettings - interestApplicationDays?: DaysInMonth + indexRateSettings?: InterestProductSettings | 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. */ - interestApplicationMethod?: 'AFTER_DISBURSEMENT' | 'REPAYMENT_DUE_DATE' | 'FIXED_DAYS_OF_MONTH' + interestApplicationMethod?: 'AFTER_DISBURSEMENT' | 'REPAYMENT_DUE_DATE' | 'FIXED_DAYS_OF_MONTH' | undefined /** * The interest balance calculation method. Represents the option which determines the way the balance for the account's interest is computed. */ - interestBalanceCalculationMethod?: 'ONLY_PRINCIPAL' | 'PRINCIPAL_AND_INTEREST' + interestBalanceCalculationMethod?: 'ONLY_PRINCIPAL' | 'PRINCIPAL_AND_INTEREST' | undefined /** * The interest calculation method. Holds the type of interest calculation method. */ interestCalculationMethod: 'FLAT' | 'DECLINING_BALANCE' | 'DECLINING_BALANCE_DISCOUNTED' | 'EQUAL_INSTALLMENTS' - interestRateChangePMTAdjustmentThreshold?: InterestRateChangePMTAdjustmentThreshold /** * Adjustable interest rates settings */ - interestRateSettings?: ProductInterestRateSettings[] + interestRateSettings?: ProductInterestRateSettings[] | undefined /** * The possible values for how we compute and apply the interest */ - interestType?: 'SIMPLE_INTEREST' | 'CAPITALIZED_INTEREST' | 'COMPOUNDING_INTEREST' + interestType?: 'SIMPLE_INTEREST' | 'CAPITALIZED_INTEREST' | 'COMPOUNDING_INTEREST' | undefined + pmtAdjustmentThreshold?: PMTAdjustmentThreshold | undefined /** * Shows whether all the installments should compute the interest based on the actual number of days or based on the defined repayment periodicity. */ @@ -1300,8 +1333,8 @@ export interface ProductPenaltySettings { /** * Number of days to wait before applying the loan penalty amounts */ - loanPenaltyGracePeriod?: number - penaltyRate?: DecimalConstraints + loanPenaltyGracePeriod?: number | undefined + penaltyRate?: DecimalConstraints | undefined } /** @@ -1311,15 +1344,15 @@ export interface ProductPrepaymentSettings { /** * Whether the interest on prepayment is applied manual or automatic. */ - applyInterestOnPrepaymentMethod?: 'AUTOMATIC' | 'MANUAL' + applyInterestOnPrepaymentMethod?: 'AUTOMATIC' | 'MANUAL' | undefined /** * The elements recalculation method, indicates how the declining balance with equal installments repayments are recalculated */ - elementsRecalculationMethod?: 'PRINCIPAL_EXPECTED_FIXED' | 'TOTAL_EXPECTED_FIXED' + elementsRecalculationMethod?: 'PRINCIPAL_EXPECTED_FIXED' | 'TOTAL_EXPECTED_FIXED' | undefined /** * ERC free allowance in percentage */ - ercFreeAllowance?: number + ercFreeAllowance?: number | undefined /** * Shows whether the future payments are allowed or not for this product (repayment transactions with entry date set in the future) */ @@ -1327,7 +1360,7 @@ export interface ProductPrepaymentSettings { /** * Shows whether the pre-payments are allowed or not for this product. */ - prepaymentAcceptance?: 'ACCEPT_PREPAYMENTS' | 'NO_PREPAYMENTS' + prepaymentAcceptance?: 'ACCEPT_PREPAYMENTS' | 'NO_PREPAYMENTS' | undefined /** * Prepayment recalculation method copied from the loan product on which this account is based */ @@ -1340,10 +1373,11 @@ export interface ProductPrepaymentSettings { | 'REDUCE_AMOUNT_PER_INSTALLMENT' | 'REDUCE_NUMBER_OF_INSTALLMENTS' | 'REDUCE_NUMBER_OF_INSTALLMENTS_NEW' + | undefined /** * Installment status for the case when principal is paid off (copied from loan product) */ - principalPaidInstallmentStatus?: 'PARTIALLY_PAID' | 'PAID' | 'ORIGINAL_TOTAL_EXPECTED_PAID' + principalPaidInstallmentStatus?: 'PARTIALLY_PAID' | 'PAID' | 'ORIGINAL_TOTAL_EXPECTED_PAID' | undefined } /** @@ -1356,10 +1390,26 @@ export interface ProductRedrawSettings { allowRedraw: boolean } +/** + * Holds Repayments Schedule Editing options + */ +export interface RepaymentScheduleEditOptionDetails { + paymentHolidaysSettings?: PaymentHolidaysSettings | undefined +} + +type RepaymentScheduleEditOptions = + | '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' + export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -1390,15 +1440,15 @@ export interface SecuritySettings { /** * Shows whether collateral (assets or other goods) are accepted in order to reach required securities percentage from loan amount, as defined in this product. */ - isCollateralEnabled?: boolean + isCollateralEnabled?: boolean | undefined /** * Shows whether guarantors (other clients) are accepted in order to reach the required securities percentage from loan amount, as defined in this product. */ - isGuarantorsEnabled?: boolean + isGuarantorsEnabled?: boolean | undefined /** * The securities percentage from loan amount that is needed in order for this account to be approved. Null if the securities are not required. */ - requiredGuaranties?: number + requiredGuaranties?: number | undefined } /** @@ -1408,23 +1458,23 @@ export interface TaxSettings { /** * Shows whether the tax is added on top of the target amount or not. */ - taxCalculationMethod?: 'INCLUSIVE' | 'EXCLUSIVE' + taxCalculationMethod?: 'INCLUSIVE' | 'EXCLUSIVE' | undefined /** * Shows whether taxes on fees are enabled for this product or not. */ - taxesOnFeesEnabled?: boolean + taxesOnFeesEnabled?: boolean | undefined /** * Shows whether taxes on interest are enabled for this product or not. */ - taxesOnInterestEnabled?: boolean + taxesOnInterestEnabled?: boolean | undefined /** * Shows whether taxes on penalties are enabled for this product or not. */ - taxesOnPenaltyEnabled?: boolean + taxesOnPenaltyEnabled?: boolean | undefined /** * The tax source from where the loan account taxes will be updated. */ - taxSourceKey?: string + taxSourceKey?: string | undefined } /** @@ -1434,5 +1484,5 @@ export interface TrancheSettings { /** * The number of tranches supported by the loan product */ - maxNumberOfTranches?: number + maxNumberOfTranches?: number | undefined } diff --git a/src/loan-products/schemas/error-response.schema.js b/src/loan-products/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/loan-products/schemas/error-response.schema.js +++ b/src/loan-products/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;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},"InterestRateChangePMTAdjustmentThresholdaf30":{"type":"object","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"additionalProperties":true},"ProductInterestRateSettingsaf30":{"type":"object","title":"ProductInterestRateSettingsaf30","description":"Adjustable interest rates settings","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate settings, auto generated, unique"},"indexSourceKey":{"type":"string","title":"indexSourceKey","description":"Index rate source key."},"interestRate":{"title":"interestRate","$ref":"#/$defs/DecimalIntervalaf30"},"interestRateCeilingValue":{"type":"number","title":"interestRateCeilingValue","description":"Maximum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateFloorValue":{"type":"number","title":"interestRateFloorValue","description":"Minimum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateReviewCount":{"type":"integer","title":"interestRateReviewCount","description":"Interest rate review frequency unit count. Valid only for index interest rate."},"interestRateReviewUnit":{"title":"interestRateReviewUnit","description":"Interest rate review frequency measurement unit. Valid only for index interest rate.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"title":"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},"InternalControlsaf30":{"type":"object","title":"InternalControlsaf30","description":"Constraints and automated actions and that will be applied on the accounts.","properties":{"dormancyPeriodDays":{"type":"integer","title":"dormancyPeriodDays","description":"Specifies the number of days for an account to be fully paid in order to auto close it."},"fourEyesPrinciple":{"title":"fourEyesPrinciple","$ref":"#/$defs/FourEyesPrincipleaf30"},"lockSettings":{"title":"lockSettings","$ref":"#/$defs/LockSettingsaf30"}},"additionalProperties":true},"FourEyesPrincipleaf30":{"type":"object","title":"FourEyesPrincipleaf30","description":"Settings for Four Eyes Principle","properties":{"activeForLoanApproval":{"type":"boolean","title":"activeForLoanApproval","description":"Requires separate users to create and approve loan accounts"}},"additionalProperties":true},"LockSettingsaf30":{"type":"object","title":"LockSettingsaf30","description":"Settings applied when transitioning accounts to Locked state","properties":{"cappingConstraintType":{"title":"cappingConstraintType","description":"Specifies constraint types for capping charges.","enum":["SOFT_CAP","HARD_CAP"]},"cappingMethod":{"title":"cappingMethod","description":"Specifies how principal will be used when calculating capping charges.","enum":["OUTSTANDING_PRINCIPAL_PERCENTAGE","ORIGINAL_PRINCIPAL_PERCENTAGE"]},"cappingPercentage":{"type":"number","title":"cappingPercentage","description":"Specifies the percentage of principal that cannot be exceeded by the sum of interest, fees and penalty balances."},"lockPeriodDays":{"type":"integer","title":"lockPeriodDays","description":"Specifies the number of days for in which the account will be locked if it stays in arrears."}},"additionalProperties":true},"LoanAmountSettingsaf30":{"type":"object","title":"LoanAmountSettingsaf30","description":"The amount settings, holds all amount properties.","properties":{"loanAmount":{"title":"loanAmount","$ref":"#/$defs/AmountDecimalConstraintsaf30"},"trancheSettings":{"title":"trancheSettings","$ref":"#/$defs/TrancheSettingsaf30"}},"additionalProperties":true},"AmountDecimalConstraintsaf30":{"type":"object","title":"AmountDecimalConstraintsaf30","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","title":"defaultValue","description":"The default value, will be used in case no other value was filled in by the user."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the decimal constraint, auto generated, unique"},"maxValue":{"type":"number","title":"maxValue","description":"The maximum value."},"minValue":{"type":"number","title":"minValue","description":"The minimum value."}},"additionalProperties":true},"TrancheSettingsaf30":{"type":"object","title":"TrancheSettingsaf30","description":"The tranche settings, indicates the settings regarding tranches in case the product is configured to support tranches.","properties":{"maxNumberOfTranches":{"type":"integer","title":"maxNumberOfTranches","description":"The number of tranches supported by the loan product"}},"additionalProperties":true},"NewAccountSettingsaf30":{"type":"object","title":"NewAccountSettingsaf30","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"title":"accountInitialState","description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"title":"idGeneratorType","description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","title":"idPattern","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["accountInitialState","idGeneratorType","idPattern"],"additionalProperties":true},"OffsetSettingsaf30":{"type":"object","title":"OffsetSettingsaf30","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","title":"allowOffset","description":"Indicates whether the product supports offset"}},"additionalProperties":true},"PaymentSettingsaf30":{"type":"object","title":"PaymentSettingsaf30","description":"Defines the payment settings for the loan product and for loans crated based on this product.","properties":{"amortizationMethod":{"title":"amortizationMethod","description":"Payments Method used by loan accounts for repayments schedule generation.","enum":["STANDARD_PAYMENTS","BALLOON_PAYMENTS","OPTIMIZED_PAYMENTS","PAYMENT_PLAN"]},"latePaymentsRecalculationMethod":{"title":"latePaymentsRecalculationMethod","description":"Recalculate the schedule when late payments are posted on dynamic Equal Installments loans.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE"]},"paymentMethod":{"title":"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":{"title":"prepaymentSettings","$ref":"#/$defs/ProductPrepaymentSettingsaf30"},"principalPaymentSettings":{"title":"principalPaymentSettings","$ref":"#/$defs/PrincipalPaymentProductSettingsaf30"},"repaymentAllocationOrder":{"type":"array","title":"repaymentAllocationOrder","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},"ProductPrepaymentSettingsaf30":{"type":"object","title":"ProductPrepaymentSettingsaf30","description":"Defines the prepayment settings for the product","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Whether the interest on prepayment is applied manual or automatic.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowance","description":"ERC free allowance in percentage"},"futurePaymentsAcceptance":{"title":"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":{"title":"prepaymentAcceptance","description":"Shows whether the pre-payments are allowed or not for this product.","enum":["ACCEPT_PREPAYMENTS","NO_PREPAYMENTS"]},"prepaymentRecalculationMethod":{"title":"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":{"title":"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},"PrincipalPaymentProductSettingsaf30":{"type":"object","title":"PrincipalPaymentProductSettingsaf30","description":"Defines the principal payment settings constraints for the loans that will be created based on this product.","properties":{"amount":{"title":"amount","$ref":"#/$defs/AmountDecimalConstraintsaf30"},"defaultPrincipalRepaymentInterval":{"type":"integer","title":"defaultPrincipalRepaymentInterval","description":"How many repayments the principal has to be paid"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the settings, auto generated, unique"},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","description":"If true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"title":"percentage","$ref":"#/$defs/DecimalConstraintsaf30"},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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},"ProductPenaltySettingsaf30":{"type":"object","title":"ProductPenaltySettingsaf30","description":"Defines the penalty settings for the product that will be used by the loan accounts based on this product","properties":{"loanPenaltyCalculationMethod":{"title":"loanPenaltyCalculationMethod","description":"The penalty calculation method","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"loanPenaltyGracePeriod":{"type":"integer","title":"loanPenaltyGracePeriod","description":"Number of days to wait before applying the loan penalty amounts"},"penaltyRate":{"title":"penaltyRate","$ref":"#/$defs/DecimalConstraintsaf30"}},"required":["loanPenaltyCalculationMethod"],"additionalProperties":true},"ProductRedrawSettingsaf30":{"type":"object","title":"ProductRedrawSettingsaf30","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","title":"allowRedraw","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true},"LoanProductScheduleSettingsaf30":{"type":"object","title":"LoanProductScheduleSettingsaf30","description":"Defines the settings and constraints for schedule for the loans that are created based on this product.","properties":{"amortizationPeriod":{"title":"amortizationPeriod","$ref":"#/$defs/ProductAmortizationPeriodaf30"},"billingCycles":{"title":"billingCycles","$ref":"#/$defs/BillingCyclesProductSettingsaf30"},"defaultRepaymentPeriodCount":{"type":"integer","title":"defaultRepaymentPeriodCount","description":"Interval Repayment Methodology Settings."},"firstRepaymentDueDateOffset":{"title":"firstRepaymentDueDateOffset","$ref":"#/$defs/IntegerIntervalConstraintsaf30"},"fixedDaysOfMonth":{"type":"array","title":"fixedDaysOfMonth","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":{"title":"interestAccrualSince","description":"Represents the moment the interest will start getting accrued.","enum":["DISBURSEMENT","DUE_DATE"]},"numInstallments":{"title":"numInstallments","$ref":"#/$defs/IntegerIntervalConstraintsaf30"},"previewSchedule":{"title":"previewSchedule","$ref":"#/$defs/PreviewScheduleSettingsaf30"},"repaymentMethod":{"title":"repaymentMethod","description":"The repayment method value","enum":["AMOUNT","INSTALLMENTS"]},"repaymentPeriodUnit":{"title":"repaymentPeriodUnit","description":"The frequency of the loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentReschedulingMethod":{"title":"repaymentReschedulingMethod","description":"The repayment rescheduling method used in calculations.","enum":["NONE","NEXT_WORKING_DAY","PREVIOUS_WORKING_DAY","EXTEND_SCHEDULE"]},"repaymentScheduleEditOptions":{"type":"array","title":"repaymentScheduleEditOptions","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":{"title":"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":{"title":"roundingSettings","$ref":"#/$defs/RoundingSettingsaf30"},"scheduleDueDatesMethod":{"title":"scheduleDueDatesMethod","description":"The methodology used by this product to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"title":"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},"ProductAmortizationPeriodaf30":{"type":"object","title":"ProductAmortizationPeriodaf30","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","title":"defaultValue","description":"default value"},"maxValue":{"type":"integer","title":"maxValue","description":"max value"},"minValue":{"type":"integer","title":"minValue","description":"min value"}},"additionalProperties":true},"BillingCyclesProductSettingsaf30":{"type":"object","title":"BillingCyclesProductSettingsaf30","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","title":"enabled","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","title":"startDays","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PreviewScheduleSettingsaf30":{"type":"object","title":"PreviewScheduleSettingsaf30","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","title":"previewScheduleEnabled","description":"Preview Schedule status."}},"additionalProperties":true},"RoundingSettingsaf30":{"type":"object","title":"RoundingSettingsaf30","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"title":"repaymentCurrencyRounding","description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"title":"repaymentElementsRoundingMethod","description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"title":"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},"SecuritySettingsaf30":{"type":"object","title":"SecuritySettingsaf30","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","title":"isCollateralEnabled","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","title":"isGuarantorsEnabled","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","title":"requiredGuaranties","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},"TaxSettingsaf30":{"type":"object","title":"TaxSettingsaf30","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"title":"taxCalculationMethod","description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","title":"taxesOnFeesEnabled","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","title":"taxesOnInterestEnabled","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","title":"taxesOnPenaltyEnabled","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","title":"taxSourceKey","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true},"DocumentTemplateaf30":{"type":"object","title":"DocumentTemplateaf30","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","title":"name","description":"The name the document"},"type":{"title":"type","description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"LoanProduct","description":"Represents a loan product.","properties":{"accountingSettings":{"title":"accountingSettings","$ref":"#/$defs/AccountingSettingsaf30"},"accountLinkSettings":{"title":"accountLinkSettings","$ref":"#/$defs/AccountLinkSettingsaf30"},"adjustInterestForFirstInstallment":{"type":"boolean","title":"adjustInterestForFirstInstallment","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","title":"allowCustomRepaymentAllocation","description":"`TRUE` if an additional payment may be allocated on the account, ignoring the default repayment allocation order, `FALSE` otherwise."},"arrearsSettings":{"title":"arrearsSettings","$ref":"#/$defs/ProductArrearsSettingsaf30"},"availabilitySettings":{"title":"availabilitySettings","$ref":"#/$defs/ProductAvailabilitySettingsaf30"},"category":{"title":"category","description":"The category of the loan product.","enum":["PERSONAL_LENDING","PURCHASE_FINANCING","RETAIL_MORTGAGES","SME_LENDING","COMMERCIAL","UNCATEGORIZED"]},"creationDate":{"type":"string","title":"creationDate","description":"The date the loan product was created.","format":"date-time"},"creditArrangementSettings":{"title":"creditArrangementSettings","$ref":"#/$defs/CreditArrangementSettingsaf30"},"currency":{"title":"currency","$ref":"#/$defs/Currencyaf30"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the loan product, it is auto generated, and unique."},"feesSettings":{"title":"feesSettings","$ref":"#/$defs/FeesSettingsaf30"},"fundingSettings":{"title":"fundingSettings","$ref":"#/$defs/FundingSettingsaf30"},"gracePeriodSettings":{"title":"gracePeriodSettings","$ref":"#/$defs/GracePeriodSettingsaf30"},"id":{"type":"string","title":"id","description":"The ID of the loan product, can be generated and customized, and must be unique."},"interestSettings":{"title":"interestSettings","$ref":"#/$defs/ProductInterestSettingsaf30"},"internalControls":{"title":"internalControls","$ref":"#/$defs/InternalControlsaf30"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last date the loan product was updated.","format":"date-time"},"loanAmountSettings":{"title":"loanAmountSettings","$ref":"#/$defs/LoanAmountSettingsaf30"},"name":{"type":"string","title":"name","description":"The name of the loan product."},"newAccountSettings":{"title":"newAccountSettings","$ref":"#/$defs/NewAccountSettingsaf30"},"notes":{"type":"string","title":"notes","description":"The notes or description of the loan product."},"offsetSettings":{"title":"offsetSettings","$ref":"#/$defs/OffsetSettingsaf30"},"paymentSettings":{"title":"paymentSettings","$ref":"#/$defs/PaymentSettingsaf30"},"penaltySettings":{"title":"penaltySettings","$ref":"#/$defs/ProductPenaltySettingsaf30"},"redrawSettings":{"title":"redrawSettings","$ref":"#/$defs/ProductRedrawSettingsaf30"},"scheduleSettings":{"title":"scheduleSettings","$ref":"#/$defs/LoanProductScheduleSettingsaf30"},"securitySettings":{"title":"securitySettings","$ref":"#/$defs/SecuritySettingsaf30"},"state":{"title":"state","description":"The current state of the loan product.","enum":["ACTIVE","INACTIVE"]},"taxSettings":{"title":"taxSettings","$ref":"#/$defs/TaxSettingsaf30"},"templates":{"type":"array","title":"templates","description":"The template documents of the loan product.","items":{"$ref":"#/$defs/DocumentTemplateaf30"}},"type":{"title":"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","title":"AccountLinkSettingsaf30","description":"Defines the settings for account linking.","properties":{"enabled":{"type":"boolean","title":"enabled","description":"Shows whether the loan accounts created using this product can be linked to a savings account."},"linkableDepositProductKey":{"type":"string","title":"linkableDepositProductKey","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","title":"linkedAccountOptions","description":"A set of linked account options.","items":{"enum":["AUTO_LINK_ACCOUNTS","AUTO_CREATE_LINKED_ACCOUNTS"]},"uniqueItems":true},"settlementMethod":{"title":"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","title":"CreditArrangementSettingsaf30","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"creditArrangementRequirement":{"title":"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","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema47 = {"type":"object","title":"NewAccountSettingsaf30","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"title":"accountInitialState","description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"title":"idGeneratorType","description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","title":"idPattern","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","title":"OffsetSettingsaf30","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","title":"allowOffset","description":"Indicates whether the product supports offset"}},"additionalProperties":true};const schema56 = {"type":"object","title":"ProductRedrawSettingsaf30","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","title":"allowRedraw","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true};const schema64 = {"type":"object","title":"SecuritySettingsaf30","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","title":"isCollateralEnabled","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","title":"isGuarantorsEnabled","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","title":"requiredGuaranties","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 schema65 = {"type":"object","title":"TaxSettingsaf30","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"title":"taxCalculationMethod","description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","title":"taxesOnFeesEnabled","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","title":"taxesOnInterestEnabled","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","title":"taxesOnPenaltyEnabled","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","title":"taxSourceKey","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true};const schema66 = {"type":"object","title":"DocumentTemplateaf30","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","title":"name","description":"The name the document"},"type":{"title":"type","description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true};const schema13 = {"type":"object","title":"AccountingSettingsaf30","description":"Accounting settings, defines the accounting settings for the product.","properties":{"accountingMethod":{"title":"accountingMethod","description":"A list of accounting rules for a product.","enum":["NONE","CASH","ACCRUAL"]},"accountingRules":{"type":"array","title":"accountingRules","description":"A list of accounting rules for the product.","items":{"$ref":"#/$defs/GLAccountingRuleaf30"}},"interestAccrualCalculation":{"title":"interestAccrualCalculation","description":"The accounting interest calculation option selected for the product.","enum":["NONE","AGGREGATED_AMOUNT","BREAKDOWN_PER_ACCOUNT"]},"interestAccruedAccountingMethod":{"title":"interestAccruedAccountingMethod","description":"A list of accounting rules for a product.","enum":["NONE","DAILY","END_OF_MONTH"]}},"required":["accountingMethod"],"additionalProperties":true};const schema14 = {"type":"object","title":"GLAccountingRuleaf30","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","title":"encodedKey","description":"The encoded key of the accounting rule, auto generated, unique."},"financialResource":{"title":"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","title":"glAccountKey","description":"The encoded key of the account that is mapped to the financialResource"},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","description":"The key of the transaction rule that uses this rule"}},"required":["financialResource","glAccountKey"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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 schema38 = {"type":"object","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"additionalProperties":true};const schema34 = {"type":"object","title":"InterestProductSettingsaf30","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","title":"accrueInterestAfterMaturity","description":"If the product supports this option, specify if the interest should be accrued after the account maturity date"},"allowNegativeInterestRate":{"type":"boolean","title":"allowNegativeInterestRate","description":"Indicator whether the loan product allows negative values for interest rate or interest spread"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate tier, auto generated, unique"},"indexSourceKey":{"type":"string","title":"indexSourceKey","description":"Index rate source key."},"interestChargeFrequency":{"title":"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","title":"interestChargeFrequencyCount","description":"the count of units to apply over the interval"},"interestRate":{"title":"interestRate","$ref":"#/$defs/DecimalIntervalaf30"},"interestRateCeilingValue":{"type":"number","title":"interestRateCeilingValue","description":"Interest spread + index interest rate can't be more than this amount (valid only for index interest rate products)."},"interestRateFloorValue":{"type":"number","title":"interestRateFloorValue","description":"Interest spread + index interest rate can't be less than this amount (valid only for index interest rate products)."},"interestRateReviewCount":{"type":"integer","title":"interestRateReviewCount","description":"Interest rate review frequency unit count"},"interestRateReviewUnit":{"title":"interestRateReviewUnit","description":"Interest rate review frequency measurement unit","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"title":"interestRateSource","description":"Interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"title":"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","title":"interestRateTiers","description":"The list of interest rate tiers available for the current settings instance","items":{"$ref":"#/$defs/InterestRateTieraf30"}}},"additionalProperties":true};const schema36 = {"type":"object","title":"InterestRateTieraf30","description":"Used or TIERED interest rates, holds the values to define how the interest is computed","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","title":"endingBalance","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"interestRate":{"type":"number","title":"interestRate","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/DecimalIntervalaf30/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/DecimalIntervalaf30/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/DecimalIntervalaf30/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/DecimalIntervalaf30/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","title":"ProductAmortizationPeriodaf30","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","title":"defaultValue","description":"default value"},"maxValue":{"type":"integer","title":"maxValue","description":"max value"},"minValue":{"type":"integer","title":"minValue","description":"min value"}},"additionalProperties":true};const schema59 = {"type":"object","title":"BillingCyclesProductSettingsaf30","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","title":"enabled","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","title":"startDays","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema62 = {"type":"object","title":"PreviewScheduleSettingsaf30","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","title":"previewScheduleEnabled","description":"Preview Schedule status."}},"additionalProperties":true};const schema63 = {"type":"object","title":"RoundingSettingsaf30","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"title":"repaymentCurrencyRounding","description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"title":"repaymentElementsRoundingMethod","description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"title":"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};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/ProductAmortizationPeriodaf30/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/ProductAmortizationPeriodaf30/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/ProductAmortizationPeriodaf30/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/ProductAmortizationPeriodaf30/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/BillingCyclesProductSettingsaf30/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/BillingCyclesProductSettingsaf30/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/BillingCyclesProductSettingsaf30/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/BillingCyclesProductSettingsaf30/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/IntegerIntervalConstraintsaf30/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/IntegerIntervalConstraintsaf30/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/IntegerIntervalConstraintsaf30/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/IntegerIntervalConstraintsaf30/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/IntegerIntervalConstraintsaf30/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/AccountLinkSettingsaf30/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/AccountLinkSettingsaf30/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/AccountLinkSettingsaf30/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/AccountLinkSettingsaf30/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/CreditArrangementSettingsaf30/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/CreditArrangementSettingsaf30/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/Currencyaf30/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/Currencyaf30/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/Currencyaf30/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/NewAccountSettingsaf30/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/NewAccountSettingsaf30/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/NewAccountSettingsaf30/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/NewAccountSettingsaf30/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/NewAccountSettingsaf30/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/OffsetSettingsaf30/properties/allowOffset/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}else {validate11.errors = [{instancePath:instancePath+"/offsetSettings",schemaPath:"#/$defs/OffsetSettingsaf30/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/ProductRedrawSettingsaf30/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/ProductRedrawSettingsaf30/properties/allowRedraw/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}}else {validate11.errors = [{instancePath:instancePath+"/redrawSettings",schemaPath:"#/$defs/ProductRedrawSettingsaf30/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/SecuritySettingsaf30/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/SecuritySettingsaf30/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/SecuritySettingsaf30/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/SecuritySettingsaf30/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/TaxSettingsaf30/properties/taxCalculationMethod/enum",keyword:"enum",params:{allowedValues: schema65.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/TaxSettingsaf30/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/TaxSettingsaf30/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/TaxSettingsaf30/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/TaxSettingsaf30/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/TaxSettingsaf30/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":"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 = require("ajv/dist/runtime/equal").default;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){let data12 = data.creationDate;const _errs22 = errors;if(errors === _errs22){if(errors === _errs22){if(typeof data12 === "string"){if(!(formats0.validate(data12))){validate11.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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){let data25 = data.lastModifiedDate;const _errs45 = errors;if(errors === _errs45){if(errors === _errs45){if(typeof data25 === "string"){if(!(formats0.validate(data25))){validate11.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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},"InterestRateChangePMTAdjustmentThresholdaf30":{"type":"object","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"additionalProperties":true},"ProductInterestRateSettingsaf30":{"type":"object","title":"ProductInterestRateSettingsaf30","description":"Adjustable interest rates settings","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate settings, auto generated, unique"},"indexSourceKey":{"type":"string","title":"indexSourceKey","description":"Index rate source key."},"interestRate":{"title":"interestRate","$ref":"#/$defs/DecimalIntervalaf30"},"interestRateCeilingValue":{"type":"number","title":"interestRateCeilingValue","description":"Maximum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateFloorValue":{"type":"number","title":"interestRateFloorValue","description":"Minimum value allowed for index based interest rate. Valid only for index interest rate."},"interestRateReviewCount":{"type":"integer","title":"interestRateReviewCount","description":"Interest rate review frequency unit count. Valid only for index interest rate."},"interestRateReviewUnit":{"title":"interestRateReviewUnit","description":"Interest rate review frequency measurement unit. Valid only for index interest rate.","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"title":"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},"InternalControlsaf30":{"type":"object","title":"InternalControlsaf30","description":"Constraints and automated actions and that will be applied on the accounts.","properties":{"dormancyPeriodDays":{"type":"integer","title":"dormancyPeriodDays","description":"Specifies the number of days for an account to be fully paid in order to auto close it."},"fourEyesPrinciple":{"title":"fourEyesPrinciple","$ref":"#/$defs/FourEyesPrincipleaf30"},"lockSettings":{"title":"lockSettings","$ref":"#/$defs/LockSettingsaf30"}},"additionalProperties":true},"FourEyesPrincipleaf30":{"type":"object","title":"FourEyesPrincipleaf30","description":"Settings for Four Eyes Principle","properties":{"activeForLoanApproval":{"type":"boolean","title":"activeForLoanApproval","description":"Requires separate users to create and approve loan accounts"}},"additionalProperties":true},"LockSettingsaf30":{"type":"object","title":"LockSettingsaf30","description":"Settings applied when transitioning accounts to Locked state","properties":{"cappingConstraintType":{"title":"cappingConstraintType","description":"Specifies constraint types for capping charges.","enum":["SOFT_CAP","HARD_CAP"]},"cappingMethod":{"title":"cappingMethod","description":"Specifies how principal will be used when calculating capping charges.","enum":["OUTSTANDING_PRINCIPAL_PERCENTAGE","ORIGINAL_PRINCIPAL_PERCENTAGE"]},"cappingPercentage":{"type":"number","title":"cappingPercentage","description":"Specifies the percentage of principal that cannot be exceeded by the sum of interest, fees and penalty balances."},"lockPeriodDays":{"type":"integer","title":"lockPeriodDays","description":"Specifies the number of days for in which the account will be locked if it stays in arrears."}},"additionalProperties":true},"LoanAmountSettingsaf30":{"type":"object","title":"LoanAmountSettingsaf30","description":"The amount settings, holds all amount properties.","properties":{"loanAmount":{"title":"loanAmount","$ref":"#/$defs/AmountDecimalConstraintsaf30"},"trancheSettings":{"title":"trancheSettings","$ref":"#/$defs/TrancheSettingsaf30"}},"additionalProperties":true},"AmountDecimalConstraintsaf30":{"type":"object","title":"AmountDecimalConstraintsaf30","description":"Decimal constraints, like min/max/default.","properties":{"defaultValue":{"type":"number","title":"defaultValue","description":"The default value, will be used in case no other value was filled in by the user."},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the decimal constraint, auto generated, unique"},"maxValue":{"type":"number","title":"maxValue","description":"The maximum value."},"minValue":{"type":"number","title":"minValue","description":"The minimum value."}},"additionalProperties":true},"TrancheSettingsaf30":{"type":"object","title":"TrancheSettingsaf30","description":"The tranche settings, indicates the settings regarding tranches in case the product is configured to support tranches.","properties":{"maxNumberOfTranches":{"type":"integer","title":"maxNumberOfTranches","description":"The number of tranches supported by the loan product"}},"additionalProperties":true},"NewAccountSettingsaf30":{"type":"object","title":"NewAccountSettingsaf30","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"title":"accountInitialState","description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"title":"idGeneratorType","description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","title":"idPattern","description":"The pattern that will be used for ID validation (as referred to as an input mask)."}},"required":["accountInitialState","idGeneratorType","idPattern"],"additionalProperties":true},"OffsetSettingsaf30":{"type":"object","title":"OffsetSettingsaf30","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","title":"allowOffset","description":"Indicates whether the product supports offset"}},"additionalProperties":true},"PaymentSettingsaf30":{"type":"object","title":"PaymentSettingsaf30","description":"Defines the payment settings for the loan product and for loans crated based on this product.","properties":{"amortizationMethod":{"title":"amortizationMethod","description":"Payments Method used by loan accounts for repayments schedule generation.","enum":["STANDARD_PAYMENTS","BALLOON_PAYMENTS","OPTIMIZED_PAYMENTS","PAYMENT_PLAN"]},"latePaymentsRecalculationMethod":{"title":"latePaymentsRecalculationMethod","description":"Recalculate the schedule when late payments are posted on dynamic Equal Installments loans.","enum":["OVERDUE_INSTALLMENTS_INCREASE","LAST_INSTALLMENT_INCREASE"]},"paymentMethod":{"title":"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":{"title":"prepaymentSettings","$ref":"#/$defs/ProductPrepaymentSettingsaf30"},"principalPaymentSettings":{"title":"principalPaymentSettings","$ref":"#/$defs/PrincipalPaymentProductSettingsaf30"},"repaymentAllocationOrder":{"type":"array","title":"repaymentAllocationOrder","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},"ProductPrepaymentSettingsaf30":{"type":"object","title":"ProductPrepaymentSettingsaf30","description":"Defines the prepayment settings for the product","properties":{"applyInterestOnPrepaymentMethod":{"title":"applyInterestOnPrepaymentMethod","description":"Whether the interest on prepayment is applied manual or automatic.","enum":["AUTOMATIC","MANUAL"]},"elementsRecalculationMethod":{"title":"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","title":"ercFreeAllowance","description":"ERC free allowance in percentage"},"futurePaymentsAcceptance":{"title":"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":{"title":"prepaymentAcceptance","description":"Shows whether the pre-payments are allowed or not for this product.","enum":["ACCEPT_PREPAYMENTS","NO_PREPAYMENTS"]},"prepaymentRecalculationMethod":{"title":"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":{"title":"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},"PrincipalPaymentProductSettingsaf30":{"type":"object","title":"PrincipalPaymentProductSettingsaf30","description":"Defines the principal payment settings constraints for the loans that will be created based on this product.","properties":{"amount":{"title":"amount","$ref":"#/$defs/AmountDecimalConstraintsaf30"},"defaultPrincipalRepaymentInterval":{"type":"integer","title":"defaultPrincipalRepaymentInterval","description":"How many repayments the principal has to be paid"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the settings, auto generated, unique"},"includeFeesInFloorAmount":{"type":"boolean","title":"includeFeesInFloorAmount","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","title":"includeInterestInFloorAmount","description":"If true, the interest will be included along with the principal in the repayment floor amount, for a revolving credit account"},"percentage":{"title":"percentage","$ref":"#/$defs/DecimalConstraintsaf30"},"principalCeilingValue":{"type":"number","title":"principalCeilingValue","description":"The maximum principal due amount a repayment made with this settings can have"},"principalFloorValue":{"type":"number","title":"principalFloorValue","description":"The minimum principal due amount a repayment made with this settings can have"},"principalPaymentMethod":{"title":"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","title":"totalDueAmountFloor","description":"The minimum total due amount a repayment made with this settings can have"},"totalDuePayment":{"title":"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},"ProductPenaltySettingsaf30":{"type":"object","title":"ProductPenaltySettingsaf30","description":"Defines the penalty settings for the product that will be used by the loan accounts based on this product","properties":{"loanPenaltyCalculationMethod":{"title":"loanPenaltyCalculationMethod","description":"The penalty calculation method","enum":["NONE","OVERDUE_BALANCE","OVERDUE_BALANCE_AND_INTEREST","OUTSTANDING_PRINCIPAL"]},"loanPenaltyGracePeriod":{"type":"integer","title":"loanPenaltyGracePeriod","description":"Number of days to wait before applying the loan penalty amounts"},"penaltyRate":{"title":"penaltyRate","$ref":"#/$defs/DecimalConstraintsaf30"}},"required":["loanPenaltyCalculationMethod"],"additionalProperties":true},"ProductRedrawSettingsaf30":{"type":"object","title":"ProductRedrawSettingsaf30","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","title":"allowRedraw","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true},"LoanProductScheduleSettingsaf30":{"type":"object","title":"LoanProductScheduleSettingsaf30","description":"Defines the settings and constraints for schedule for the loans that are created based on this product.","properties":{"amortizationPeriod":{"title":"amortizationPeriod","$ref":"#/$defs/ProductAmortizationPeriodaf30"},"billingCycles":{"title":"billingCycles","$ref":"#/$defs/BillingCyclesProductSettingsaf30"},"defaultRepaymentPeriodCount":{"type":"integer","title":"defaultRepaymentPeriodCount","description":"Interval Repayment Methodology Settings."},"firstRepaymentDueDateOffset":{"title":"firstRepaymentDueDateOffset","$ref":"#/$defs/IntegerIntervalConstraintsaf30"},"fixedDaysOfMonth":{"type":"array","title":"fixedDaysOfMonth","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":{"title":"interestAccrualSince","description":"Represents the moment the interest will start getting accrued.","enum":["DISBURSEMENT","DUE_DATE"]},"numInstallments":{"title":"numInstallments","$ref":"#/$defs/IntegerIntervalConstraintsaf30"},"previewSchedule":{"title":"previewSchedule","$ref":"#/$defs/PreviewScheduleSettingsaf30"},"repaymentMethod":{"title":"repaymentMethod","description":"The repayment method value","enum":["AMOUNT","INSTALLMENTS"]},"repaymentPeriodUnit":{"title":"repaymentPeriodUnit","description":"The frequency of the loan repayment.","enum":["DAYS","WEEKS","MONTHS","YEARS"]},"repaymentReschedulingMethod":{"title":"repaymentReschedulingMethod","description":"The repayment rescheduling method used in calculations.","enum":["NONE","NEXT_WORKING_DAY","PREVIOUS_WORKING_DAY","EXTEND_SCHEDULE"]},"repaymentScheduleEditOptions":{"type":"array","title":"repaymentScheduleEditOptions","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":{"title":"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":{"title":"roundingSettings","$ref":"#/$defs/RoundingSettingsaf30"},"scheduleDueDatesMethod":{"title":"scheduleDueDatesMethod","description":"The methodology used by this product to compute the due dates of the repayments.","enum":["INTERVAL","FIXED_DAYS_OF_MONTH"]},"shortMonthHandlingMethod":{"title":"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},"ProductAmortizationPeriodaf30":{"type":"object","title":"ProductAmortizationPeriodaf30","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","title":"defaultValue","description":"default value"},"maxValue":{"type":"integer","title":"maxValue","description":"max value"},"minValue":{"type":"integer","title":"minValue","description":"min value"}},"additionalProperties":true},"BillingCyclesProductSettingsaf30":{"type":"object","title":"BillingCyclesProductSettingsaf30","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","title":"enabled","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","title":"startDays","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true},"PreviewScheduleSettingsaf30":{"type":"object","title":"PreviewScheduleSettingsaf30","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","title":"previewScheduleEnabled","description":"Preview Schedule status."}},"additionalProperties":true},"RoundingSettingsaf30":{"type":"object","title":"RoundingSettingsaf30","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"title":"repaymentCurrencyRounding","description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"title":"repaymentElementsRoundingMethod","description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"title":"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},"SecuritySettingsaf30":{"type":"object","title":"SecuritySettingsaf30","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","title":"isCollateralEnabled","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","title":"isGuarantorsEnabled","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","title":"requiredGuaranties","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},"TaxSettingsaf30":{"type":"object","title":"TaxSettingsaf30","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"title":"taxCalculationMethod","description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","title":"taxesOnFeesEnabled","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","title":"taxesOnInterestEnabled","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","title":"taxesOnPenaltyEnabled","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","title":"taxSourceKey","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true},"DocumentTemplateaf30":{"type":"object","title":"DocumentTemplateaf30","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","title":"name","description":"The name the document"},"type":{"title":"type","description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true}}};const schema14 = {"type":"object","title":"AccountLinkSettingsaf30","description":"Defines the settings for account linking.","properties":{"enabled":{"type":"boolean","title":"enabled","description":"Shows whether the loan accounts created using this product can be linked to a savings account."},"linkableDepositProductKey":{"type":"string","title":"linkableDepositProductKey","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","title":"linkedAccountOptions","description":"A set of linked account options.","items":{"enum":["AUTO_LINK_ACCOUNTS","AUTO_CREATE_LINKED_ACCOUNTS"]},"uniqueItems":true},"settlementMethod":{"title":"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","title":"CreditArrangementSettingsaf30","description":"The funding settings, holds the settings regarding the funding for the loan product.","properties":{"creditArrangementRequirement":{"title":"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","title":"Currencyaf30","description":"Represents a currency eg. USD, EUR.","properties":{"code":{"title":"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","ZMK","ZWL","ZMW","SSP","NON_FIAT"]},"currencyCode":{"type":"string","title":"currencyCode","description":"Currency code for NON_FIAT currency."}},"additionalProperties":true};const schema46 = {"type":"object","title":"NewAccountSettingsaf30","description":"The new account settings, defines the settings and constraints used by new loan account created based on this product.","properties":{"accountInitialState":{"title":"accountInitialState","description":"The initial state of the account when is created.","enum":["PARTIAL_APPLICATION","PENDING_APPROVAL","APPROVED","ACTIVE","ACTIVE_IN_ARREARS","CLOSED"]},"idGeneratorType":{"title":"idGeneratorType","description":"The type of generator used for IDs creation.","enum":["INCREMENTAL_NUMBER","RANDOM_PATTERN"]},"idPattern":{"type":"string","title":"idPattern","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","title":"OffsetSettingsaf30","description":"The offset settings, holds information about offset.","properties":{"allowOffset":{"type":"boolean","title":"allowOffset","description":"Indicates whether the product supports offset"}},"additionalProperties":true};const schema55 = {"type":"object","title":"ProductRedrawSettingsaf30","description":"The redraw settings for the product.","properties":{"allowRedraw":{"type":"boolean","title":"allowRedraw","description":"Indicates whether the product support redraw (prepayments which are stored at loan account level as a Redrawable balance)"}},"required":["allowRedraw"],"additionalProperties":true};const schema63 = {"type":"object","title":"SecuritySettingsaf30","description":"The settings and constraints for securities.","properties":{"isCollateralEnabled":{"type":"boolean","title":"isCollateralEnabled","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","title":"isGuarantorsEnabled","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","title":"requiredGuaranties","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 schema64 = {"type":"object","title":"TaxSettingsaf30","description":"Tax settings, defines some settings for taxes on the loan product","properties":{"taxCalculationMethod":{"title":"taxCalculationMethod","description":"Shows whether the tax is added on top of the target amount or not.","enum":["INCLUSIVE","EXCLUSIVE"]},"taxesOnFeesEnabled":{"type":"boolean","title":"taxesOnFeesEnabled","description":"Shows whether taxes on fees are enabled for this product or not."},"taxesOnInterestEnabled":{"type":"boolean","title":"taxesOnInterestEnabled","description":"Shows whether taxes on interest are enabled for this product or not."},"taxesOnPenaltyEnabled":{"type":"boolean","title":"taxesOnPenaltyEnabled","description":"Shows whether taxes on penalties are enabled for this product or not."},"taxSourceKey":{"type":"string","title":"taxSourceKey","description":"The tax source from where the loan account taxes will be updated."}},"additionalProperties":true};const schema65 = {"type":"object","title":"DocumentTemplateaf30","description":"Template documents of the product.","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The creation date of the document","format":"date-time"},"encodedKey":{"type":"string","title":"encodedKey","description":"The document encodedKey"},"lastModifiedDate":{"type":"string","title":"lastModifiedDate","description":"The last modified date of the document","format":"date-time"},"name":{"type":"string","title":"name","description":"The name the document"},"type":{"title":"type","description":"The type of the template","enum":["ACCOUNT","TRANSACTION","ACCOUNT_WITH_TRANSACTIONS"]}},"additionalProperties":true};const schema12 = {"type":"object","title":"AccountingSettingsaf30","description":"Accounting settings, defines the accounting settings for the product.","properties":{"accountingMethod":{"title":"accountingMethod","description":"A list of accounting rules for a product.","enum":["NONE","CASH","ACCRUAL"]},"accountingRules":{"type":"array","title":"accountingRules","description":"A list of accounting rules for the product.","items":{"$ref":"#/$defs/GLAccountingRuleaf30"}},"interestAccrualCalculation":{"title":"interestAccrualCalculation","description":"The accounting interest calculation option selected for the product.","enum":["NONE","AGGREGATED_AMOUNT","BREAKDOWN_PER_ACCOUNT"]},"interestAccruedAccountingMethod":{"title":"interestAccruedAccountingMethod","description":"A list of accounting rules for a product.","enum":["NONE","DAILY","END_OF_MONTH"]}},"required":["accountingMethod"],"additionalProperties":true};const schema13 = {"type":"object","title":"GLAccountingRuleaf30","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","title":"encodedKey","description":"The encoded key of the accounting rule, auto generated, unique."},"financialResource":{"title":"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","title":"glAccountKey","description":"The encoded key of the account that is mapped to the financialResource"},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","description":"The key of the transaction rule that uses this rule"}},"required":["financialResource","glAccountKey"],"additionalProperties":true};const func0 = require("ajv/dist/runtime/equal").default;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 schema37 = {"type":"object","title":"InterestRateChangePMTAdjustmentThresholdaf30","description":"Represents interest rate change threshold settings for loan accounts and loan products.","properties":{"method":{"title":"method","description":"The method used to calculate the interest rate change threshold. Supported value is CALENDAR_DAYS","enum":["WORKING_DAYS","CALENDAR_DAYS"]},"numberOfDays":{"type":"integer","title":"numberOfDays","description":"The number of days that trigger an interest rate change."}},"additionalProperties":true};const schema33 = {"type":"object","title":"InterestProductSettingsaf30","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","title":"accrueInterestAfterMaturity","description":"If the product supports this option, specify if the interest should be accrued after the account maturity date"},"allowNegativeInterestRate":{"type":"boolean","title":"allowNegativeInterestRate","description":"Indicator whether the loan product allows negative values for interest rate or interest spread"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate tier, auto generated, unique"},"indexSourceKey":{"type":"string","title":"indexSourceKey","description":"Index rate source key."},"interestChargeFrequency":{"title":"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","title":"interestChargeFrequencyCount","description":"the count of units to apply over the interval"},"interestRate":{"title":"interestRate","$ref":"#/$defs/DecimalIntervalaf30"},"interestRateCeilingValue":{"type":"number","title":"interestRateCeilingValue","description":"Interest spread + index interest rate can't be more than this amount (valid only for index interest rate products)."},"interestRateFloorValue":{"type":"number","title":"interestRateFloorValue","description":"Interest spread + index interest rate can't be less than this amount (valid only for index interest rate products)."},"interestRateReviewCount":{"type":"integer","title":"interestRateReviewCount","description":"Interest rate review frequency unit count"},"interestRateReviewUnit":{"title":"interestRateReviewUnit","description":"Interest rate review frequency measurement unit","enum":["DAYS","WEEKS","MONTHS"]},"interestRateSource":{"title":"interestRateSource","description":"Interest calculation method: fixed or (interest spread + active organization index interest rate)","enum":["FIXED_INTEREST_RATE","INDEX_INTEREST_RATE"]},"interestRateTerms":{"title":"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","title":"interestRateTiers","description":"The list of interest rate tiers available for the current settings instance","items":{"$ref":"#/$defs/InterestRateTieraf30"}}},"additionalProperties":true};const schema35 = {"type":"object","title":"InterestRateTieraf30","description":"Used or TIERED interest rates, holds the values to define how the interest is computed","properties":{"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the interest rate tier, auto generated, unique"},"endingBalance":{"type":"number","title":"endingBalance","description":"The top-limit value for the account balance in order to determine if this tier is used or not"},"interestRate":{"type":"number","title":"interestRate","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/DecimalIntervalaf30/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/DecimalIntervalaf30/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/DecimalIntervalaf30/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/DecimalIntervalaf30/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","title":"ProductAmortizationPeriodaf30","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","title":"defaultValue","description":"default value"},"maxValue":{"type":"integer","title":"maxValue","description":"max value"},"minValue":{"type":"integer","title":"minValue","description":"min value"}},"additionalProperties":true};const schema58 = {"type":"object","title":"BillingCyclesProductSettingsaf30","description":"Defines the billing cycles settings for revolving credit products","properties":{"enabled":{"type":"boolean","title":"enabled","description":"The billing cycle status if it is enabled or disabled"},"startDays":{"type":"array","title":"startDays","description":"The billing cycle start days in case it is enabled","items":{"type":"integer"},"uniqueItems":true}},"additionalProperties":true};const schema61 = {"type":"object","title":"PreviewScheduleSettingsaf30","description":"Defines the Preview Schedule settings for revolving products","properties":{"numberOfPreviewedInstalments":{"type":"integer","title":"numberOfPreviewedInstalments","description":"Number of Previewed Instalments."},"previewScheduleEnabled":{"type":"boolean","title":"previewScheduleEnabled","description":"Preview Schedule status."}},"additionalProperties":true};const schema62 = {"type":"object","title":"RoundingSettingsaf30","description":"Defines the rounding settings used in the loan computation.","properties":{"repaymentCurrencyRounding":{"title":"repaymentCurrencyRounding","description":"Specifies the repayment currency rounding method.","enum":["NO_ROUNDING","ROUND_TO_NEAREST_WHOLE_UNIT","ROUND_UP_TO_NEAREST_WHOLE_UNIT"]},"repaymentElementsRoundingMethod":{"title":"repaymentElementsRoundingMethod","description":"Determines how the repayment currency rounding is handled on each element from the schedule.","enum":["NO_ROUNDING","ROUND_ALL","PAYMENT_DUE"]},"roundingRepaymentScheduleMethod":{"title":"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};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/ProductAmortizationPeriodaf30/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/ProductAmortizationPeriodaf30/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/ProductAmortizationPeriodaf30/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/ProductAmortizationPeriodaf30/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/BillingCyclesProductSettingsaf30/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/BillingCyclesProductSettingsaf30/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/BillingCyclesProductSettingsaf30/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/BillingCyclesProductSettingsaf30/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/IntegerIntervalConstraintsaf30/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/IntegerIntervalConstraintsaf30/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/IntegerIntervalConstraintsaf30/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/IntegerIntervalConstraintsaf30/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/IntegerIntervalConstraintsaf30/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/AccountLinkSettingsaf30/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/AccountLinkSettingsaf30/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/AccountLinkSettingsaf30/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/AccountLinkSettingsaf30/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/CreditArrangementSettingsaf30/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/CreditArrangementSettingsaf30/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/Currencyaf30/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/Currencyaf30/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/Currencyaf30/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/NewAccountSettingsaf30/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/NewAccountSettingsaf30/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/NewAccountSettingsaf30/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/NewAccountSettingsaf30/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/NewAccountSettingsaf30/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/OffsetSettingsaf30/properties/allowOffset/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}else {validate10.errors = [{instancePath:instancePath+"/offsetSettings",schemaPath:"#/$defs/OffsetSettingsaf30/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/ProductRedrawSettingsaf30/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/ProductRedrawSettingsaf30/properties/allowRedraw/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}}else {validate10.errors = [{instancePath:instancePath+"/redrawSettings",schemaPath:"#/$defs/ProductRedrawSettingsaf30/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/SecuritySettingsaf30/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/SecuritySettingsaf30/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/SecuritySettingsaf30/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/SecuritySettingsaf30/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/TaxSettingsaf30/properties/taxCalculationMethod/enum",keyword:"enum",params:{allowedValues: schema64.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/TaxSettingsaf30/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/TaxSettingsaf30/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/TaxSettingsaf30/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/TaxSettingsaf30/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/TaxSettingsaf30/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 = require("ajv/dist/runtime/equal").default;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){let data12 = data.creationDate;const _errs22 = errors;if(errors === _errs22){if(errors === _errs22){if(typeof data12 === "string"){if(!(formats0.validate(data12))){validate10.errors = [{instancePath:instancePath+"/creationDate",schemaPath:"#/properties/creationDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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){let data25 = data.lastModifiedDate;const _errs45 = errors;if(errors === _errs45){if(errors === _errs45){if(typeof data25 === "string"){if(!(formats0.validate(data25))){validate10.errors = [{instancePath:instancePath+"/lastModifiedDate",schemaPath:"#/properties/lastModifiedDate/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}else {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 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/loanrisklevels.yaml`, { + this.buildClient(auth).get('configuration/loanrisklevels.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update loan risk levels configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/loanrisklevels.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/loanrisklevels.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +166,52 @@ export class MambuLoanRiskLevelsConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/loan-transactions/index.ts b/src/loan-transactions/index.ts index 06be3de..37c95e4 100644 --- a/src/loan-transactions/index.ts +++ b/src/loan-transactions/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuLoanTransactions } from './rest.client.js' export * as loanTransactions from './rest.type.js' diff --git a/src/loan-transactions/rest.client.ts b/src/loan-transactions/rest.client.ts index 4d1d96a..f39548a 100644 --- a/src/loan-transactions/rest.client.ts +++ b/src/loan-transactions/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { DisbursementLoanTransactionInput, ErrorResponse, @@ -63,7 +66,7 @@ export class MambuLoanTransactions { /** * Adjust loan transaction */ - public async adjust({ + public adjust({ body, path, headers, @@ -71,10 +74,28 @@ export class MambuLoanTransactions { }: { body: LoanTransactionAdjustmentDetails path: { loanTransactionId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanTransactionAdjustmentDetails, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanTransactionAdjustmentDetails, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/transactions/${path.loanTransactionId}:adjust`, { @@ -83,20 +104,20 @@ export class MambuLoanTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: LoanTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Apply a fee on a loan account */ - public async applyFee({ + public applyFee({ body, path, headers, @@ -104,10 +125,28 @@ export class MambuLoanTransactions { }: { body: FeeLoanTransactionInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(FeeLoanTransactionInput, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(FeeLoanTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/fee-transactions`, { @@ -116,20 +155,20 @@ export class MambuLoanTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: LoanTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Lock loan account income sources (interest, fees, penalties) */ - public async applyLock({ + public applyLock({ body, path, headers, @@ -137,10 +176,28 @@ export class MambuLoanTransactions { }: { body: LockLoanAccountInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(LockLoanAccountInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', LockLoanTransactionsWrapper> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LockLoanAccountInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/lock-transactions`, { @@ -149,20 +206,20 @@ export class MambuLoanTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: LockLoanTransactionsWrapper, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Make payment in redraw balance for loan account */ - public async applyPaymentMade({ + public applyPaymentMade({ body, path, headers, @@ -170,10 +227,28 @@ export class MambuLoanTransactions { }: { body: PaymentMadeTransactionInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(PaymentMadeTransactionInput, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PaymentMadeTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/payment-made-transactions`, { @@ -182,20 +257,20 @@ export class MambuLoanTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: LoanTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Unlock loan account income sources (interest, fees, penalties) */ - public async applyUnlock({ + public applyUnlock({ body, path, headers, @@ -203,10 +278,28 @@ export class MambuLoanTransactions { }: { body: UnlockLoanAccountInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(UnlockLoanAccountInput, body) + }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', LockLoanTransactionsWrapper> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(UnlockLoanAccountInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/unlock-transactions`, { @@ -215,20 +308,20 @@ export class MambuLoanTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: LockLoanTransactionsWrapper, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get loan transactions */ - public async getAll({ + public getAll({ path, query, auth = [['apiKey'], ['basic']], @@ -236,7 +329,20 @@ export class MambuLoanTransactions { path: { loanAccountId: string } query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/transactions`, { searchParams: query ?? {}, @@ -249,22 +355,31 @@ export class MambuLoanTransactions { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get loan transaction */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { loanTransactionId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { loanTransactionId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', LoanTransaction> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/transactions/${path.loanTransactionId}`, { searchParams: query ?? {}, @@ -277,14 +392,14 @@ export class MambuLoanTransactions { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get loan transactions for all loan account versions */ - public async getTransactionsForAllVersions({ + public getTransactionsForAllVersions({ path, query, auth = [['apiKey'], ['basic']], @@ -292,7 +407,20 @@ export class MambuLoanTransactions { path: { loanAccountId: string } query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { + }): Promise< + | SuccessResponse<'200', GetTransactionsForAllVersionsResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`loans/${path.loanAccountId}/transactions:versions`, { searchParams: query ?? {}, @@ -305,14 +433,14 @@ export class MambuLoanTransactions { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Make a disbursement on a loan */ - public async makeDisbursement({ + public makeDisbursement({ body, path, headers, @@ -320,10 +448,28 @@ export class MambuLoanTransactions { }: { body: DisbursementLoanTransactionInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(DisbursementLoanTransactionInput, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(DisbursementLoanTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/disbursement-transactions`, { @@ -332,20 +478,20 @@ export class MambuLoanTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: LoanTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Make a redraw repayment transaction on a loan */ - public async makeRedrawRepayment({ + public makeRedrawRepayment({ body, path, headers, @@ -353,10 +499,28 @@ export class MambuLoanTransactions { }: { body: RedrawRepaymentTransactionInputDTO path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(RedrawRepaymentTransactionInputDTO, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(RedrawRepaymentTransactionInputDTO, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/redraw-repayment-transactions`, { @@ -365,20 +529,20 @@ export class MambuLoanTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: LoanTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Make repayment transaction on loan account */ - public async makeRepayment({ + public makeRepayment({ body, path, headers, @@ -386,10 +550,28 @@ export class MambuLoanTransactions { }: { body: RepaymentLoanTransactionInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(RepaymentLoanTransactionInput, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(RepaymentLoanTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/repayment-transactions`, { @@ -398,20 +580,20 @@ export class MambuLoanTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: LoanTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Make withdrawal from redraw balance */ - public async makeWithdrawal({ + public makeWithdrawal({ body, path, headers, @@ -419,10 +601,28 @@ export class MambuLoanTransactions { }: { body: WithdrawalRedrawTransactionInput path: { loanAccountId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(WithdrawalRedrawTransactionInput, body) + }): 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'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(WithdrawalRedrawTransactionInput, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).post(`loans/${path.loanAccountId}/withdrawal-transactions`, { @@ -431,20 +631,20 @@ export class MambuLoanTransactions { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: LoanTransaction, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Search loan transactions */ - public async search({ + public search({ body, query, auth = [['apiKey'], ['basic']], @@ -452,11 +652,28 @@ export class MambuLoanTransactions { body: LoanTransactionSearchCriteria query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(LoanTransactionSearchCriteria, body) + }): Promise< + | SuccessResponse<'200', SearchResponse> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(LoanTransactionSearchCriteria, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`loans/transactions:search`, { + this.buildClient(auth).post('loans/transactions:search', { json: body, searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -468,45 +685,66 @@ export class MambuLoanTransactions { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -533,24 +771,52 @@ export class MambuLoanTransactions { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/loan-transactions/rest.type.ts b/src/loan-transactions/rest.type.ts index adb6da7..e8fd9cf 100644 --- a/src/loan-transactions/rest.type.ts +++ b/src/loan-transactions/rest.type.ts @@ -3,8 +3,25 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as DisbursementLoanTransactionInputValidator } from './schemas/disbursement-loan-transaction-input.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as FeeLoanTransactionInputValidator } from './schemas/fee-loan-transaction-input.schema.js' +import { validate as GetAllResponseValidator } from './schemas/get-all-response.schema.js' +import { validate as GetTransactionsForAllVersionsResponseValidator } from './schemas/get-transactions-for-all-versions-response.schema.js' +import { validate as LoanTransactionAdjustmentDetailsValidator } from './schemas/loan-transaction-adjustment-details.schema.js' +import { validate as LoanTransactionSearchCriteriaValidator } from './schemas/loan-transaction-search-criteria.schema.js' +import { validate as LoanTransactionValidator } from './schemas/loan-transaction.schema.js' +import { validate as LockLoanAccountInputValidator } from './schemas/lock-loan-account-input.schema.js' +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 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' +import { validate as WithdrawalRedrawTransactionInputValidator } from './schemas/withdrawal-redraw-transaction-input.schema.js' /** * Contains the details for the spread of the adjusted amount over the installments @@ -13,11 +30,11 @@ export interface AdjustTransactionInstallmentDetailsDTO { /** * The amount to be added on the fee/penalty due amounts (depending on transaction type), on the corresponding installment */ - amountToAdd?: number + amountToAdd?: number | undefined /** * The encoded key of the installment */ - installmentKey?: string + installmentKey?: string | undefined } /** @@ -27,31 +44,31 @@ export interface CardAcceptor { /** * The city in which the card acceptor has the business. */ - city?: string + city?: string | undefined /** * The country in which the card acceptor has the business. */ - country?: string + country?: string | undefined /** * The Merchant Category Code of the card acceptor. */ - mcc?: number + mcc?: number | undefined /** * The name of the card acceptor. */ - name?: string + name?: string | undefined /** * The state in which the card acceptor has the business. */ - state?: string + state?: string | undefined /** * The street in which the card acceptor has the business. */ - street?: string + street?: string | undefined /** * The ZIP code of the location in which the card acceptor has the business. */ - zip?: string + zip?: string | undefined } /** @@ -66,23 +83,23 @@ export interface CardTransaction { * The amount of money to be withdrawn in the financial transaction. */ amount: number - cardAcceptor?: CardAcceptor + cardAcceptor?: CardAcceptor | undefined /** * The reference token of the card. */ - cardToken?: string + cardToken?: string | undefined /** * 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. */ - currencyCode?: string + currencyCode?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The external authorization hold reference ID, which relates this card transaction to a previous authorization hold. */ - externalAuthorizationReferenceId?: string + externalAuthorizationReferenceId?: string | undefined /** * The external reference ID to be used to reference the card transaction in subsequent requests. */ @@ -90,7 +107,7 @@ export interface CardTransaction { /** * The formatted time at which the user made this card transaction. */ - userTransactionTime?: string + userTransactionTime?: string | undefined } /** @@ -284,15 +301,17 @@ export interface Currency { | 'XXX' | 'YER' | 'ZAR' + | 'ZIG' | 'ZMK' | 'ZWL' | 'ZMW' | 'SSP' | 'NON_FIAT' + | undefined /** * Currency code for NON_FIAT currency. */ - currencyCode?: string + currencyCode?: string | undefined } /** @@ -317,11 +336,11 @@ export interface CustomPaymentAmount { /** * The encodedKey of the predefined fee to be paid. */ - predefinedFeeKey?: string + predefinedFeeKey?: string | undefined /** * The amount of the taxes paid in the transaction for the given type. */ - taxOnAmount?: number + taxOnAmount?: number | undefined } /** @@ -331,46 +350,45 @@ export interface DisbursementLoanTransactionInput { /** * The amount to disburse */ - amount?: number + amount?: number | undefined /** * The date when disbursement is logged into accounting) */ - bookingDate?: string + bookingDate?: string | undefined /** * The external id of the disbursement transaction. Customizable and unique */ - externalId?: string + externalId?: string | undefined /** * The list of the fees to apply */ - fees?: FeeInput[] + fees?: FeeInput[] | undefined /** * The date of the first repayment for the loan account (as Organization Time) */ - firstRepaymentDate?: string + firstRepaymentDate?: string | undefined /** * Extra notes related to disbursement action or transaction */ - notes?: string + notes?: string | undefined /** * The currency for the disbursement transaction */ - originalCurrencyCode?: string + originalCurrencyCode?: string | undefined /** * Indicates whether the validFrom dates from Adjustable Interest Rates can be shifted automatically or not */ - shiftAdjustableInterestPeriods?: boolean - transactionDetails?: TransactionDetailsInput - transferDetails?: DisbursementTransferDetailsInput + shiftAdjustableInterestPeriods?: boolean | undefined + transactionDetails?: TransactionDetailsInput | undefined + transferDetails?: DisbursementTransferDetailsInput | undefined /** * The date of the disbursal (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } export const DisbursementLoanTransactionInput = { - validate: (await import('./schemas/disbursement-loan-transaction-input.schema.js')) - .validate as ValidateFunction, + validate: DisbursementLoanTransactionInputValidator as ValidateFunction, get schema() { return DisbursementLoanTransactionInput.validate.schema }, @@ -378,10 +396,11 @@ export const DisbursementLoanTransactionInput = { return DisbursementLoanTransactionInput.validate.errors ?? undefined }, is: (o: unknown): o is DisbursementLoanTransactionInput => DisbursementLoanTransactionInput.validate(o) === true, - assert: (o: unknown) => { - if (!DisbursementLoanTransactionInput.validate(o)) { - throw new ValidationError(DisbursementLoanTransactionInput.errors ?? []) + parse: (o: unknown): { right: DisbursementLoanTransactionInput } | { left: DefinedError[] } => { + if (DisbursementLoanTransactionInput.is(o)) { + return { right: o } } + return { left: (DisbursementLoanTransactionInput.errors ?? []) as DefinedError[] } }, } as const @@ -392,19 +411,19 @@ export interface DisbursementTransferDetailsInput { /** * The id of the linked deposit account */ - linkedAccountId?: string + linkedAccountId?: string | undefined /** * The encoded key of the linked deposit account */ - linkedAccountKey?: string + linkedAccountKey?: string | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -412,10 +431,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -426,11 +446,11 @@ export interface Fee { /** * The amount of the fee that was applied/paid in the transaction for the given predefined fee. */ - amount?: number + amount?: number | undefined /** * The name of the predefined fee */ - name?: string + name?: string | undefined /** * The encoded key of the predefined fee, auto generated, unique */ @@ -438,7 +458,7 @@ export interface Fee { /** * The amount of the taxes on fee that was applied/paid in the transaction. */ - taxAmount?: number + taxAmount?: number | undefined /** * Shows the event that will trigger a fee */ @@ -454,6 +474,7 @@ export interface Fee { | 'ARBITRARY' | 'IOF' | 'EARLY_REPAYMENT_CHARGE' + | undefined } /** @@ -463,11 +484,11 @@ export interface FeeInput { /** * The amount of the fee to apply */ - amount?: number + amount?: number | undefined /** * The percentage of the fee to apply */ - percentage?: number + percentage?: number | undefined /** * The encoded key of the predefined fee */ @@ -481,40 +502,39 @@ export interface FeeLoanTransactionInput { /** * The fee amount to be applied on the account */ - amount?: number + amount?: number | undefined /** * The date when the fee transaction is logged into accounting (as Organization Time) */ - bookingDate?: string + bookingDate?: string | undefined /** * The external id of the repayment transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * The date of the first repayment for the loan account (as Organization Time) */ - firstRepaymentDate?: string + firstRepaymentDate?: string | undefined /** * The installment number on which the fee will be applied */ - installmentNumber?: number + installmentNumber?: number | undefined /** * Extra notes about the current transaction */ - notes?: string + notes?: string | undefined /** * The encodedKey of the predefined fee that defines the current fee */ - predefinedFeeKey?: string + predefinedFeeKey?: string | undefined /** * The date when to apply the fee (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } export const FeeLoanTransactionInput = { - validate: (await import('./schemas/fee-loan-transaction-input.schema.js')) - .validate as ValidateFunction, + validate: FeeLoanTransactionInputValidator as ValidateFunction, get schema() { return FeeLoanTransactionInput.validate.schema }, @@ -522,17 +542,18 @@ export const FeeLoanTransactionInput = { return FeeLoanTransactionInput.validate.errors ?? undefined }, is: (o: unknown): o is FeeLoanTransactionInput => FeeLoanTransactionInput.validate(o) === true, - assert: (o: unknown) => { - if (!FeeLoanTransactionInput.validate(o)) { - throw new ValidationError(FeeLoanTransactionInput.errors ?? []) + parse: (o: unknown): { right: FeeLoanTransactionInput } | { left: DefinedError[] } => { + if (FeeLoanTransactionInput.is(o)) { + return { right: o } } + return { left: (FeeLoanTransactionInput.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = LoanTransaction[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -540,13 +561,18 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const export type GetTransactionsForAllVersionsResponse = LoanTransaction[] export const GetTransactionsForAllVersionsResponse = { - validate: (await import('./schemas/get-transactions-for-all-versions-response.schema.js')) - .validate as ValidateFunction, + validate: GetTransactionsForAllVersionsResponseValidator as ValidateFunction, get schema() { return GetTransactionsForAllVersionsResponse.validate.schema }, @@ -554,6 +580,12 @@ export const GetTransactionsForAllVersionsResponse = { return GetTransactionsForAllVersionsResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetTransactionsForAllVersionsResponse => GetTransactionsForAllVersionsResponse.validate(o) === true, + parse: (o: unknown): { right: GetTransactionsForAllVersionsResponse } | { left: DefinedError[] } => { + if (GetTransactionsForAllVersionsResponse.is(o)) { + return { right: o } + } + return { left: (GetTransactionsForAllVersionsResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -563,144 +595,144 @@ export interface LoanAffectedAmounts { /** * How much interest pre-paid was added/removed in account, within this transaction (including taxes). */ - deferredInterestAmount?: number + deferredInterestAmount?: number | undefined /** * How much fees was added/removed in account, within this transaction. */ - feesAmount?: number + feesAmount?: number | undefined /** * How much interest is given to the investors, within this transaction (only for p2p products) */ - fundersInterestAmount?: number + fundersInterestAmount?: number | undefined /** * 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. */ - interestAmount?: number + interestAmount?: number | undefined /** * How much interest from arrears was added/removed in account, within this transaction (including taxes). */ - interestFromArrearsAmount?: number + interestFromArrearsAmount?: number | undefined /** * How much interest is given to the organization, within this transaction (only for p2p products) */ - organizationCommissionAmount?: number + organizationCommissionAmount?: number | undefined /** * How much Payment Holidays interest was added/removed in account, within this transaction (including taxes). */ - paymentHolidaysInterestAmount?: number + paymentHolidaysInterestAmount?: number | undefined /** * How much penalties was added/removed in account, within this transaction. */ - penaltyAmount?: number + penaltyAmount?: number | undefined /** * How much principal was added/removed in account, within this transaction. */ - principalAmount?: number + principalAmount?: number | undefined } /** * The loan transaction terms */ export interface LoanTerms { - interestSettings?: TransactionInterestSettings + interestSettings?: TransactionInterestSettings | undefined /** * The periodic payment value logged when changing it for a Balloon Payments account */ - periodicPayment?: number + periodicPayment?: number | undefined /** * The principal payment flat amount logged when changing it for a Revolving Credit account */ - principalPaymentAmount?: number + principalPaymentAmount?: number | undefined /** * The principal payment percentage value logged when changing it for a Revolving Credit account */ - principalPaymentPercentage?: number + principalPaymentPercentage?: number | undefined } /** * Represents the action performed on a loan account after which the account's amount changes its value. */ export interface LoanTransaction { - accountBalances?: TransactionBalances + accountBalances?: TransactionBalances | undefined /** * The key of the loan transaction where the adjustment for the transaction was made (if any adjustment was involved). */ - adjustmentTransactionKey?: string - affectedAmounts?: LoanAffectedAmounts + adjustmentTransactionKey?: string | undefined + affectedAmounts?: LoanAffectedAmounts | undefined /** * The amount that was added or removed on the loan account. */ - amount?: number + amount?: number | undefined /** * The date when the corresponding journal entry is booked. */ - bookingDate?: string + bookingDate?: string | undefined /** * The branch where the transaction was performed. */ - branchKey?: string - cardTransaction?: CardTransaction + branchKey?: string | undefined + cardTransaction?: CardTransaction | undefined /** * The center where the transaction was performed. */ - centreKey?: string + centreKey?: string | undefined /** * The date when this loan transaction was created. */ - creationDate?: string - currency?: Currency + creationDate?: string | undefined + currency?: Currency | undefined /** * The list of custom amounts which the user has paid as part of this transaction. */ - customPaymentAmounts?: CustomPaymentAmount[] + customPaymentAmounts?: CustomPaymentAmount[] | undefined /** * The encoded key of the loan transaction, which is auto generated, and must be unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The external ID of the loan transaction, it is customizable, and must be unique. */ - externalId?: string + externalId?: string | undefined /** * The amounts that have been applied or paid as part of this transaction and involved predefined fees. */ - fees?: Fee[] + fees?: Fee[] | undefined /** * The ID of the loan transaction, can be generated and customized, and must be unique. */ - id?: string + id?: string | undefined /** * The specific installment encoded key associated to the loan transaction. */ - installmentEncodedKey?: string + installmentEncodedKey?: string | undefined /** * The migration event encoded key associated with the loan account. If the account was imported, track which 'migration event' it came from. */ - migrationEventKey?: string + migrationEventKey?: string | undefined /** * The notes or description for the loan transaction. */ - notes?: string + notes?: string | undefined /** * 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. */ - originalAmount?: number + originalAmount?: number | undefined /** * 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. */ - originalCurrencyCode?: string + originalCurrencyCode?: string | undefined /** * The encoded key of the transaction that was adjusted as part of this one. Available only for adjustment transactions. */ - originalTransactionKey?: string + originalTransactionKey?: string | undefined /** * The key of the parent loan account. */ - parentAccountKey?: string + parentAccountKey?: string | undefined /** * The key of the parent loan transaction. */ - parentLoanTransactionKey?: string + parentLoanTransactionKey?: string | undefined /** * The prepayment recalculation method of the loan transaction. */ @@ -713,14 +745,15 @@ export interface LoanTransaction { | 'REDUCE_AMOUNT_PER_INSTALLMENT' | 'REDUCE_NUMBER_OF_INSTALLMENTS' | 'REDUCE_NUMBER_OF_INSTALLMENTS_NEW' - taxes?: Taxes - terms?: LoanTerms + | undefined + taxes?: Taxes | undefined + terms?: LoanTerms | undefined /** * The till key associated with the transaction. */ - tillKey?: string - transactionDetails?: TransactionDetails - transferDetails?: TransferDetails + tillKey?: string | undefined + transactionDetails?: TransactionDetails | undefined + transferDetails?: TransferDetails | undefined /** * The type of loan transaction. */ @@ -776,18 +809,19 @@ export interface LoanTransaction { | 'DUE_DATE_CHANGED_ADJUSTMENT' | 'ACCOUNT_TERMINATED' | 'ACCOUNT_TERMINATED_ADJUSTMENT' + | undefined /** * The user that performed the transaction. */ - userKey?: string + userKey?: string | undefined /** * The date of the entry in the organization time format and timezone. */ - valueDate?: string + valueDate?: string | undefined } export const LoanTransaction = { - validate: (await import('./schemas/loan-transaction.schema.js')).validate as ValidateFunction, + validate: LoanTransactionValidator as ValidateFunction, get schema() { return LoanTransaction.validate.schema }, @@ -795,10 +829,11 @@ export const LoanTransaction = { return LoanTransaction.validate.errors ?? undefined }, is: (o: unknown): o is LoanTransaction => LoanTransaction.validate(o) === true, - assert: (o: unknown) => { - if (!LoanTransaction.validate(o)) { - throw new ValidationError(LoanTransaction.errors ?? []) + parse: (o: unknown): { right: LoanTransaction } | { left: DefinedError[] } => { + if (LoanTransaction.is(o)) { + return { right: o } } + return { left: (LoanTransaction.errors ?? []) as DefinedError[] } }, } as const @@ -809,11 +844,11 @@ export interface LoanTransactionAdjustmentDetails { /** * Date when the adjustment transaction is logged into accounting. Can be null. Available only for REPAYMENT, PAYMENT_MADE and FEE */ - bookingDate?: string + bookingDate?: string | undefined /** * Details of installments with their corresponding amounts to be added to the reduced fee/penalty */ - installments?: AdjustTransactionInstallmentDetailsDTO[] + installments?: AdjustTransactionInstallmentDetailsDTO[] | undefined /** * Notes detailing why the transaction is adjusted */ @@ -821,8 +856,7 @@ export interface LoanTransactionAdjustmentDetails { } export const LoanTransactionAdjustmentDetails = { - validate: (await import('./schemas/loan-transaction-adjustment-details.schema.js')) - .validate as ValidateFunction, + validate: LoanTransactionAdjustmentDetailsValidator as ValidateFunction, get schema() { return LoanTransactionAdjustmentDetails.validate.schema }, @@ -830,10 +864,11 @@ export const LoanTransactionAdjustmentDetails = { return LoanTransactionAdjustmentDetails.validate.errors ?? undefined }, is: (o: unknown): o is LoanTransactionAdjustmentDetails => LoanTransactionAdjustmentDetails.validate(o) === true, - assert: (o: unknown) => { - if (!LoanTransactionAdjustmentDetails.validate(o)) { - throw new ValidationError(LoanTransactionAdjustmentDetails.errors ?? []) + parse: (o: unknown): { right: LoanTransactionAdjustmentDetails } | { left: DefinedError[] } => { + if (LoanTransactionAdjustmentDetails.is(o)) { + return { right: o } } + return { left: (LoanTransactionAdjustmentDetails.errors ?? []) as DefinedError[] } }, } as const @@ -844,11 +879,11 @@ export interface LoanTransactionDetailsInput { /** * The id of the transaction channel associated with the transaction details input. */ - transactionChannelId?: string + transactionChannelId?: string | undefined /** * The encoded key of the transaction channel associated with the transaction details input. */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } /** @@ -951,15 +986,15 @@ export interface LoanTransactionFilterCriteria { /** * The second value to match the searching criteria, when the `BETWEEN` operator is used. */ - secondValue?: string + secondValue?: string | undefined /** * The value to match the searching criteria. */ - value?: string + value?: string | undefined /** * List of values when the `IN` operator is used. */ - values?: string[] + values?: string[] | undefined } /** @@ -969,13 +1004,12 @@ export interface LoanTransactionSearchCriteria { /** * The list of filtering criteria. */ - filterCriteria?: LoanTransactionFilterCriteria[] - sortingCriteria?: LoanTransactionSortingCriteria + filterCriteria?: LoanTransactionFilterCriteria[] | undefined + sortingCriteria?: LoanTransactionSortingCriteria | undefined } export const LoanTransactionSearchCriteria = { - validate: (await import('./schemas/loan-transaction-search-criteria.schema.js')) - .validate as ValidateFunction, + validate: LoanTransactionSearchCriteriaValidator as ValidateFunction, get schema() { return LoanTransactionSearchCriteria.validate.schema }, @@ -983,10 +1017,11 @@ export const LoanTransactionSearchCriteria = { return LoanTransactionSearchCriteria.validate.errors ?? undefined }, is: (o: unknown): o is LoanTransactionSearchCriteria => LoanTransactionSearchCriteria.validate(o) === true, - assert: (o: unknown) => { - if (!LoanTransactionSearchCriteria.validate(o)) { - throw new ValidationError(LoanTransactionSearchCriteria.errors ?? []) + parse: (o: unknown): { right: LoanTransactionSearchCriteria } | { left: DefinedError[] } => { + if (LoanTransactionSearchCriteria.is(o)) { + return { right: o } } + return { left: (LoanTransactionSearchCriteria.errors ?? []) as DefinedError[] } }, } as const @@ -1031,7 +1066,7 @@ export interface LoanTransactionSortingCriteria { /** * The sorting order: `ASC` or `DESC`. The default order is `DESC`. */ - order?: 'ASC' | 'DESC' + order?: 'ASC' | 'DESC' | undefined } /** @@ -1041,19 +1076,19 @@ export interface LockLoanAccountInput { /** * The locked account total due type. */ - lockedAccountTotalDueType?: 'BALANCE_AMOUNT' | 'DUE_AMOUNT_ON_LATE_INSTALLMENTS' + lockedAccountTotalDueType?: 'BALANCE_AMOUNT' | 'DUE_AMOUNT_ON_LATE_INSTALLMENTS' | undefined /** * A list with operations which are locked when the account is in substate AccountState.LOCKED. Allowed options are `APPLY_INTEREST`, `APPLY_PENALTIES`, and `APPLY_FEES`. */ - lockedOperations?: ('APPLY_INTEREST' | 'APPLY_FEES' | 'APPLY_PENALTIES')[] + lockedOperations?: ('APPLY_INTEREST' | 'APPLY_FEES' | 'APPLY_PENALTIES')[] | undefined /** * The notes about the account locking operation. */ - notes?: string + notes?: string | undefined } export const LockLoanAccountInput = { - validate: (await import('./schemas/lock-loan-account-input.schema.js')).validate as ValidateFunction, + validate: LockLoanAccountInputValidator as ValidateFunction, get schema() { return LockLoanAccountInput.validate.schema }, @@ -1061,10 +1096,11 @@ export const LockLoanAccountInput = { return LockLoanAccountInput.validate.errors ?? undefined }, is: (o: unknown): o is LockLoanAccountInput => LockLoanAccountInput.validate(o) === true, - assert: (o: unknown) => { - if (!LockLoanAccountInput.validate(o)) { - throw new ValidationError(LockLoanAccountInput.errors ?? []) + parse: (o: unknown): { right: LockLoanAccountInput } | { left: DefinedError[] } => { + if (LockLoanAccountInput.is(o)) { + return { right: o } } + return { left: (LockLoanAccountInput.errors ?? []) as DefinedError[] } }, } as const @@ -1075,12 +1111,11 @@ export interface LockLoanTransactionsWrapper { /** * The list of loan transactions */ - loanTransactions?: LoanTransaction[] + loanTransactions?: LoanTransaction[] | undefined } export const LockLoanTransactionsWrapper = { - validate: (await import('./schemas/lock-loan-transactions-wrapper.schema.js')) - .validate as ValidateFunction, + validate: LockLoanTransactionsWrapperValidator as ValidateFunction, get schema() { return LockLoanTransactionsWrapper.validate.schema }, @@ -1088,10 +1123,11 @@ export const LockLoanTransactionsWrapper = { return LockLoanTransactionsWrapper.validate.errors ?? undefined }, is: (o: unknown): o is LockLoanTransactionsWrapper => LockLoanTransactionsWrapper.validate(o) === true, - assert: (o: unknown) => { - if (!LockLoanTransactionsWrapper.validate(o)) { - throw new ValidationError(LockLoanTransactionsWrapper.errors ?? []) + parse: (o: unknown): { right: LockLoanTransactionsWrapper } | { left: DefinedError[] } => { + if (LockLoanTransactionsWrapper.is(o)) { + return { right: o } } + return { left: (LockLoanTransactionsWrapper.errors ?? []) as DefinedError[] } }, } as const @@ -1106,29 +1142,28 @@ export interface PaymentMadeTransactionInput { /** * The booking date of the payment made transaction (as Organization Time) */ - bookingDate?: string + bookingDate?: string | undefined /** * The external id of the payment made transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * Notes about the payment made transaction. The notes can have at most 255 characters in length. */ - notes?: string + notes?: string | undefined /** * The currency code for the payment made transaction */ - originalCurrencyCode?: string - transactionDetails?: LoanTransactionDetailsInput + originalCurrencyCode?: string | undefined + transactionDetails?: LoanTransactionDetailsInput | undefined /** * The entry date of the payment made transaction (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } export const PaymentMadeTransactionInput = { - validate: (await import('./schemas/payment-made-transaction-input.schema.js')) - .validate as ValidateFunction, + validate: PaymentMadeTransactionInputValidator as ValidateFunction, get schema() { return PaymentMadeTransactionInput.validate.schema }, @@ -1136,10 +1171,11 @@ export const PaymentMadeTransactionInput = { return PaymentMadeTransactionInput.validate.errors ?? undefined }, is: (o: unknown): o is PaymentMadeTransactionInput => PaymentMadeTransactionInput.validate(o) === true, - assert: (o: unknown) => { - if (!PaymentMadeTransactionInput.validate(o)) { - throw new ValidationError(PaymentMadeTransactionInput.errors ?? []) + parse: (o: unknown): { right: PaymentMadeTransactionInput } | { left: DefinedError[] } => { + if (PaymentMadeTransactionInput.is(o)) { + return { right: o } } + return { left: (PaymentMadeTransactionInput.errors ?? []) as DefinedError[] } }, } as const @@ -1150,24 +1186,23 @@ export interface RedrawRepaymentTransactionInputDTO { /** * The amount of the redraw repayment */ - amount?: number + amount?: number | undefined /** * The booking date of the repayment (as Organization Time) */ - bookingDate?: string + bookingDate?: string | undefined /** * Extra notes about the redraw repayment transaction. Notes can have at most 255 characters in length. */ - notes?: string + notes?: string | undefined /** * The entry date of the repayment (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } export const RedrawRepaymentTransactionInputDTO = { - validate: (await import('./schemas/redraw-repayment-transaction-input-dto.schema.js')) - .validate as ValidateFunction, + validate: RedrawRepaymentTransactionInputDTOValidator as ValidateFunction, get schema() { return RedrawRepaymentTransactionInputDTO.validate.schema }, @@ -1175,10 +1210,11 @@ export const RedrawRepaymentTransactionInputDTO = { return RedrawRepaymentTransactionInputDTO.validate.errors ?? undefined }, is: (o: unknown): o is RedrawRepaymentTransactionInputDTO => RedrawRepaymentTransactionInputDTO.validate(o) === true, - assert: (o: unknown) => { - if (!RedrawRepaymentTransactionInputDTO.validate(o)) { - throw new ValidationError(RedrawRepaymentTransactionInputDTO.errors ?? []) + parse: (o: unknown): { right: RedrawRepaymentTransactionInputDTO } | { left: DefinedError[] } => { + if (RedrawRepaymentTransactionInputDTO.is(o)) { + return { right: o } } + return { left: (RedrawRepaymentTransactionInputDTO.errors ?? []) as DefinedError[] } }, } as const @@ -1193,27 +1229,27 @@ export interface RepaymentLoanTransactionInput { /** * The booking date of the repayment (as Organization Time) */ - bookingDate?: string + bookingDate?: string | undefined /** * The list of custom amounts of the repayment */ - customPaymentAmounts?: CustomPaymentAmount[] + customPaymentAmounts?: CustomPaymentAmount[] | undefined /** * The external id of the repayment transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * The encoded key of the schedule installment to which this repayment is associated */ - installmentEncodedKey?: string + installmentEncodedKey?: string | undefined /** * Extra notes about the repayment transaction. Notes can have at most 255 characters in length. */ - notes?: string + notes?: string | undefined /** * The currency code for the repayment transaction */ - originalCurrencyCode?: string + originalCurrencyCode?: string | undefined /** * The prepayment recalculation method of the repayment */ @@ -1226,16 +1262,16 @@ export interface RepaymentLoanTransactionInput { | 'REDUCE_AMOUNT_PER_INSTALLMENT' | 'REDUCE_NUMBER_OF_INSTALLMENTS' | 'REDUCE_NUMBER_OF_INSTALLMENTS_NEW' - transactionDetails?: LoanTransactionDetailsInput + | undefined + transactionDetails?: LoanTransactionDetailsInput | undefined /** * The entry date of the repayment (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } export const RepaymentLoanTransactionInput = { - validate: (await import('./schemas/repayment-loan-transaction-input.schema.js')) - .validate as ValidateFunction, + validate: RepaymentLoanTransactionInputValidator as ValidateFunction, get schema() { return RepaymentLoanTransactionInput.validate.schema }, @@ -1243,23 +1279,24 @@ export const RepaymentLoanTransactionInput = { return RepaymentLoanTransactionInput.validate.errors ?? undefined }, is: (o: unknown): o is RepaymentLoanTransactionInput => RepaymentLoanTransactionInput.validate(o) === true, - assert: (o: unknown) => { - if (!RepaymentLoanTransactionInput.validate(o)) { - throw new ValidationError(RepaymentLoanTransactionInput.errors ?? []) + parse: (o: unknown): { right: RepaymentLoanTransactionInput } | { left: DefinedError[] } => { + if (RepaymentLoanTransactionInput.is(o)) { + return { right: o } } + return { left: (RepaymentLoanTransactionInput.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } export type SearchResponse = LoanTransaction[] export const SearchResponse = { - validate: (await import('./schemas/search-response.schema.js')).validate as ValidateFunction, + validate: SearchResponseValidator as ValidateFunction, get schema() { return SearchResponse.validate.schema }, @@ -1267,6 +1304,12 @@ export const SearchResponse = { return SearchResponse.validate.errors ?? undefined }, is: (o: unknown): o is SearchResponse => SearchResponse.validate(o) === true, + parse: (o: unknown): { right: SearchResponse } | { left: DefinedError[] } => { + if (SearchResponse.is(o)) { + return { right: o } + } + return { left: (SearchResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -1276,31 +1319,31 @@ export interface Taxes { /** * 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. */ - deferredTaxOnInterestAmount?: number + deferredTaxOnInterestAmount?: number | undefined /** * How much taxes on the fees that were paid in this transaction were added/removed in account, within this transaction. */ - taxOnFeesAmount?: number + taxOnFeesAmount?: number | undefined /** * How much taxes on the interest that was paid in this transaction were added/removed in account, within this transaction. */ - taxOnInterestAmount?: number + taxOnInterestAmount?: number | undefined /** * The amount of taxes on the interest from arrears that were applied/paid in account, within this transaction. */ - taxOnInterestFromArrearsAmount?: number + taxOnInterestFromArrearsAmount?: number | undefined /** * The amount of taxes on the Payment Holidays interest that were added/removed in account, within this transaction. */ - taxOnPaymentHolidaysInterest?: number + taxOnPaymentHolidaysInterest?: number | undefined /** * How much taxes on the penalties that were paid in this transaction were added/removed in account, within this transaction. */ - taxOnPenaltyAmount?: number + taxOnPenaltyAmount?: number | undefined /** * The tax rate that was set or changed in this transaction. */ - taxRate?: number + taxRate?: number | undefined } /** @@ -1310,27 +1353,27 @@ export interface TransactionBalances { /** * Captures the advance (prepaid) amount. */ - advancePosition?: number + advancePosition?: number | undefined /** * Captures the arrears position amount for the account in arrears. */ - arrearsPosition?: number + arrearsPosition?: number | undefined /** * The difference between principal balance and redraw balance after each transaction performed on the loan account. */ - expectedPrincipalRedraw?: number + expectedPrincipalRedraw?: number | undefined /** * The account redraw balance captured after the transaction update. */ - principalBalance?: number + principalBalance?: number | undefined /** * The account redraw balance captured after the transaction update. */ - redrawBalance?: number + redrawBalance?: number | undefined /** * The running balance still owed for the loan. */ - totalBalance?: number + totalBalance?: number | undefined } /** @@ -1340,11 +1383,11 @@ export interface TransactionDetails { /** * The id of the transaction channel associated with the transaction details. */ - transactionChannelId?: string + transactionChannelId?: string | undefined /** * The encoded key of the transaction channel associated with the transaction details. */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } /** @@ -1354,11 +1397,11 @@ export interface TransactionDetailsInput { /** * The id of the transaction channel associated with the transaction details. */ - transactionChannelId?: string + transactionChannelId?: string | undefined /** * The encoded key of the transaction channel associated with the transaction details. */ - transactionChannelKey?: string + transactionChannelKey?: string | undefined } /** @@ -1368,11 +1411,11 @@ export interface TransactionInterestSettings { /** * The value of the index interest rate */ - indexInterestRate?: number + indexInterestRate?: number | undefined /** * 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. */ - interestRate?: number + interestRate?: number | undefined } /** @@ -1382,11 +1425,11 @@ export interface TransferDetails { /** * The key of the related deposit transaction */ - linkedDepositTransactionKey?: string + linkedDepositTransactionKey?: string | undefined /** * The key of the related loan transaction */ - linkedLoanTransactionKey?: string + linkedLoanTransactionKey?: string | undefined } /** @@ -1396,12 +1439,11 @@ export interface UnlockLoanAccountInput { /** * Extra notes about the current unlocking of account */ - notes?: string + notes?: string | undefined } export const UnlockLoanAccountInput = { - validate: (await import('./schemas/unlock-loan-account-input.schema.js')) - .validate as ValidateFunction, + validate: UnlockLoanAccountInputValidator as ValidateFunction, get schema() { return UnlockLoanAccountInput.validate.schema }, @@ -1409,10 +1451,11 @@ export const UnlockLoanAccountInput = { return UnlockLoanAccountInput.validate.errors ?? undefined }, is: (o: unknown): o is UnlockLoanAccountInput => UnlockLoanAccountInput.validate(o) === true, - assert: (o: unknown) => { - if (!UnlockLoanAccountInput.validate(o)) { - throw new ValidationError(UnlockLoanAccountInput.errors ?? []) + parse: (o: unknown): { right: UnlockLoanAccountInput } | { left: DefinedError[] } => { + if (UnlockLoanAccountInput.is(o)) { + return { right: o } } + return { left: (UnlockLoanAccountInput.errors ?? []) as DefinedError[] } }, } as const @@ -1427,29 +1470,28 @@ export interface WithdrawalRedrawTransactionInput { /** * The booking date of the withdrawal transaction (as Organization Time) */ - bookingDate?: string + bookingDate?: string | undefined /** * The external id of the withdrawal transaction, customizable, unique */ - externalId?: string + externalId?: string | undefined /** * Extra notes about the withdrawal transaction. Notes can have at most 255 characters in length. */ - notes?: string + notes?: string | undefined /** * The currency code for the transaction */ - originalCurrencyCode?: string - transactionDetails?: LoanTransactionDetailsInput + originalCurrencyCode?: string | undefined + transactionDetails?: LoanTransactionDetailsInput | undefined /** * The value date of the withdrawal transaction (as Organization Time) */ - valueDate?: string + valueDate?: string | undefined } export const WithdrawalRedrawTransactionInput = { - validate: (await import('./schemas/withdrawal-redraw-transaction-input.schema.js')) - .validate as ValidateFunction, + validate: WithdrawalRedrawTransactionInputValidator as ValidateFunction, get schema() { return WithdrawalRedrawTransactionInput.validate.schema }, @@ -1457,9 +1499,10 @@ export const WithdrawalRedrawTransactionInput = { return WithdrawalRedrawTransactionInput.validate.errors ?? undefined }, is: (o: unknown): o is WithdrawalRedrawTransactionInput => WithdrawalRedrawTransactionInput.validate(o) === true, - assert: (o: unknown) => { - if (!WithdrawalRedrawTransactionInput.validate(o)) { - throw new ValidationError(WithdrawalRedrawTransactionInput.errors ?? []) + parse: (o: unknown): { right: WithdrawalRedrawTransactionInput } | { left: DefinedError[] } => { + if (WithdrawalRedrawTransactionInput.is(o)) { + return { right: o } } + return { left: (WithdrawalRedrawTransactionInput.errors ?? []) as DefinedError[] } }, } as const diff --git a/src/loan-transactions/schemas/disbursement-loan-transaction-input.schema.js b/src/loan-transactions/schemas/disbursement-loan-transaction-input.schema.js index 7d80f00..f4396c4 100644 --- a/src/loan-transactions/schemas/disbursement-loan-transaction-input.schema.js +++ b/src/loan-transactions/schemas/disbursement-loan-transaction-input.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DisbursementLoanTransactionInput","type":"object","description":"The input representation of a loan transaction when making a disbursement","properties":{"amount":{"type":"number","title":"amount","description":"The amount to disburse"},"bookingDate":{"type":"string","title":"bookingDate","description":"The date when disbursement is logged into accounting)","format":"date-time"},"externalId":{"type":"string","title":"externalId","description":"The external id of the disbursement transaction. Customizable and unique"},"fees":{"type":"array","title":"fees","description":"The list of the fees to apply","items":{"$ref":"#/$defs/FeeInputaf30"}},"firstRepaymentDate":{"type":"string","title":"firstRepaymentDate","description":"The date of the first repayment for the loan account (as Organization Time)","format":"date-time"},"notes":{"type":"string","title":"notes","description":"Extra notes related to disbursement action or transaction"},"originalCurrencyCode":{"type":"string","title":"originalCurrencyCode","description":"The currency for the disbursement transaction"},"shiftAdjustableInterestPeriods":{"type":"boolean","title":"shiftAdjustableInterestPeriods","description":"Indicates whether the validFrom dates from Adjustable Interest Rates can be shifted automatically or not"},"transactionDetails":{"title":"transactionDetails","$ref":"#/$defs/TransactionDetailsInputaf30"},"transferDetails":{"title":"transferDetails","$ref":"#/$defs/DisbursementTransferDetailsInputaf30"},"valueDate":{"type":"string","title":"valueDate","description":"The date of the disbursal (as Organization Time)","format":"date-time"}},"additionalProperties":true,"$defs":{"FeeInputaf30":{"type":"object","title":"FeeInputaf30","description":"An amount of predefined fee to apply on account.","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the fee to apply"},"percentage":{"type":"number","title":"percentage","description":"The percentage of the fee to apply"},"predefinedFeeKey":{"type":"string","title":"predefinedFeeKey","description":"The encoded key of the predefined fee"}},"required":["predefinedFeeKey"],"additionalProperties":true},"TransactionDetailsInputaf30":{"type":"object","title":"TransactionDetailsInputaf30","description":"Contains the details about transaction including fields like transaction channel key and channel ID","properties":{"transactionChannelId":{"type":"string","title":"transactionChannelId","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true},"DisbursementTransferDetailsInputaf30":{"type":"object","title":"DisbursementTransferDetailsInputaf30","description":"Represents the input for the transfer details for a disbursement transaction","properties":{"linkedAccountId":{"type":"string","title":"linkedAccountId","description":"The id of the linked deposit account"},"linkedAccountKey":{"type":"string","title":"linkedAccountKey","description":"The encoded key of the linked deposit account"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"FeeInputaf30","description":"An amount of predefined fee to apply on account.","properties":{"amount":{"type":"number","title":"amount","description":"The amount of the fee to apply"},"percentage":{"type":"number","title":"percentage","description":"The percentage of the fee to apply"},"predefinedFeeKey":{"type":"string","title":"predefinedFeeKey","description":"The encoded key of the predefined fee"}},"required":["predefinedFeeKey"],"additionalProperties":true};const schema13 = {"type":"object","title":"TransactionDetailsInputaf30","description":"Contains the details about transaction including fields like transaction channel key and channel ID","properties":{"transactionChannelId":{"type":"string","title":"transactionChannelId","description":"The id of the transaction channel associated with the transaction details."},"transactionChannelKey":{"type":"string","title":"transactionChannelKey","description":"The encoded key of the transaction channel associated with the transaction details."}},"additionalProperties":true};const schema14 = {"type":"object","title":"DisbursementTransferDetailsInputaf30","description":"Represents the input for the transfer details for a disbursement transaction","properties":{"linkedAccountId":{"type":"string","title":"linkedAccountId","description":"The id of the linked deposit account"},"linkedAccountKey":{"type":"string","title":"linkedAccountKey","description":"The encoded key of the linked deposit account"}},"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.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 Promise<[username: string, password: string]>) - apiKey?: string | (() => Promise) - } - - public availableAuth: Set - public defaultAuth: string[][] | string[] | undefined - - public constructor({ - prefixUrl, - options, - auth = {}, - defaultAuth, - }: { - prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit - auth: { - basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) - apiKey?: string | (() => Promise) - } - defaultAuth?: string[][] | string[] - }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) - this.auth = auth - this.availableAuth = new Set(Object.keys(auth)) - this.defaultAuth = defaultAuth - } - - /** - * Create a new Mambu Function Secret - */ - public async create({ - body, - headers, - auth = [['apiKey'], ['basic']], - }: { - body: MambuFunctionSecretCreate - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(MambuFunctionSecretCreate, body) - - return this.awaitResponse( - this.buildClient(auth).post(`mambu-functions-secrets`, { - json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - }), - { - 201: { is: (_x: unknown): _x is unknown => true }, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - } - ) - } - - /** - * Delete an existing Mambu Function Secret - */ - public async delete({ path, auth = [['apiKey'], ['basic']] }: { path: { name: string }; auth?: string[][] | string[] }) { - return this.awaitResponse( - this.buildClient(auth).delete(`mambu-functions-secrets/${path.name}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', - }), - { - 204: { is: (_x: unknown): _x is unknown => true }, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - } - ) - } - - /** - * List Mambu Function Secret - */ - public async listSecrets({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { - return this.awaitResponse( - this.buildClient(auth).get(`mambu-functions-secrets`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', - }), - { - 200: { is: (_x: unknown): _x is unknown => true }, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - } - ) - } - - /** - * Update an existing Mambu Function Secret - */ - public async update({ - body, - path, - headers, - auth = [['apiKey'], ['basic']], - }: { - body: MambuFunctionSecretUpdate - path: { name: string } - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(MambuFunctionSecretUpdate, body) - - return this.awaitResponse( - this.buildClient(auth).put(`mambu-functions-secrets/${path.name}`, { - json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - }), - { - 200: { is: (_x: unknown): _x is unknown => true }, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - } - ) - } - - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body - } - - public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never - const result = await response - const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { - return { - statusCode: result.statusCode, - headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] - } - } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> - } - } - - protected buildBasicClient(client: Got) { - return client.extend({ - hooks: { - beforeRequest: [ - async (options) => { - const basic = this.auth.basic - if (basic !== undefined) { - const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password - } - }, - ], - }, - }) - } - - protected buildApiKeyClient(client: Got) { - return client.extend({ - hooks: { - beforeRequest: [ - async (options) => { - const apiKey = this.auth.apiKey - const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key - }, - ], - }, - }) - } - - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { - const auth = (auths ?? [...this.availableAuth]) - .map((auth) => (Array.isArray(auth) ? auth : [auth])) - .filter((auth) => auth.every((a) => this.availableAuth.has(a))) - for (const chosen of auth[0] ?? []) { - if (chosen === 'basic') { - client = this.buildBasicClient(client) - } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) - } - } - return client - } -} diff --git a/src/mambu-function-secrets/rest.type.ts b/src/mambu-function-secrets/rest.type.ts deleted file mode 100644 index de823d7..0000000 --- a/src/mambu-function-secrets/rest.type.ts +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Generated by @skyleague/therefore@v1.0.0-local - * Do not manually touch this - */ -/* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' - -export interface ErrorResponse { - errors?: RestError[] -} - -export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, - get schema() { - return ErrorResponse.validate.schema - }, - get errors() { - return ErrorResponse.validate.errors ?? undefined - }, - is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) - } - }, -} as const - -/** - * Mambu Function Tenant Secret create data. - */ -export interface MambuFunctionSecretCreate { - /** - * Customer secret name - */ - name?: string - /** - * The value of the customer secret - */ - value?: string -} - -export const MambuFunctionSecretCreate = { - validate: (await import('./schemas/mambu-function-secret-create.schema.js')) - .validate as ValidateFunction, - get schema() { - return MambuFunctionSecretCreate.validate.schema - }, - get errors() { - return MambuFunctionSecretCreate.validate.errors ?? undefined - }, - is: (o: unknown): o is MambuFunctionSecretCreate => MambuFunctionSecretCreate.validate(o) === true, - assert: (o: unknown) => { - if (!MambuFunctionSecretCreate.validate(o)) { - throw new ValidationError(MambuFunctionSecretCreate.errors ?? []) - } - }, -} as const - -/** - * Mambu Function Tenant Secret update data. - */ -export interface MambuFunctionSecretUpdate { - /** - * The value of the customer secret - */ - value?: string -} - -export const MambuFunctionSecretUpdate = { - validate: (await import('./schemas/mambu-function-secret-update.schema.js')) - .validate as ValidateFunction, - get schema() { - return MambuFunctionSecretUpdate.validate.schema - }, - get errors() { - return MambuFunctionSecretUpdate.validate.errors ?? undefined - }, - is: (o: unknown): o is MambuFunctionSecretUpdate => MambuFunctionSecretUpdate.validate(o) === true, - assert: (o: unknown) => { - if (!MambuFunctionSecretUpdate.validate(o)) { - throw new ValidationError(MambuFunctionSecretUpdate.errors ?? []) - } - }, -} as const - -export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string -} diff --git a/src/mambu-function-secrets/schemas/error-response.schema.js b/src/mambu-function-secrets/schemas/error-response.schema.js deleted file mode 100644 index 328238a..0000000 --- a/src/mambu-function-secrets/schemas/error-response.schema.js +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable - */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 Promise<[username: string, password: string]>) - apiKey?: string | (() => Promise) - } - - public availableAuth: Set - public defaultAuth: string[][] | string[] | undefined - - public constructor({ - prefixUrl, - options, - auth = {}, - defaultAuth, - }: { - prefixUrl: string | 'http://localhost:8889/api' | 'https://localhost:8889/api' - options?: Options | OptionsInit - auth: { - basic?: [username: string, password: string] | (() => Promise<[username: string, password: string]>) - apiKey?: string | (() => Promise) - } - defaultAuth?: string[][] | string[] - }) { - this.client = got.extend(...[{ prefixUrl, throwHttpErrors: false }, options].filter((o): o is Options => o !== undefined)) - this.auth = auth - this.availableAuth = new Set(Object.keys(auth)) - this.defaultAuth = defaultAuth - } - - /** - * Create a new Mambu Function Subscription - */ - public async create({ - body, - path, - headers, - auth = [['apiKey'], ['basic']], - }: { - body: MambuFunctionSubscriptionCreate - path: { functionName: string } - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(MambuFunctionSubscriptionCreate, body) - - return this.awaitResponse( - this.buildClient(auth).post(`mambu-functions/${path.functionName}/subscriptions`, { - json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - }), - { - 201: MambuFunctionSubscription, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - } - ) - } - - /** - * Create a new Mambu Function - */ - public async create1({ - body, - headers, - auth = [['apiKey'], ['basic']], - }: { - body: MambuFunctionCreate - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(MambuFunctionCreate, body) - - return this.awaitResponse( - this.buildClient(auth).post(`mambu-functions`, { - json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - }), - { - 201: MambuFunction, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - } - ) - } - - /** - * Delete an existing Mambu Function Subscription - */ - public async delete({ - path, - auth = [['apiKey'], ['basic']], - }: { - path: { functionName: string; subscriptionName: string } - auth?: string[][] | string[] - }) { - return this.awaitResponse( - this.buildClient(auth).delete(`mambu-functions/${path.functionName}/subscriptions/${path.subscriptionName}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', - }), - { - 204: { is: (_x: unknown): _x is unknown => true }, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - } - ) - } - - /** - * Delete an existing Mambu Function - */ - public async delete1({ - path, - auth = [['apiKey'], ['basic']], - }: { - path: { functionName: string } - auth?: string[][] | string[] - }) { - return this.awaitResponse( - this.buildClient(auth).delete(`mambu-functions/${path.functionName}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', - }), - { - 204: { is: (_x: unknown): _x is unknown => true }, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - } - ) - } - - /** - * Disable an existing Mambu Function Subscription - */ - public async disable({ - path, - headers, - auth = [['apiKey'], ['basic']], - }: { - path: { functionName: string; subscriptionName: string } - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - return this.awaitResponse( - this.buildClient(auth).put(`mambu-functions/${path.functionName}/subscriptions/${path.subscriptionName}/disable`, { - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - }), - { - 200: MambuFunctionSubscription, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - } - ) - } - - /** - * Enable an existing Mambu Function Subscription - */ - public async enable({ - path, - headers, - auth = [['apiKey'], ['basic']], - }: { - path: { functionName: string; subscriptionName: string } - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - return this.awaitResponse( - this.buildClient(auth).put(`mambu-functions/${path.functionName}/subscriptions/${path.subscriptionName}/enable`, { - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - }), - { - 200: MambuFunctionSubscription, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - } - ) - } - - /** - * Allows retrieval of a single subscription via name - */ - public async get({ - path, - auth = [['apiKey'], ['basic']], - }: { - path: { functionName: string; subscriptionName: string } - auth?: string[][] | string[] - }) { - return this.awaitResponse( - this.buildClient(auth).get(`mambu-functions/${path.functionName}/subscriptions/${path.subscriptionName}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', - }), - { - 200: MambuFunctionSubscription, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - } - ) - } - - /** - * Allows retrieval of functions using various query parameters - */ - public async getAll({ - query, - auth = [['apiKey'], ['basic']], - }: { - query?: { - offset?: string - limit?: string - paginationDetails?: string - ['Extension Point ID']?: string - ['Function Name']?: string - } - auth?: string[][] | string[] - } = {}) { - return this.awaitResponse( - this.buildClient(auth).get(`mambu-functions`, { - searchParams: query ?? {}, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', - }), - { - 200: GetAllResponse, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - } - ) - } - - /** - * Allows retrieval of a single function via name - */ - public async getByName({ - path, - auth = [['apiKey'], ['basic']], - }: { - path: { functionName: string } - auth?: string[][] | string[] - }) { - return this.awaitResponse( - this.buildClient(auth).get(`mambu-functions/${path.functionName}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', - }), - { - 200: MambuFunction, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - } - ) - } - - /** - * Allows retrieval of functions logs various query parameters - */ - public async getLogs({ - path, - query, - auth = [['apiKey'], ['basic']], - }: { - path: { functionName: string } - query?: { from?: string; to?: string; limit?: string; level?: string; msgPattern?: string } - auth?: string[][] | string[] - }) { - return this.awaitResponse( - this.buildClient(auth).get(`mambu-functions/${path.functionName}/logs`, { - searchParams: query ?? {}, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', - }), - { - 200: GetLogsResponse, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - 500: ErrorResponse, - } - ) - } - - /** - * List all Mambu Function Subscriptions for a function - */ - public async listFunctionSubscriptions({ - path, - auth = [['apiKey'], ['basic']], - }: { - path: { functionName: string } - auth?: string[][] | string[] - }) { - return this.awaitResponse( - this.buildClient(auth).get(`mambu-functions/${path.functionName}/subscriptions`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', - }), - { - 200: ListFunctionSubscriptionsResponse, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - } - ) - } - - /** - * Update an existing Mambu Function Subscription - */ - public async update({ - body, - path, - headers, - auth = [['apiKey'], ['basic']], - }: { - body: MambuFunctionSubscriptionUpdate - path: { functionName: string; subscriptionName: string } - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(MambuFunctionSubscriptionUpdate, body) - - return this.awaitResponse( - this.buildClient(auth).put(`mambu-functions/${path.functionName}/subscriptions/${path.subscriptionName}`, { - json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - }), - { - 200: MambuFunctionSubscription, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - } - ) - } - - /** - * Update an existing Mambu Function - */ - public async update1({ - body, - path, - headers, - auth = [['apiKey'], ['basic']], - }: { - body: MambuFunctionUpdate - path: { functionName: string } - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(MambuFunctionUpdate, body) - - return this.awaitResponse( - this.buildClient(auth).put(`mambu-functions/${path.functionName}`, { - json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', - }), - { - 102: { is: (_x: unknown): _x is unknown => true }, - 200: MambuFunction, - 400: ErrorResponse, - 401: ErrorResponse, - 403: ErrorResponse, - 404: ErrorResponse, - } - ) - } - - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body - } - - public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never - const result = await response - const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { - return { - statusCode: result.statusCode, - headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] - } - } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> - } - } - - protected buildBasicClient(client: Got) { - return client.extend({ - hooks: { - beforeRequest: [ - async (options) => { - const basic = this.auth.basic - if (basic !== undefined) { - const [username, password] = typeof basic === 'function' ? await basic() : basic - options.username = username - options.password = password - } - }, - ], - }, - }) - } - - protected buildApiKeyClient(client: Got) { - return client.extend({ - hooks: { - beforeRequest: [ - async (options) => { - const apiKey = this.auth.apiKey - const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key - }, - ], - }, - }) - } - - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { - const auth = (auths ?? [...this.availableAuth]) - .map((auth) => (Array.isArray(auth) ? auth : [auth])) - .filter((auth) => auth.every((a) => this.availableAuth.has(a))) - for (const chosen of auth[0] ?? []) { - if (chosen === 'basic') { - client = this.buildBasicClient(client) - } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) - } - } - return client - } -} diff --git a/src/mambu-functions/rest.type.ts b/src/mambu-functions/rest.type.ts deleted file mode 100644 index 21b6268..0000000 --- a/src/mambu-functions/rest.type.ts +++ /dev/null @@ -1,343 +0,0 @@ -/** - * Generated by @skyleague/therefore@v1.0.0-local - * Do not manually touch this - */ -/* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' - -export interface ErrorResponse { - errors?: RestError[] -} - -export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, - get schema() { - return ErrorResponse.validate.schema - }, - get errors() { - return ErrorResponse.validate.errors ?? undefined - }, - is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) - } - }, -} as const - -export type GetAllResponse = MambuFunction[] - -export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, - get schema() { - return GetAllResponse.validate.schema - }, - get errors() { - return GetAllResponse.validate.errors ?? undefined - }, - is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, -} as const - -export type GetLogsResponse = MFunctionLogs[] - -export const GetLogsResponse = { - validate: (await import('./schemas/get-logs-response.schema.js')).validate as ValidateFunction, - get schema() { - return GetLogsResponse.validate.schema - }, - get errors() { - return GetLogsResponse.validate.errors ?? undefined - }, - is: (o: unknown): o is GetLogsResponse => GetLogsResponse.validate(o) === true, -} as const - -export type ListFunctionSubscriptionsResponse = MambuFunctionSubscriptionListItem[] - -export const ListFunctionSubscriptionsResponse = { - validate: (await import('./schemas/list-function-subscriptions-response.schema.js')) - .validate as ValidateFunction, - get schema() { - return ListFunctionSubscriptionsResponse.validate.schema - }, - get errors() { - return ListFunctionSubscriptionsResponse.validate.errors ?? undefined - }, - is: (o: unknown): o is ListFunctionSubscriptionsResponse => ListFunctionSubscriptionsResponse.validate(o) === true, -} as const - -/** - * Mambu Function information. - */ -export interface MambuFunction { - /** - * The id of the extension point - */ - extensionPointId?: string - /** - * The last date the Mambu function was updated (as UTC) - */ - lastModifiedDate?: string - /** - * Mambu function name - */ - name?: string - /** - * Mambu function state - */ - state?: string - /** - * Mambu function version - */ - version?: string -} - -export const MambuFunction = { - validate: (await import('./schemas/mambu-function.schema.js')).validate as ValidateFunction, - get schema() { - return MambuFunction.validate.schema - }, - get errors() { - return MambuFunction.validate.errors ?? undefined - }, - is: (o: unknown): o is MambuFunction => MambuFunction.validate(o) === true, - assert: (o: unknown) => { - if (!MambuFunction.validate(o)) { - throw new ValidationError(MambuFunction.errors ?? []) - } - }, -} as const - -/** - * Represents a Mambu function code - */ -export interface MambuFunctionCode { - /** - * Mambu function code (as Base64) - */ - code?: string - /** - * Mambu function programming language - */ - languageId?: 'es2020' -} - -/** - * Mambu Function create data. - */ -export interface MambuFunctionCreate { - /** - * The id of the extension point - */ - extensionPointId?: string - functionCode?: MambuFunctionCode - /** - * Mambu function name - */ - name?: string - /** - * Mambu function version - */ - version?: string -} - -export const MambuFunctionCreate = { - validate: (await import('./schemas/mambu-function-create.schema.js')).validate as ValidateFunction, - get schema() { - return MambuFunctionCreate.validate.schema - }, - get errors() { - return MambuFunctionCreate.validate.errors ?? undefined - }, - is: (o: unknown): o is MambuFunctionCreate => MambuFunctionCreate.validate(o) === true, - assert: (o: unknown) => { - if (!MambuFunctionCreate.validate(o)) { - throw new ValidationError(MambuFunctionCreate.errors ?? []) - } - }, -} as const - -/** - * Mambu Function Subscription information. - */ -export interface MambuFunctionSubscription { - /** - * subscription batch size, define the maximum number of records in each batch that subscription pulls from your stream - */ - batchSize?: number - /** - * subscription batch window in seconds, define the maximum time range subscription pulls from your stream - */ - batchWindow?: number - /** - * Mambu function subscription name - */ - name?: string - /** - * Mambu function subscription state - */ - state?: string - /** - * subscription topic name, source of stream for the subscription - */ - topicName?: string -} - -export const MambuFunctionSubscription = { - validate: (await import('./schemas/mambu-function-subscription.schema.js')) - .validate as ValidateFunction, - get schema() { - return MambuFunctionSubscription.validate.schema - }, - get errors() { - return MambuFunctionSubscription.validate.errors ?? undefined - }, - is: (o: unknown): o is MambuFunctionSubscription => MambuFunctionSubscription.validate(o) === true, - assert: (o: unknown) => { - if (!MambuFunctionSubscription.validate(o)) { - throw new ValidationError(MambuFunctionSubscription.errors ?? []) - } - }, -} as const - -/** - * Mambu Function Subscription create data. - */ -export interface MambuFunctionSubscriptionCreate { - /** - * subscription batch size, define the maximum number of records in each batch that subscription pulls from your stream - */ - batchSize?: number - /** - * subscription batch window in seconds, define the maximum time range subscription pulls from your stream - */ - batchWindow?: number - /** - * Mambu function subscription name - */ - name?: string - /** - * subscription topic name, source of stream for the subscription - */ - topicName?: string -} - -export const MambuFunctionSubscriptionCreate = { - validate: (await import('./schemas/mambu-function-subscription-create.schema.js')) - .validate as ValidateFunction, - get schema() { - return MambuFunctionSubscriptionCreate.validate.schema - }, - get errors() { - return MambuFunctionSubscriptionCreate.validate.errors ?? undefined - }, - is: (o: unknown): o is MambuFunctionSubscriptionCreate => MambuFunctionSubscriptionCreate.validate(o) === true, - assert: (o: unknown) => { - if (!MambuFunctionSubscriptionCreate.validate(o)) { - throw new ValidationError(MambuFunctionSubscriptionCreate.errors ?? []) - } - }, -} as const - -/** - * Mambu Function Subscription list item for list of subscriptions. - */ -export interface MambuFunctionSubscriptionListItem { - /** - * Mambu function subscription name - */ - name?: string -} - -/** - * Mambu Function Subscription update data. - */ -export interface MambuFunctionSubscriptionUpdate { - /** - * subscription batch size, define the maximum number of records in each batch that subscription pulls from your stream - */ - batchSize?: number - /** - * subscription batch window in seconds, define the maximum time range subscription pulls from your stream - */ - batchWindow?: number -} - -export const MambuFunctionSubscriptionUpdate = { - validate: (await import('./schemas/mambu-function-subscription-update.schema.js')) - .validate as ValidateFunction, - get schema() { - return MambuFunctionSubscriptionUpdate.validate.schema - }, - get errors() { - return MambuFunctionSubscriptionUpdate.validate.errors ?? undefined - }, - is: (o: unknown): o is MambuFunctionSubscriptionUpdate => MambuFunctionSubscriptionUpdate.validate(o) === true, - assert: (o: unknown) => { - if (!MambuFunctionSubscriptionUpdate.validate(o)) { - throw new ValidationError(MambuFunctionSubscriptionUpdate.errors ?? []) - } - }, -} as const - -/** - * Mambu Function update data. - */ -export interface MambuFunctionUpdate { - functionCode?: MambuFunctionCode - /** - * Mambu function version - */ - version?: string -} - -export const MambuFunctionUpdate = { - validate: (await import('./schemas/mambu-function-update.schema.js')).validate as ValidateFunction, - get schema() { - return MambuFunctionUpdate.validate.schema - }, - get errors() { - return MambuFunctionUpdate.validate.errors ?? undefined - }, - is: (o: unknown): o is MambuFunctionUpdate => MambuFunctionUpdate.validate(o) === true, - assert: (o: unknown) => { - if (!MambuFunctionUpdate.validate(o)) { - throw new ValidationError(MambuFunctionUpdate.errors ?? []) - } - }, -} as const - -/** - * Represents a Mambu function log - */ -export interface MFunctionLog { - /** - * Mambu function log level - */ - logLevel?: number - /** - * Mambu function message - */ - message?: string - /** - * The ID of the specific request to the function - */ - requestId?: string - /** - * Mambu function log time - */ - time?: number -} - -/** - * Represents a Mambu function logs list - */ -export interface MFunctionLogs { - logs?: MFunctionLog[] -} - -export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string -} diff --git a/src/mambu-functions/schemas/error-response.schema.js b/src/mambu-functions/schemas/error-response.schema.js deleted file mode 100644 index 328238a..0000000 --- a/src/mambu-functions/schemas/error-response.schema.js +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable - */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/labels.yaml`, { + this.buildClient(auth).get('configuration/labels.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update object labels configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/labels.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/labels.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +166,52 @@ export class MambuObjectLabelsConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/organization-configuration/index.ts b/src/organization-configuration/index.ts index cbd5e3e..1e450af 100644 --- a/src/organization-configuration/index.ts +++ b/src/organization-configuration/index.ts @@ -1 +1 @@ -export * from './rest.client.js' +export { MambuOrganizationConfiguration } from './rest.client.js' diff --git a/src/organization-configuration/rest.client.ts b/src/organization-configuration/rest.client.ts index 555f540..b7c703c 100644 --- a/src/organization-configuration/rest.client.ts +++ b/src/organization-configuration/rest.client.ts @@ -3,10 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' /** * configuration/organization @@ -45,90 +47,143 @@ export class MambuOrganizationConfiguration { /** * Get organization details configuration */ - public async get({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public get({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/organization.yaml`, { + this.buildClient(auth).get('configuration/organization.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Get organization details configuration template */ - public async getTemplate({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public getTemplate({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/organization/template.yaml`, { + this.buildClient(auth).get('configuration/organization/template.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update organization details configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/organization.yaml`, { + this.buildClient(auth).put('configuration/organization.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -155,24 +210,52 @@ export class MambuOrganizationConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/organization-details/index.ts b/src/organization-details/index.ts index a5bab2e..98b9b38 100644 --- a/src/organization-details/index.ts +++ b/src/organization-details/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuOrganizationDetails } from './rest.client.js' export * as organizationDetails from './rest.type.js' diff --git a/src/organization-details/rest.client.ts b/src/organization-details/rest.client.ts index 7f587f7..ea1ccf5 100644 --- a/src/organization-details/rest.client.ts +++ b/src/organization-details/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ErrorResponse, OrganizationSetup } from './rest.type.js' /** @@ -46,9 +49,24 @@ export class MambuOrganizationDetails { /** * Get organization details */ - public async getOrganizationSetup({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public getOrganizationSetup({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', OrganizationSetup> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`setup/organization`, { + this.buildClient(auth).get('setup/organization', { headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', }), @@ -58,24 +76,38 @@ export class MambuOrganizationDetails { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update organization details */ - public async updateOrganizationSetup({ + public updateOrganizationSetup({ body, auth = [['apiKey'], ['basic']], - }: { - body: OrganizationSetup - auth?: string[][] | string[] - }) { - this.validateRequestBody(OrganizationSetup, body) + }: { body: OrganizationSetup; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', OrganizationSetup> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(OrganizationSetup, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).put(`setup/organization`, { + this.buildClient(auth).put('setup/organization', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -86,45 +118,66 @@ export class MambuOrganizationDetails { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -151,24 +204,52 @@ export class MambuOrganizationDetails { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/organization-details/rest.type.ts b/src/organization-details/rest.type.ts index a8c2b1d..30de0f7 100644 --- a/src/organization-details/rest.type.ts +++ b/src/organization-details/rest.type.ts @@ -3,8 +3,11 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as OrganizationSetupValidator } from './schemas/organization-setup.schema.js' /** * Represents an address. @@ -13,55 +16,55 @@ export interface Address { /** * The city for the address. */ - city?: string + city?: string | undefined /** * The country. */ - country?: string + country?: string | undefined /** * The address encoded key, which is unique and generated. */ - encodedKey?: string + encodedKey?: string | undefined /** * The index of this address in the list of addresses. */ - indexInList?: number + indexInList?: number | undefined /** * The GPS latitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -90 to +90. */ - latitude?: number + latitude?: number | undefined /** * The first line of the address. */ - line1?: string + line1?: string | undefined /** * The second line of the address. */ - line2?: string + line2?: string | undefined /** * The GPS longitude of this address in signed degrees format (DDD.dddd) with 6 decimal positions, ranging from -180 to +180. */ - longitude?: number + longitude?: number | undefined /** * The address parent key indicating the object owning this address. For example: client, centre, or branch. */ - parentKey?: string + parentKey?: string | undefined /** * The post code. */ - postcode?: string + postcode?: string | undefined /** * The region for the address. */ - region?: string + region?: string | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -69,10 +72,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -80,15 +84,15 @@ export const ErrorResponse = { * Response representation of the organization setup details */ export interface OrganizationSetup { - address?: Address + address?: Address | undefined /** * The creation date of the organization */ - creationDate?: string + creationDate?: string | undefined /** * The currency of the organization, must be the same as the existing one */ - currency?: string + currency?: string | undefined /** * The format used to represent the date */ @@ -104,7 +108,7 @@ export interface OrganizationSetup { /** * The email address of the organization */ - emailAddress?: string + emailAddress?: string | undefined /** * The name of the organization */ @@ -112,19 +116,19 @@ export interface OrganizationSetup { /** * The last modified date of the organization */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The phone number of the organization */ - phoneNumber?: string + phoneNumber?: string | undefined /** * The timezone id, must be the same as the existing one */ - timeZoneID?: string + timeZoneID?: string | undefined } export const OrganizationSetup = { - validate: (await import('./schemas/organization-setup.schema.js')).validate as ValidateFunction, + validate: OrganizationSetupValidator as ValidateFunction, get schema() { return OrganizationSetup.validate.schema }, @@ -132,15 +136,16 @@ export const OrganizationSetup = { return OrganizationSetup.validate.errors ?? undefined }, is: (o: unknown): o is OrganizationSetup => OrganizationSetup.validate(o) === true, - assert: (o: unknown) => { - if (!OrganizationSetup.validate(o)) { - throw new ValidationError(OrganizationSetup.errors ?? []) + parse: (o: unknown): { right: OrganizationSetup } | { left: DefinedError[] } => { + if (OrganizationSetup.is(o)) { + return { right: o } } + return { left: (OrganizationSetup.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/organization-details/schemas/error-response.schema.js b/src/organization-details/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/organization-details/schemas/error-response.schema.js +++ b/src/organization-details/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'201', CreateResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(CreateRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`organization/holidays/general`, { + this.buildClient(auth).post('organization/holidays/general', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: CreateResponse, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete holiday */ - public async delete({ + public delete({ path, auth = [['apiKey'], ['basic']], - }: { - path: { holidayIdentifier: string } - auth?: string[][] | string[] - }) { + }: { path: { holidayIdentifier: string }; auth?: string[][] | string[] }): Promise< + | 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, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`organization/holidays/general/${path.holidayIdentifier}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get holiday */ - public async getByIdentifier({ + public getByIdentifier({ path, auth = [['apiKey'], ['basic']], - }: { - path: { holidayIdentifier: string } - auth?: string[][] | string[] - }) { + }: { path: { holidayIdentifier: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Holiday> + | 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, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404' | '409'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`organization/holidays/general/${path.holidayIdentifier}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -121,45 +158,66 @@ export class MambuOrganizationGeneralHolidays { 403: ErrorResponse, 404: ErrorResponse, 409: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -186,24 +244,52 @@ export class MambuOrganizationGeneralHolidays { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/organization-general-holidays/rest.type.ts b/src/organization-general-holidays/rest.type.ts index 27c537d..711c84c 100644 --- a/src/organization-general-holidays/rest.type.ts +++ b/src/organization-general-holidays/rest.type.ts @@ -3,13 +3,18 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as CreateRequestValidator } from './schemas/create-request.schema.js' +import { validate as CreateResponseValidator } from './schemas/create-response.schema.js' +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as HolidayValidator } from './schemas/holiday.schema.js' export type CreateRequest = Holiday[] export const CreateRequest = { - validate: (await import('./schemas/create-request.schema.js')).validate as ValidateFunction, + validate: CreateRequestValidator as ValidateFunction, get schema() { return CreateRequest.validate.schema }, @@ -17,17 +22,18 @@ export const CreateRequest = { return CreateRequest.validate.errors ?? undefined }, is: (o: unknown): o is CreateRequest => CreateRequest.validate(o) === true, - assert: (o: unknown) => { - if (!CreateRequest.validate(o)) { - throw new ValidationError(CreateRequest.errors ?? []) + parse: (o: unknown): { right: CreateRequest } | { left: DefinedError[] } => { + if (CreateRequest.is(o)) { + return { right: o } } + return { left: (CreateRequest.errors ?? []) as DefinedError[] } }, } as const export type CreateResponse = Holiday[] export const CreateResponse = { - validate: (await import('./schemas/create-response.schema.js')).validate as ValidateFunction, + validate: CreateResponseValidator as ValidateFunction, get schema() { return CreateResponse.validate.schema }, @@ -35,14 +41,20 @@ export const CreateResponse = { return CreateResponse.validate.errors ?? undefined }, is: (o: unknown): o is CreateResponse => CreateResponse.validate(o) === true, + parse: (o: unknown): { right: CreateResponse } | { left: DefinedError[] } => { + if (CreateResponse.is(o)) { + return { right: o } + } + return { left: (CreateResponse.errors ?? []) as DefinedError[] } + }, } as const export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -50,10 +62,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -64,31 +77,31 @@ export interface Holiday { /** * The date when the holiday was created. */ - creationDate?: string + creationDate?: string | undefined /** * The date the holiday takes place. */ - date?: string + date?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the holiday. */ - id?: number + id?: number | undefined /** * `TRUE` if a holiday is annually recurring, `FALSE` otherwise. */ - isAnnuallyRecurring?: boolean + isAnnuallyRecurring?: boolean | undefined /** * The name of the holiday. */ - name?: string + name?: string | undefined } export const Holiday = { - validate: (await import('./schemas/holiday.schema.js')).validate as ValidateFunction, + validate: HolidayValidator as ValidateFunction, get schema() { return Holiday.validate.schema }, @@ -96,10 +109,16 @@ export const Holiday = { return Holiday.validate.errors ?? undefined }, is: (o: unknown): o is Holiday => Holiday.validate(o) === true, + parse: (o: unknown): { right: Holiday } | { left: DefinedError[] } => { + if (Holiday.is(o)) { + return { right: o } + } + return { left: (Holiday.errors ?? []) as DefinedError[] } + }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/organization-general-holidays/schemas/create-request.schema.js b/src/organization-general-holidays/schemas/create-request.schema.js index 32f5e6e..62f6e92 100644 --- a/src/organization-general-holidays/schemas/create-request.schema.js +++ b/src/organization-general-holidays/schemas/create-request.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"createRequest","type":"array","items":{"$ref":"#/$defs/Holiday"},"$defs":{"Holiday":{"type":"object","title":"Holiday","description":"Represents the holiday.","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The date when the holiday was created.","format":"date-time"},"date":{"type":"string","title":"date","description":"The date the holiday takes place.","format":"date"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"id":{"type":"integer","title":"id","description":"The ID of the holiday."},"isAnnuallyRecurring":{"type":"boolean","title":"isAnnuallyRecurring","description":"`TRUE` if a holiday is annually recurring, `FALSE` otherwise."},"name":{"type":"string","title":"name","description":"The name of the holiday."}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"Holiday","description":"Represents the holiday.","properties":{"creationDate":{"type":"string","title":"creationDate","description":"The date when the holiday was created.","format":"date-time"},"date":{"type":"string","title":"date","description":"The date the holiday takes place.","format":"date"},"encodedKey":{"type":"string","title":"encodedKey","description":"The encoded key of the entity, generated, globally unique"},"id":{"type":"integer","title":"id","description":"The ID of the holiday."},"isAnnuallyRecurring":{"type":"boolean","title":"isAnnuallyRecurring","description":"`TRUE` if a holiday is annually recurring, `FALSE` otherwise."},"name":{"type":"string","title":"name","description":"The name of the holiday."}},"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(Array.isArray(data)){var valid0 = true;const len0 = data.length;for(let i0=0; i0 + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`organization/holidays`, { + this.buildClient(auth).get('organization/holidays', { headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', }), @@ -57,18 +74,38 @@ export class MambuOrganizationHolidays { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update holidays */ - public async update({ body, auth = [['apiKey'], ['basic']] }: { body: Holidays; auth?: string[][] | string[] }) { - this.validateRequestBody(Holidays, body) + public update({ + body, + auth = [['apiKey'], ['basic']], + }: { body: Holidays; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Holidays> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Holidays, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).put(`organization/holidays`, { + this.buildClient(auth).put('organization/holidays', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -79,45 +116,66 @@ export class MambuOrganizationHolidays { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -144,24 +202,52 @@ export class MambuOrganizationHolidays { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/organization-holidays/rest.type.ts b/src/organization-holidays/rest.type.ts index 3257af6..4164ec7 100644 --- a/src/organization-holidays/rest.type.ts +++ b/src/organization-holidays/rest.type.ts @@ -3,15 +3,18 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as HolidaysValidator } from './schemas/holidays.schema.js' export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -19,10 +22,11 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const @@ -33,27 +37,27 @@ export interface Holiday { /** * The date when the holiday was created. */ - creationDate?: string + creationDate?: string | undefined /** * The date the holiday takes place. */ - date?: string + date?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the holiday. */ - id?: number + id?: number | undefined /** * `TRUE` if a holiday is annually recurring, `FALSE` otherwise. */ - isAnnuallyRecurring?: boolean + isAnnuallyRecurring?: boolean | undefined /** * The name of the holiday. */ - name?: string + name?: string | undefined } /** @@ -63,15 +67,15 @@ export interface Holidays { /** * The general holidays of the organization. */ - holidays?: Holiday[] + holidays?: Holiday[] | undefined /** * The non-working days of the organization. */ - nonWorkingDays?: HolidaysNonWorkingDaysArray[] + nonWorkingDays?: NonWorkingDays[] | undefined } export const Holidays = { - validate: (await import('./schemas/holidays.schema.js')).validate as ValidateFunction, + validate: HolidaysValidator as ValidateFunction, get schema() { return Holidays.validate.schema }, @@ -79,17 +83,18 @@ export const Holidays = { return Holidays.validate.errors ?? undefined }, is: (o: unknown): o is Holidays => Holidays.validate(o) === true, - assert: (o: unknown) => { - if (!Holidays.validate(o)) { - throw new ValidationError(Holidays.errors ?? []) + parse: (o: unknown): { right: Holidays } | { left: DefinedError[] } => { + if (Holidays.is(o)) { + return { right: o } } + return { left: (Holidays.errors ?? []) as DefinedError[] } }, } as const -type HolidaysNonWorkingDaysArray = 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY' +type NonWorkingDays = 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY' export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/organization-holidays/schemas/error-response.schema.js b/src/organization-holidays/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/organization-holidays/schemas/error-response.schema.js +++ b/src/organization-holidays/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`organization/holidays/nonworkingdays`, { + this.buildClient(auth).get('organization/holidays/nonworkingdays', { headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', }), @@ -57,24 +74,38 @@ export class MambuOrganizationNonWorkingDays { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update non-working days */ - public async updateNonWorkingDays({ + public updateNonWorkingDays({ body, auth = [['apiKey'], ['basic']], - }: { - body: NonWorkingDays - auth?: string[][] | string[] - }) { - this.validateRequestBody(NonWorkingDays, body) + }: { body: NonWorkingDays; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', NonWorkingDays> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(NonWorkingDays, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).put(`organization/holidays/nonworkingdays`, { + this.buildClient(auth).put('organization/holidays/nonworkingdays', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -85,45 +116,66 @@ export class MambuOrganizationNonWorkingDays { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -150,24 +202,52 @@ export class MambuOrganizationNonWorkingDays { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/organization-non-working-days/rest.type.ts b/src/organization-non-working-days/rest.type.ts index a923a51..6ad81f8 100644 --- a/src/organization-non-working-days/rest.type.ts +++ b/src/organization-non-working-days/rest.type.ts @@ -3,15 +3,18 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +import type { DefinedError, ValidateFunction } from 'ajv' + +import { validate as ErrorResponseValidator } from './schemas/error-response.schema.js' +import { validate as NonWorkingDaysValidator } from './schemas/non-working-days.schema.js' export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -19,13 +22,16 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const +type NonWorkingDays2 = 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY' + /** * Represents the non-working days of the organization. */ @@ -33,11 +39,11 @@ export interface NonWorkingDays { /** * The non-working days of the organization. */ - nonWorkingDays: NonWorkingDaysNonWorkingDaysArray[] + nonWorkingDays: NonWorkingDays2[] } export const NonWorkingDays = { - validate: (await import('./schemas/non-working-days.schema.js')).validate as ValidateFunction, + validate: NonWorkingDaysValidator as ValidateFunction, get schema() { return NonWorkingDays.validate.schema }, @@ -45,17 +51,16 @@ export const NonWorkingDays = { return NonWorkingDays.validate.errors ?? undefined }, is: (o: unknown): o is NonWorkingDays => NonWorkingDays.validate(o) === true, - assert: (o: unknown) => { - if (!NonWorkingDays.validate(o)) { - throw new ValidationError(NonWorkingDays.errors ?? []) + parse: (o: unknown): { right: NonWorkingDays } | { left: DefinedError[] } => { + if (NonWorkingDays.is(o)) { + return { right: o } } + return { left: (NonWorkingDays.errors ?? []) as DefinedError[] } }, } as const -type NonWorkingDaysNonWorkingDaysArray = 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY' - export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } diff --git a/src/organization-non-working-days/schemas/error-response.schema.js b/src/organization-non-working-days/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/organization-non-working-days/schemas/error-response.schema.js +++ b/src/organization-non-working-days/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate10.errors = [{instancePath:instancePath+"/items",schemaPath:"#/properties/items/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+"/items",schemaPath:"#/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"}];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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CommitSubscriptionCursorsRequest","type":"object","description":"","properties":{"items":{"type":"array","description":"List of cursors that the consumer acknowledges to have successfully processed.","items":{"type":"object","description":"","properties":{"cursor_token":{"type":"string","description":"An opaque value defined by the server.","minLength":1},"event_type":{"type":"string","description":"The name of the event type this partition's events belong to.","minLength":1},"offset":{"type":"string","description":"Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`.\n\nThis applies in cases when you create new subscription or reset subscription offsets.\n\nAlso for stream start offsets one can use two special values:\n\n- `begin` - read from the oldest available event.\n\n- `end` - read from the most recent offset.","minLength":1},"partition":{"type":"string","description":"Id of the partition pointed to by this cursor.","minLength":1}},"required":["cursor_token","event_type","offset","partition"],"additionalProperties":true},"minItems":1,"uniqueItems":true}},"required":["items"],"additionalProperties":true};const func4 = require("ajv/dist/runtime/ucs2length").default;const func0 = require("ajv/dist/runtime/equal").default;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.items === undefined) && (missing0 = "items")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.items !== undefined){let data0 = data.items;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){if(data0.length < 1){validate10.errors = [{instancePath:instancePath+"/items",schemaPath:"#/properties/items/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"}];return false;}else {var valid1 = true;const len0 = data0.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate10.errors = [{instancePath:instancePath+"/items",schemaPath:"#/properties/items/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+"/items",schemaPath:"#/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"}];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/schemas/commit-subscription-cursors-response200.schema.js b/src/schemas/commit-subscription-cursors-response200.schema.js index d0071ce..5efc6c0 100644 --- a/src/schemas/commit-subscription-cursors-response200.schema.js +++ b/src/schemas/commit-subscription-cursors-response200.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"commitSubscriptionCursorsResponse200","type":"object","description":"","properties":{"items":{"type":"array","title":"items","items":{"$ref":"#/$defs/CursorCommitResultab92"},"minItems":1,"uniqueItems":true}},"required":["items"],"additionalProperties":true,"$defs":{"CursorCommitResultab92":{"type":"object","title":"CursorCommitResultab92","description":"The result of single cursor commit. Holds a cursor itself and a result value.","properties":{"cursor":{"title":"cursor","$ref":"#/$defs/SubscriptionCursorab92"},"result":{"type":"string","title":"result","description":"The result of cursor commit. - `committed`: cursor was successfully committed - `outdated`: there already was more recent (or the same) cursor committed, so the current one was not committed as it is outdated","minLength":1}},"required":["cursor","result"],"additionalProperties":true},"SubscriptionCursorab92":{"type":"object","title":"SubscriptionCursorab92","description":"","properties":{"cursor_token":{"type":"string","title":"cursor_token","description":"An opaque value defined by the server.","minLength":1},"event_type":{"type":"string","title":"event_type","description":"The name of the event type this partition's events belong to.","minLength":1},"offset":{"type":"string","title":"offset","description":"Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. This applies in cases when you create new subscription or reset subscription offsets. Also for stream start offsets one can use two special values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset.","minLength":1},"partition":{"type":"string","title":"partition","description":"Id of the partition pointed to by this cursor.","minLength":1}},"required":["cursor_token","event_type","offset","partition"],"additionalProperties":true}}};const schema12 = {"type":"object","title":"CursorCommitResultab92","description":"The result of single cursor commit. Holds a cursor itself and a result value.","properties":{"cursor":{"title":"cursor","$ref":"#/$defs/SubscriptionCursorab92"},"result":{"type":"string","title":"result","description":"The result of cursor commit. - `committed`: cursor was successfully committed - `outdated`: there already was more recent (or the same) cursor committed, so the current one was not committed as it is outdated","minLength":1}},"required":["cursor","result"],"additionalProperties":true};const schema13 = {"type":"object","title":"SubscriptionCursorab92","description":"","properties":{"cursor_token":{"type":"string","title":"cursor_token","description":"An opaque value defined by the server.","minLength":1},"event_type":{"type":"string","title":"event_type","description":"The name of the event type this partition's events belong to.","minLength":1},"offset":{"type":"string","title":"offset","description":"Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. This applies in cases when you create new subscription or reset subscription offsets. Also for stream start offsets one can use two special values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset.","minLength":1},"partition":{"type":"string","title":"partition","description":"Id of the partition pointed to by this cursor.","minLength":1}},"required":["cursor_token","event_type","offset","partition"],"additionalProperties":true};const func4 = require("ajv/dist/runtime/ucs2length").default;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.cursor === undefined) && (missing0 = "cursor")) || ((data.result === undefined) && (missing0 = "result"))){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.cursor !== undefined){let data0 = data.cursor;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if(((((data0.cursor_token === undefined) && (missing1 = "cursor_token")) || ((data0.event_type === undefined) && (missing1 = "event_type"))) || ((data0.offset === undefined) && (missing1 = "offset"))) || ((data0.partition === undefined) && (missing1 = "partition"))){validate11.errors = [{instancePath:instancePath+"/cursor",schemaPath:"#/$defs/SubscriptionCursorab92/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data0.cursor_token !== undefined){let data1 = data0.cursor_token;const _errs6 = errors;if(errors === _errs6){if(typeof data1 === "string"){if(func4(data1) < 1){validate11.errors = [{instancePath:instancePath+"/cursor/cursor_token",schemaPath:"#/$defs/SubscriptionCursorab92/properties/cursor_token/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/cursor/cursor_token",schemaPath:"#/$defs/SubscriptionCursorab92/properties/cursor_token/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.event_type !== undefined){let data2 = data0.event_type;const _errs8 = errors;if(errors === _errs8){if(typeof data2 === "string"){if(func4(data2) < 1){validate11.errors = [{instancePath:instancePath+"/cursor/event_type",schemaPath:"#/$defs/SubscriptionCursorab92/properties/event_type/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/cursor/event_type",schemaPath:"#/$defs/SubscriptionCursorab92/properties/event_type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.offset !== undefined){let data3 = data0.offset;const _errs10 = errors;if(errors === _errs10){if(typeof data3 === "string"){if(func4(data3) < 1){validate11.errors = [{instancePath:instancePath+"/cursor/offset",schemaPath:"#/$defs/SubscriptionCursorab92/properties/offset/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/cursor/offset",schemaPath:"#/$defs/SubscriptionCursorab92/properties/offset/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data0.partition !== undefined){let data4 = data0.partition;const _errs12 = errors;if(errors === _errs12){if(typeof data4 === "string"){if(func4(data4) < 1){validate11.errors = [{instancePath:instancePath+"/cursor/partition",schemaPath:"#/$defs/SubscriptionCursorab92/properties/partition/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/cursor/partition",schemaPath:"#/$defs/SubscriptionCursorab92/properties/partition/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs12 === errors;}else {var valid2 = true;}}}}}}else {validate11.errors = [{instancePath:instancePath+"/cursor",schemaPath:"#/$defs/SubscriptionCursorab92/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.result !== undefined){let data5 = data.result;const _errs14 = errors;if(errors === _errs14){if(typeof data5 === "string"){if(func4(data5) < 1){validate11.errors = [{instancePath:instancePath+"/result",schemaPath:"#/properties/result/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/result",schemaPath:"#/properties/result/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid0 = _errs14 === 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 func0 = require("ajv/dist/runtime/equal").default;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.items === undefined) && (missing0 = "items")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.items !== undefined){let data0 = data.items;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){if(data0.length < 1){validate10.errors = [{instancePath:instancePath+"/items",schemaPath:"#/properties/items/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"}];return false;}else {var valid1 = true;const len0 = data0.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate10.errors = [{instancePath:instancePath+"/items",schemaPath:"#/properties/items/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+"/items",schemaPath:"#/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"}];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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"CommitSubscriptionCursorsResponse200","type":"object","description":"","properties":{"items":{"type":"array","items":{"$ref":"#/$defs/CursorCommitResult"},"minItems":1,"uniqueItems":true}},"required":["items"],"additionalProperties":true,"$defs":{"CursorCommitResult":{"type":"object","description":"The result of single cursor commit. Holds a cursor itself and a result value.","properties":{"cursor":{"$ref":"#/$defs/SubscriptionCursor"},"result":{"type":"string","description":"The result of cursor commit. - `committed`: cursor was successfully committed - `outdated`: there already was more recent (or the same) cursor committed, so the current one was not committed as it is outdated","minLength":1}},"required":["cursor","result"],"additionalProperties":true},"SubscriptionCursor":{"type":"object","description":"","properties":{"cursor_token":{"type":"string","description":"An opaque value defined by the server.","minLength":1},"event_type":{"type":"string","description":"The name of the event type this partition's events belong to.","minLength":1},"offset":{"type":"string","description":"Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. This applies in cases when you create new subscription or reset subscription offsets. Also for stream start offsets one can use two special values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset.","minLength":1},"partition":{"type":"string","description":"Id of the partition pointed to by this cursor.","minLength":1}},"required":["cursor_token","event_type","offset","partition"],"additionalProperties":true}}};const schema12 = {"type":"object","description":"The result of single cursor commit. Holds a cursor itself and a result value.","properties":{"cursor":{"$ref":"#/$defs/SubscriptionCursor"},"result":{"type":"string","description":"The result of cursor commit. - `committed`: cursor was successfully committed - `outdated`: there already was more recent (or the same) cursor committed, so the current one was not committed as it is outdated","minLength":1}},"required":["cursor","result"],"additionalProperties":true};const schema13 = {"type":"object","description":"","properties":{"cursor_token":{"type":"string","description":"An opaque value defined by the server.","minLength":1},"event_type":{"type":"string","description":"The name of the event type this partition's events belong to.","minLength":1},"offset":{"type":"string","description":"Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. This applies in cases when you create new subscription or reset subscription offsets. Also for stream start offsets one can use two special values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset.","minLength":1},"partition":{"type":"string","description":"Id of the partition pointed to by this cursor.","minLength":1}},"required":["cursor_token","event_type","offset","partition"],"additionalProperties":true};const func4 = require("ajv/dist/runtime/ucs2length").default;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.cursor === undefined) && (missing0 = "cursor")) || ((data.result === undefined) && (missing0 = "result"))){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.cursor !== undefined){let data0 = data.cursor;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if(((((data0.cursor_token === undefined) && (missing1 = "cursor_token")) || ((data0.event_type === undefined) && (missing1 = "event_type"))) || ((data0.offset === undefined) && (missing1 = "offset"))) || ((data0.partition === undefined) && (missing1 = "partition"))){validate11.errors = [{instancePath:instancePath+"/cursor",schemaPath:"#/$defs/SubscriptionCursor/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data0.cursor_token !== undefined){let data1 = data0.cursor_token;const _errs6 = errors;if(errors === _errs6){if(typeof data1 === "string"){if(func4(data1) < 1){validate11.errors = [{instancePath:instancePath+"/cursor/cursor_token",schemaPath:"#/$defs/SubscriptionCursor/properties/cursor_token/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/cursor/cursor_token",schemaPath:"#/$defs/SubscriptionCursor/properties/cursor_token/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.event_type !== undefined){let data2 = data0.event_type;const _errs8 = errors;if(errors === _errs8){if(typeof data2 === "string"){if(func4(data2) < 1){validate11.errors = [{instancePath:instancePath+"/cursor/event_type",schemaPath:"#/$defs/SubscriptionCursor/properties/event_type/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/cursor/event_type",schemaPath:"#/$defs/SubscriptionCursor/properties/event_type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.offset !== undefined){let data3 = data0.offset;const _errs10 = errors;if(errors === _errs10){if(typeof data3 === "string"){if(func4(data3) < 1){validate11.errors = [{instancePath:instancePath+"/cursor/offset",schemaPath:"#/$defs/SubscriptionCursor/properties/offset/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/cursor/offset",schemaPath:"#/$defs/SubscriptionCursor/properties/offset/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data0.partition !== undefined){let data4 = data0.partition;const _errs12 = errors;if(errors === _errs12){if(typeof data4 === "string"){if(func4(data4) < 1){validate11.errors = [{instancePath:instancePath+"/cursor/partition",schemaPath:"#/$defs/SubscriptionCursor/properties/partition/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/cursor/partition",schemaPath:"#/$defs/SubscriptionCursor/properties/partition/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs12 === errors;}else {var valid2 = true;}}}}}}else {validate11.errors = [{instancePath:instancePath+"/cursor",schemaPath:"#/$defs/SubscriptionCursor/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.result !== undefined){let data5 = data.result;const _errs14 = errors;if(errors === _errs14){if(typeof data5 === "string"){if(func4(data5) < 1){validate11.errors = [{instancePath:instancePath+"/result",schemaPath:"#/properties/result/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/result",schemaPath:"#/properties/result/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid0 = _errs14 === 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 func0 = require("ajv/dist/runtime/equal").default;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.items === undefined) && (missing0 = "items")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.items !== undefined){let data0 = data.items;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){if(data0.length < 1){validate10.errors = [{instancePath:instancePath+"/items",schemaPath:"#/properties/items/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"}];return false;}else {var valid1 = true;const len0 = data0.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data0[i1], data0[j0])){validate10.errors = [{instancePath:instancePath+"/items",schemaPath:"#/properties/items/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+"/items",schemaPath:"#/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"}];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/schemas/delete-subscription-by-subscription-id-response404.schema.js b/src/schemas/delete-subscription-by-subscription-id-response404.schema.js index 8a10e84..8fc98c2 100644 --- a/src/schemas/delete-subscription-by-subscription-id-response404.schema.js +++ b/src/schemas/delete-subscription-by-subscription-id-response404.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"deleteSubscriptionBySubscriptionIdResponse404","type":"object","description":"","properties":{"detail":{"type":"string","title":"detail","description":"A human readable explanation specific to this occurrence of the problem.","minLength":1},"status":{"type":"number","title":"status","description":"The HTTP status code generated by the origin server for this occurrence of the problem."},"title":{"type":"string","title":"title","description":"A short, summary of the problem type. Written in English and readable for engineers (usually not suited for non technical stakeholders and not localized).","minLength":1}},"required":["detail","status","title"],"additionalProperties":true};const func4 = require("ajv/dist/runtime/ucs2length").default;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.detail === undefined) && (missing0 = "detail")) || ((data.status === undefined) && (missing0 = "status"))) || ((data.title === undefined) && (missing0 = "title"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.detail !== undefined){let data0 = data.detail;const _errs2 = errors;if(errors === _errs2){if(typeof data0 === "string"){if(func4(data0) < 1){validate10.errors = [{instancePath:instancePath+"/detail",schemaPath:"#/properties/detail/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/detail",schemaPath:"#/properties/detail/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.status !== undefined){let data1 = data.status;const _errs4 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate10.errors = [{instancePath:instancePath+"/status",schemaPath:"#/properties/status/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.title !== undefined){let data2 = data.title;const _errs6 = errors;if(errors === _errs6){if(typeof data2 === "string"){if(func4(data2) < 1){validate10.errors = [{instancePath:instancePath+"/title",schemaPath:"#/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/title",schemaPath:"#/properties/title/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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"DeleteSubscriptionBySubscriptionIdResponse404","type":"object","description":"","properties":{"detail":{"type":"string","description":"A human readable explanation specific to this occurrence of the problem.","minLength":1},"status":{"type":"number","description":"The HTTP status code generated by the origin server for this occurrence of the problem."},"title":{"type":"string","description":"A short, summary of the problem type. Written in English and readable for engineers (usually not suited for non technical stakeholders and not localized).","minLength":1}},"required":["detail","status","title"],"additionalProperties":true};const func4 = require("ajv/dist/runtime/ucs2length").default;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.detail === undefined) && (missing0 = "detail")) || ((data.status === undefined) && (missing0 = "status"))) || ((data.title === undefined) && (missing0 = "title"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.detail !== undefined){let data0 = data.detail;const _errs2 = errors;if(errors === _errs2){if(typeof data0 === "string"){if(func4(data0) < 1){validate10.errors = [{instancePath:instancePath+"/detail",schemaPath:"#/properties/detail/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/detail",schemaPath:"#/properties/detail/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.status !== undefined){let data1 = data.status;const _errs4 = errors;if(!((typeof data1 == "number") && (isFinite(data1)))){validate10.errors = [{instancePath:instancePath+"/status",schemaPath:"#/properties/status/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.title !== undefined){let data2 = data.title;const _errs6 = errors;if(errors === _errs6){if(typeof data2 === "string"){if(func4(data2) < 1){validate10.errors = [{instancePath:instancePath+"/title",schemaPath:"#/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/title",schemaPath:"#/properties/title/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/schemas/get-subscription-stats-response.schema.js b/src/schemas/get-subscription-stats-response.schema.js index 81827de..dcf5197 100644 --- a/src/schemas/get-subscription-stats-response.schema.js +++ b/src/schemas/get-subscription-stats-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"getSubscriptionStatsResponse","type":"object","properties":{"items":{"type":"array","title":"items","description":"Statistics list for specified subscription.","items":{"$ref":"#/$defs/SubscriptionEventTypeStatsab92"}}},"required":["items"],"additionalProperties":true,"$defs":{"SubscriptionEventTypeStatsab92":{"type":"object","title":"SubscriptionEventTypeStatsab92","description":"Statistics of one event-type within a context of subscription.","properties":{"event_type":{"type":"string","title":"event_type","description":"The name of the event type this partition's events belong to."},"partitions":{"type":"array","title":"partitions","description":"Statistics of partitions of this event-type.","items":{"$ref":"#/$defs/PartitionStatsab92"}}},"required":["event_type","partitions"],"additionalProperties":true},"PartitionStatsab92":{"type":"object","title":"PartitionStatsab92","description":"Statistics of partition within a subscription context.","properties":{"consumer_lag_seconds":{"type":"integer","title":"consumer_lag_seconds","description":"Subscription consumer lag for this partition in seconds. Measured as the age of the oldest event of this partition that is not yet consumed within this subscription."},"partition":{"type":"string","title":"partition","description":"The partition id.","minLength":1},"state":{"title":"state","description":"The state of this partition in current subscription. Currently following values are possible:\n\n`unassigned` - the partition is currently not assigned to any client.\n`reassigning` - the partition is currently reassigning from one client to another.\n`assigned` - the partition is assigned to a client.","enum":["assigned","unassigned","reassigning"]},"stream_id":{"type":"string","title":"stream_id","description":"The id of the stream that consumes data from this partition."},"unconsumed_events":{"type":"integer","title":"unconsumed_events","description":"The amount of events in this partition that are not yet consumed within this subscription. The property may be absent at the moment when no events were yet consumed from the partition in this subscription (In case of read_from is `BEGIN` or `END`). If the event type uses ‘compact’ cleanup policy - then the actual number of unconsumed events can be lower than the one reported in this field."}},"required":["partition","state","stream_id","unconsumed_events"],"additionalProperties":true}}};const schema12 = {"type":"object","title":"SubscriptionEventTypeStatsab92","description":"Statistics of one event-type within a context of subscription.","properties":{"event_type":{"type":"string","title":"event_type","description":"The name of the event type this partition's events belong to."},"partitions":{"type":"array","title":"partitions","description":"Statistics of partitions of this event-type.","items":{"$ref":"#/$defs/PartitionStatsab92"}}},"required":["event_type","partitions"],"additionalProperties":true};const schema13 = {"type":"object","title":"PartitionStatsab92","description":"Statistics of partition within a subscription context.","properties":{"consumer_lag_seconds":{"type":"integer","title":"consumer_lag_seconds","description":"Subscription consumer lag for this partition in seconds. Measured as the age of the oldest event of this partition that is not yet consumed within this subscription."},"partition":{"type":"string","title":"partition","description":"The partition id.","minLength":1},"state":{"title":"state","description":"The state of this partition in current subscription. Currently following values are possible:\n\n`unassigned` - the partition is currently not assigned to any client.\n`reassigning` - the partition is currently reassigning from one client to another.\n`assigned` - the partition is assigned to a client.","enum":["assigned","unassigned","reassigning"]},"stream_id":{"type":"string","title":"stream_id","description":"The id of the stream that consumes data from this partition."},"unconsumed_events":{"type":"integer","title":"unconsumed_events","description":"The amount of events in this partition that are not yet consumed within this subscription. The property may be absent at the moment when no events were yet consumed from the partition in this subscription (In case of read_from is `BEGIN` or `END`). If the event type uses ‘compact’ cleanup policy - then the actual number of unconsumed events can be lower than the one reported in this field."}},"required":["partition","state","stream_id","unconsumed_events"],"additionalProperties":true};const func4 = require("ajv/dist/runtime/ucs2length").default;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.event_type === undefined) && (missing0 = "event_type")) || ((data.partitions === undefined) && (missing0 = "partitions"))){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.event_type !== undefined){const _errs2 = errors;if(typeof data.event_type !== "string"){validate11.errors = [{instancePath:instancePath+"/event_type",schemaPath:"#/properties/event_type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.partitions !== undefined){let data1 = data.partitions;const _errs4 = errors;if(errors === _errs4){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(data5[i1], data5[j0])){validate10.errors = [{instancePath:instancePath+"/events",schemaPath:"#/properties/events/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+"/events",schemaPath:"#/properties/events/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.info !== undefined){let data7 = data.info;const _errs17 = errors;const _errs18 = errors;if(errors === _errs18){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){}else {validate10.errors = [{instancePath:instancePath+"/info",schemaPath:"#/$defs/StreamInfoab92/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs17 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"SubscriptionEventStreamBatch","type":"object","description":"One chunk of events in a stream. A batch consists of an array of `event`s plus a `cursor` pointing to the offset of the last `event` in the stream.\n\nThe size of the array of `event` is limited by the parameters used to initialize a Stream.\n\nSequential batches might present repeated cursors if no new events have arrived.","properties":{"cursor":{"$ref":"#/$defs/SubscriptionCursor"},"events":{"type":"array","description":"[Payload of an Event. Usually represents a status transition in a Business process.]","items":{"$ref":"#/$defs/Event"},"minItems":1,"uniqueItems":true},"info":{"$ref":"#/$defs/StreamInfo"}},"required":["cursor"],"additionalProperties":true,"$defs":{"SubscriptionCursor":{"type":"object","description":"","properties":{"cursor_token":{"type":"string","description":"An opaque value defined by the server.","minLength":1},"event_type":{"type":"string","description":"The name of the event type this partition's events belong to.","minLength":1},"offset":{"type":"string","description":"Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. This applies in cases when you create new subscription or reset subscription offsets. Also for stream start offsets one can use two special values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset.","minLength":1},"partition":{"type":"string","description":"Id of the partition pointed to by this cursor.","minLength":1}},"required":["cursor_token","event_type","offset","partition"],"additionalProperties":true},"Event":{"type":"object","description":"Payload of an Event. Usually represents a status transition in a Business process.","properties":{"body":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":true}]},"metadata":{"$ref":"#/$defs/EventMetadata"},"template_name":{"type":"string","description":"Name of the notification template.","minLength":1}},"required":["body","metadata","template_name"],"additionalProperties":true},"EventMetadata":{"type":"object","description":"Metadata for this Event.","properties":{"category":{"type":"string","description":"Indicates if the content of the notification can be configured in Mambu or it is fixed. Currently only one category is supported: `DATA`","minLength":1},"content_type":{"description":"Notification content format.","enum":["application/xml","application/json","text/plain; charset=UTF-8"]},"eid":{"type":"string","description":"Unique identifier of this Event. Consumers MIGHT use this value to assert uniqueness of reception of the Event.","minLength":1,"format":"uuid"},"event_type":{"type":"string","description":"The EventType of this Event.","minLength":1},"occurred_at":{"type":"string","description":"Timestamp of creation of the Event generated by Mambu.","minLength":1,"format":"date-time"}},"required":["category","content_type","eid","event_type","occurred_at"],"additionalProperties":true},"StreamInfo":{"type":"object","description":"This object contains general information about the stream. Used only for debugging purposes. We recommend logging this object in order to solve connection issues. \n\nClients should not parse this structure.","additionalProperties":true}}};const schema12 = {"type":"object","description":"","properties":{"cursor_token":{"type":"string","description":"An opaque value defined by the server.","minLength":1},"event_type":{"type":"string","description":"The name of the event type this partition's events belong to.","minLength":1},"offset":{"type":"string","description":"Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. This applies in cases when you create new subscription or reset subscription offsets. Also for stream start offsets one can use two special values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset.","minLength":1},"partition":{"type":"string","description":"Id of the partition pointed to by this cursor.","minLength":1}},"required":["cursor_token","event_type","offset","partition"],"additionalProperties":true};const schema15 = {"type":"object","description":"This object contains general information about the stream. Used only for debugging purposes. We recommend logging this object in order to solve connection issues. \n\nClients should not parse this structure.","additionalProperties":true};const func4 = require("ajv/dist/runtime/ucs2length").default;const func0 = require("ajv/dist/runtime/equal").default;const schema13 = {"type":"object","description":"Payload of an Event. Usually represents a status transition in a Business process.","properties":{"body":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":true}]},"metadata":{"$ref":"#/$defs/EventMetadata"},"template_name":{"type":"string","description":"Name of the notification template.","minLength":1}},"required":["body","metadata","template_name"],"additionalProperties":true};const schema14 = {"type":"object","description":"Metadata for this Event.","properties":{"category":{"type":"string","description":"Indicates if the content of the notification can be configured in Mambu or it is fixed. Currently only one category is supported: `DATA`","minLength":1},"content_type":{"description":"Notification content format.","enum":["application/xml","application/json","text/plain; charset=UTF-8"]},"eid":{"type":"string","description":"Unique identifier of this Event. Consumers MIGHT use this value to assert uniqueness of reception of the Event.","minLength":1,"format":"uuid"},"event_type":{"type":"string","description":"The EventType of this Event.","minLength":1},"occurred_at":{"type":"string","description":"Timestamp of creation of the Event generated by Mambu.","minLength":1,"format":"date-time"}},"required":["category","content_type","eid","event_type","occurred_at"],"additionalProperties":true};const formats0 = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;const formats2 = require("ajv-formats/dist/formats").fullFormats["date-time"];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.body === undefined) && (missing0 = "body")) || ((data.metadata === undefined) && (missing0 = "metadata"))) || ((data.template_name === undefined) && (missing0 = "template_name"))){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.body !== undefined){let data0 = data.body;const _errs2 = errors;const _errs3 = errors;let valid1 = false;const _errs4 = errors;if(typeof data0 !== "string"){const err0 = {instancePath:instancePath+"/body",schemaPath:"#/properties/body/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}var _valid0 = _errs4 === errors;valid1 = valid1 || _valid0;if(!valid1){const _errs6 = errors;if(errors === _errs6){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){}else {const err1 = {instancePath:instancePath+"/body",schemaPath:"#/properties/body/anyOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}}var _valid0 = _errs6 === errors;valid1 = valid1 || _valid0;}if(!valid1){const err2 = {instancePath:instancePath+"/body",schemaPath:"#/properties/body/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs3;if(vErrors !== null){if(_errs3){vErrors.length = _errs3;}else {vErrors = null;}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.metadata !== undefined){let data1 = data.metadata;const _errs9 = errors;const _errs10 = errors;if(errors === _errs10){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){let missing1;let valid3 = true;for( missing1 of schema14.required){valid3 = data1[missing1] !== undefined;if(!valid3){validate11.errors = [{instancePath:instancePath+"/metadata",schemaPath:"#/$defs/EventMetadata/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;break;}}if(valid3){if(data1.category !== undefined){let data2 = data1.category;const _errs13 = errors;if(errors === _errs13){if(typeof data2 === "string"){if(func4(data2) < 1){validate11.errors = [{instancePath:instancePath+"/metadata/category",schemaPath:"#/$defs/EventMetadata/properties/category/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/metadata/category",schemaPath:"#/$defs/EventMetadata/properties/category/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid4 = _errs13 === errors;}else {var valid4 = true;}if(valid4){if(data1.content_type !== undefined){let data3 = data1.content_type;const _errs15 = errors;if(!(((data3 === "application/xml") || (data3 === "application/json")) || (data3 === "text/plain; charset=UTF-8"))){validate11.errors = [{instancePath:instancePath+"/metadata/content_type",schemaPath:"#/$defs/EventMetadata/properties/content_type/enum",keyword:"enum",params:{allowedValues: schema14.properties.content_type.enum},message:"must be equal to one of the allowed values"}];return false;}var valid4 = _errs15 === errors;}else {var valid4 = true;}if(valid4){if(data1.eid !== undefined){let data4 = data1.eid;const _errs16 = errors;if(errors === _errs16){if(errors === _errs16){if(typeof data4 === "string"){if(func4(data4) < 1){validate11.errors = [{instancePath:instancePath+"/metadata/eid",schemaPath:"#/$defs/EventMetadata/properties/eid/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}else {if(!(formats0.test(data4))){validate11.errors = [{instancePath:instancePath+"/metadata/eid",schemaPath:"#/$defs/EventMetadata/properties/eid/format",keyword:"format",params:{format: "uuid"},message:"must match format \""+"uuid"+"\""}];return false;}}}else {validate11.errors = [{instancePath:instancePath+"/metadata/eid",schemaPath:"#/$defs/EventMetadata/properties/eid/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid4 = _errs16 === errors;}else {var valid4 = true;}if(valid4){if(data1.event_type !== undefined){let data5 = data1.event_type;const _errs18 = errors;if(errors === _errs18){if(typeof data5 === "string"){if(func4(data5) < 1){validate11.errors = [{instancePath:instancePath+"/metadata/event_type",schemaPath:"#/$defs/EventMetadata/properties/event_type/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/metadata/event_type",schemaPath:"#/$defs/EventMetadata/properties/event_type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid4 = _errs18 === errors;}else {var valid4 = true;}if(valid4){if(data1.occurred_at !== undefined){let data6 = data1.occurred_at;const _errs20 = errors;if(errors === _errs20){if(errors === _errs20){if(typeof data6 === "string"){if(func4(data6) < 1){validate11.errors = [{instancePath:instancePath+"/metadata/occurred_at",schemaPath:"#/$defs/EventMetadata/properties/occurred_at/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}else {if(!(formats2.validate(data6))){validate11.errors = [{instancePath:instancePath+"/metadata/occurred_at",schemaPath:"#/$defs/EventMetadata/properties/occurred_at/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}}else {validate11.errors = [{instancePath:instancePath+"/metadata/occurred_at",schemaPath:"#/$defs/EventMetadata/properties/occurred_at/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid4 = _errs20 === errors;}else {var valid4 = true;}}}}}}}else {validate11.errors = [{instancePath:instancePath+"/metadata",schemaPath:"#/$defs/EventMetadata/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs9 === errors;}else {var valid0 = true;}if(valid0){if(data.template_name !== undefined){let data7 = data.template_name;const _errs22 = errors;if(errors === _errs22){if(typeof data7 === "string"){if(func4(data7) < 1){validate11.errors = [{instancePath:instancePath+"/template_name",schemaPath:"#/properties/template_name/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate11.errors = [{instancePath:instancePath+"/template_name",schemaPath:"#/properties/template_name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid0 = _errs22 === 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;}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.cursor === undefined) && (missing0 = "cursor")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.cursor !== undefined){let data0 = data.cursor;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if(((((data0.cursor_token === undefined) && (missing1 = "cursor_token")) || ((data0.event_type === undefined) && (missing1 = "event_type"))) || ((data0.offset === undefined) && (missing1 = "offset"))) || ((data0.partition === undefined) && (missing1 = "partition"))){validate10.errors = [{instancePath:instancePath+"/cursor",schemaPath:"#/$defs/SubscriptionCursor/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data0.cursor_token !== undefined){let data1 = data0.cursor_token;const _errs6 = errors;if(errors === _errs6){if(typeof data1 === "string"){if(func4(data1) < 1){validate10.errors = [{instancePath:instancePath+"/cursor/cursor_token",schemaPath:"#/$defs/SubscriptionCursor/properties/cursor_token/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/cursor/cursor_token",schemaPath:"#/$defs/SubscriptionCursor/properties/cursor_token/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.event_type !== undefined){let data2 = data0.event_type;const _errs8 = errors;if(errors === _errs8){if(typeof data2 === "string"){if(func4(data2) < 1){validate10.errors = [{instancePath:instancePath+"/cursor/event_type",schemaPath:"#/$defs/SubscriptionCursor/properties/event_type/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/cursor/event_type",schemaPath:"#/$defs/SubscriptionCursor/properties/event_type/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.offset !== undefined){let data3 = data0.offset;const _errs10 = errors;if(errors === _errs10){if(typeof data3 === "string"){if(func4(data3) < 1){validate10.errors = [{instancePath:instancePath+"/cursor/offset",schemaPath:"#/$defs/SubscriptionCursor/properties/offset/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/cursor/offset",schemaPath:"#/$defs/SubscriptionCursor/properties/offset/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs10 === errors;}else {var valid2 = true;}if(valid2){if(data0.partition !== undefined){let data4 = data0.partition;const _errs12 = errors;if(errors === _errs12){if(typeof data4 === "string"){if(func4(data4) < 1){validate10.errors = [{instancePath:instancePath+"/cursor/partition",schemaPath:"#/$defs/SubscriptionCursor/properties/partition/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/cursor/partition",schemaPath:"#/$defs/SubscriptionCursor/properties/partition/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs12 === errors;}else {var valid2 = true;}}}}}}else {validate10.errors = [{instancePath:instancePath+"/cursor",schemaPath:"#/$defs/SubscriptionCursor/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.events !== undefined){let data5 = data.events;const _errs14 = errors;if(errors === _errs14){if(Array.isArray(data5)){if(data5.length < 1){validate10.errors = [{instancePath:instancePath+"/events",schemaPath:"#/properties/events/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"}];return false;}else {var valid3 = true;const len0 = data5.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data5[i1], data5[j0])){validate10.errors = [{instancePath:instancePath+"/events",schemaPath:"#/properties/events/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+"/events",schemaPath:"#/properties/events/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.info !== undefined){let data7 = data.info;const _errs17 = errors;const _errs18 = errors;if(errors === _errs18){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){}else {validate10.errors = [{instancePath:instancePath+"/info",schemaPath:"#/$defs/StreamInfo/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs17 === 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/schemas/subscription.schema.js b/src/schemas/subscription.schema.js index 01549d0..8836e38 100644 --- a/src/schemas/subscription.schema.js +++ b/src/schemas/subscription.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"Subscription","type":"object","description":"Subscription is a high level consumption unit. Subscriptions allow applications to easily scale the number of clients by managing consumed event offsets and distributing load between instances. The key properties that identify a subscription are `owning_application`, `event_types` and `consumer_group`. It is not possible to have two different subscriptions with these properties being the same.","properties":{"consumer_group":{"type":"string","title":"consumer_group","description":"The value describing the use case of this subscription. In general that is an additional identifier used to differ subscriptions having the same `owning_application` and `event_types`.","minLength":1},"created_at":{"type":"string","title":"created_at","description":"Timestamp of creation of the subscription. This is generated by Mambu. It should not be specified when creating subscription and sending it may result in a client error.","minLength":1,"format":"date-time"},"event_types":{"type":"array","title":"event_types","description":"EventTypes to subscribe to. The order is not important. Subscriptions that differ only by the order of EventTypes will be considered the same and will have the same id. The size of the `event_type`s list is limited by the total number of partitions within these event types. Default limit for partition count is `100`.","items":{"type":"string"}},"id":{"type":"string","title":"id","description":"ID of subscription that was created. Is generated by Mambu, should not be specified when creating a subscription.","minLength":1},"initial_cursors":{"type":"array","title":"initial_cursors","description":"List of cursors to start reading from. This property is required when `read_from` = cursors. The `initial` cursors should cover all partitions of subscription. Clients will get events starting from next offset positions.","items":{"$ref":"#/$defs/SubscriptionCursorWithoutTokenab92"},"uniqueItems":true},"owning_application":{"type":"string","title":"owning_application","description":"The id of application owning the subscription.","minLength":1},"read_from":{"type":"string","title":"read_from","description":"Position to start reading events from. Currently supported values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset. - `cursors` - read from cursors provided in initial_cursors property. Applied when the client starts reading from a subscription.","minLength":1},"updated_at":{"type":"string","title":"updated_at","description":"Timestamp of last update of the subscription. This is generated by Mambu. It should not be specified when creating subscription and sending it may result in a client error. Its initial value is same as `created_at`.","minLength":1,"format":"date-time"}},"required":["event_types","owning_application"],"additionalProperties":true,"$defs":{"SubscriptionCursorWithoutTokenab92":{"type":"object","title":"SubscriptionCursorWithoutTokenab92","description":"","properties":{"event_type":{"type":"string","title":"event_type","description":"The name of the event type this partition's events belong to.","minLength":1},"offset":{"type":"string","title":"offset","description":"Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. This applies in cases when you create new subscription or reset subscription offsets. Also for stream start offsets one can use two special values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset.","minLength":1},"partition":{"type":"string","title":"partition","description":"Id of the partition pointed to by this cursor.","minLength":1}},"required":["offset","partition"],"additionalProperties":true}}};const schema12 = {"type":"object","title":"SubscriptionCursorWithoutTokenab92","description":"","properties":{"event_type":{"type":"string","title":"event_type","description":"The name of the event type this partition's events belong to.","minLength":1},"offset":{"type":"string","title":"offset","description":"Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. This applies in cases when you create new subscription or reset subscription offsets. Also for stream start offsets one can use two special values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset.","minLength":1},"partition":{"type":"string","title":"partition","description":"Id of the partition pointed to by this cursor.","minLength":1}},"required":["offset","partition"],"additionalProperties":true};const func4 = require("ajv/dist/runtime/ucs2length").default;const func0 = require("ajv/dist/runtime/equal").default;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.event_types === undefined) && (missing0 = "event_types")) || ((data.owning_application === undefined) && (missing0 = "owning_application"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.consumer_group !== undefined){let data0 = data.consumer_group;const _errs2 = errors;if(errors === _errs2){if(typeof data0 === "string"){if(func4(data0) < 1){validate10.errors = [{instancePath:instancePath+"/consumer_group",schemaPath:"#/properties/consumer_group/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/consumer_group",schemaPath:"#/properties/consumer_group/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.created_at !== undefined){let data1 = data.created_at;const _errs4 = errors;if(errors === _errs4){if(errors === _errs4){if(typeof data1 === "string"){if(func4(data1) < 1){validate10.errors = [{instancePath:instancePath+"/created_at",schemaPath:"#/properties/created_at/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/created_at",schemaPath:"#/properties/created_at/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.event_types !== undefined){let data2 = data.event_types;const _errs6 = errors;if(errors === _errs6){if(Array.isArray(data2)){var valid1 = true;const len0 = data2.length;for(let i0=0; i0 1){outer0:for(;i2--;){for(j0 = i2; j0--;){if(func0(data5[i2], data5[j0])){validate10.errors = [{instancePath:instancePath+"/initial_cursors",schemaPath:"#/properties/initial_cursors/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+"/initial_cursors",schemaPath:"#/properties/initial_cursors/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.owning_application !== undefined){let data10 = data.owning_application;const _errs24 = errors;if(errors === _errs24){if(typeof data10 === "string"){if(func4(data10) < 1){validate10.errors = [{instancePath:instancePath+"/owning_application",schemaPath:"#/properties/owning_application/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/owning_application",schemaPath:"#/properties/owning_application/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.read_from !== undefined){let data11 = data.read_from;const _errs26 = errors;if(errors === _errs26){if(typeof data11 === "string"){if(func4(data11) < 1){validate10.errors = [{instancePath:instancePath+"/read_from",schemaPath:"#/properties/read_from/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/read_from",schemaPath:"#/properties/read_from/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.updated_at !== undefined){let data12 = data.updated_at;const _errs28 = errors;if(errors === _errs28){if(errors === _errs28){if(typeof data12 === "string"){if(func4(data12) < 1){validate10.errors = [{instancePath:instancePath+"/updated_at",schemaPath:"#/properties/updated_at/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/updated_at",schemaPath:"#/properties/updated_at/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs28 === 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 +import {createRequire} from 'module';const require = createRequire(import.meta.url);"use strict"; +/** @type {unknown} */ +export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"Subscription","type":"object","description":"Subscription is a high level consumption unit. Subscriptions allow applications to easily scale the number of clients by managing consumed event offsets and distributing load between instances. The key properties that identify a subscription are `owning_application`, `event_types` and `consumer_group`. It is not possible to have two different subscriptions with these properties being the same.","properties":{"consumer_group":{"type":"string","description":"The value describing the use case of this subscription. In general that is an additional identifier used to differ subscriptions having the same `owning_application` and `event_types`.","minLength":1},"created_at":{"type":"string","description":"Timestamp of creation of the subscription. This is generated by Mambu. It should not be specified when creating subscription and sending it may result in a client error.","minLength":1,"format":"date-time"},"event_types":{"type":"array","description":"EventTypes to subscribe to. The order is not important. Subscriptions that differ only by the order of EventTypes will be considered the same and will have the same id. The size of the `event_type`s list is limited by the total number of partitions within these event types. Default limit for partition count is `100`.","items":{"type":"string"}},"id":{"type":"string","description":"ID of subscription that was created. Is generated by Mambu, should not be specified when creating a subscription.","minLength":1},"initial_cursors":{"type":"array","description":"List of cursors to start reading from. This property is required when `read_from` = cursors. The `initial` cursors should cover all partitions of subscription. Clients will get events starting from next offset positions.","items":{"$ref":"#/$defs/SubscriptionCursorWithoutToken"},"uniqueItems":true},"owning_application":{"type":"string","description":"The id of application owning the subscription.","minLength":1},"read_from":{"type":"string","description":"Position to start reading events from. Currently supported values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset. - `cursors` - read from cursors provided in initial_cursors property. Applied when the client starts reading from a subscription.","minLength":1},"updated_at":{"type":"string","description":"Timestamp of last update of the subscription. This is generated by Mambu. It should not be specified when creating subscription and sending it may result in a client error. Its initial value is same as `created_at`.","minLength":1,"format":"date-time"}},"required":["event_types","owning_application"],"additionalProperties":true,"$defs":{"SubscriptionCursorWithoutToken":{"type":"object","description":"","properties":{"event_type":{"type":"string","description":"The name of the event type this partition's events belong to.","minLength":1},"offset":{"type":"string","description":"Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. This applies in cases when you create new subscription or reset subscription offsets. Also for stream start offsets one can use two special values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset.","minLength":1},"partition":{"type":"string","description":"Id of the partition pointed to by this cursor.","minLength":1}},"required":["offset","partition"],"additionalProperties":true}}};const schema12 = {"type":"object","description":"","properties":{"event_type":{"type":"string","description":"The name of the event type this partition's events belong to.","minLength":1},"offset":{"type":"string","description":"Offset of the event being pointed to. Note that if you want to specify beginning position of a stream with first event at offset `N`, you should specify offset `N-1`. This applies in cases when you create new subscription or reset subscription offsets. Also for stream start offsets one can use two special values: - `begin` - read from the oldest available event. - `end` - read from the most recent offset.","minLength":1},"partition":{"type":"string","description":"Id of the partition pointed to by this cursor.","minLength":1}},"required":["offset","partition"],"additionalProperties":true};const func4 = require("ajv/dist/runtime/ucs2length").default;const func0 = require("ajv/dist/runtime/equal").default;const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];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.event_types === undefined) && (missing0 = "event_types")) || ((data.owning_application === undefined) && (missing0 = "owning_application"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.consumer_group !== undefined){let data0 = data.consumer_group;const _errs2 = errors;if(errors === _errs2){if(typeof data0 === "string"){if(func4(data0) < 1){validate10.errors = [{instancePath:instancePath+"/consumer_group",schemaPath:"#/properties/consumer_group/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/consumer_group",schemaPath:"#/properties/consumer_group/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.created_at !== undefined){let data1 = data.created_at;const _errs4 = errors;if(errors === _errs4){if(errors === _errs4){if(typeof data1 === "string"){if(func4(data1) < 1){validate10.errors = [{instancePath:instancePath+"/created_at",schemaPath:"#/properties/created_at/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}else {if(!(formats0.validate(data1))){validate10.errors = [{instancePath:instancePath+"/created_at",schemaPath:"#/properties/created_at/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}}else {validate10.errors = [{instancePath:instancePath+"/created_at",schemaPath:"#/properties/created_at/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.event_types !== undefined){let data2 = data.event_types;const _errs6 = errors;if(errors === _errs6){if(Array.isArray(data2)){var valid1 = true;const len0 = data2.length;for(let i0=0; i0 1){outer0:for(;i2--;){for(j0 = i2; j0--;){if(func0(data5[i2], data5[j0])){validate10.errors = [{instancePath:instancePath+"/initial_cursors",schemaPath:"#/properties/initial_cursors/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+"/initial_cursors",schemaPath:"#/properties/initial_cursors/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.owning_application !== undefined){let data10 = data.owning_application;const _errs24 = errors;if(errors === _errs24){if(typeof data10 === "string"){if(func4(data10) < 1){validate10.errors = [{instancePath:instancePath+"/owning_application",schemaPath:"#/properties/owning_application/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/owning_application",schemaPath:"#/properties/owning_application/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid0 = _errs24 === errors;}else {var valid0 = true;}if(valid0){if(data.read_from !== undefined){let data11 = data.read_from;const _errs26 = errors;if(errors === _errs26){if(typeof data11 === "string"){if(func4(data11) < 1){validate10.errors = [{instancePath:instancePath+"/read_from",schemaPath:"#/properties/read_from/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/read_from",schemaPath:"#/properties/read_from/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid0 = _errs26 === errors;}else {var valid0 = true;}if(valid0){if(data.updated_at !== undefined){let data12 = data.updated_at;const _errs28 = errors;if(errors === _errs28){if(errors === _errs28){if(typeof data12 === "string"){if(func4(data12) < 1){validate10.errors = [{instancePath:instancePath+"/updated_at",schemaPath:"#/properties/updated_at/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}else {if(!(formats0.validate(data12))){validate10.errors = [{instancePath:instancePath+"/updated_at",schemaPath:"#/properties/updated_at/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""}];return false;}}}else {validate10.errors = [{instancePath:instancePath+"/updated_at",schemaPath:"#/properties/updated_at/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}var valid0 = _errs28 === 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/streaming.ts b/src/streaming.ts index 50fc731..265a46e 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -23,7 +23,7 @@ export class MambuStreaming extends BaseMambuStreaming { stream_keep_alive_limit?: string commit_timeout?: string } - headers?: { ['X-Flow-Id']?: string; apikey?: string } + headers?: { 'X-Flow-Id'?: string; apikey?: string } }) { const apiKey = typeof this.auth.apiKeyAuth === 'string' ? this.auth.apiKeyAuth : await this.auth.apiKeyAuth?.() const stream = new PassThrough() @@ -46,7 +46,7 @@ export class MambuStreaming extends BaseMambuStreaming { res.on('data', (chunk) => stream.write(chunk)) res.on('end', resolve) res.on('error', reject) - } + }, ) req.on('error', reject) }) diff --git a/src/tasks/index.ts b/src/tasks/index.ts index 6e5b87d..576a962 100644 --- a/src/tasks/index.ts +++ b/src/tasks/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuTasks } from './rest.client.js' export * as tasks from './rest.type.js' diff --git a/src/tasks/rest.client.ts b/src/tasks/rest.client.ts index 92ec57e..9457876 100644 --- a/src/tasks/rest.client.ts +++ b/src/tasks/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ErrorResponse, GetAllResponse, PatchRequest, Task } from './rest.type.js' /** @@ -46,56 +49,84 @@ export class MambuTasks { /** * Create task */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: Task - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(Task, body) + }: { body: Task; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', Task> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Task, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`tasks`, { + this.buildClient(auth).post('tasks', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: Task, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete task */ - public async delete({ path, auth = [['apiKey'], ['basic']] }: { path: { taskId: string }; auth?: string[][] | string[] }) { + public delete({ + path, + auth = [['apiKey'], ['basic']], + }: { path: { taskId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`tasks/${path.taskId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Gets tasks */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { @@ -110,9 +141,21 @@ export class MambuTasks { status?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`tasks`, { + this.buildClient(auth).get('tasks', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -122,14 +165,30 @@ export class MambuTasks { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get task */ - public async getById({ path, auth = [['apiKey'], ['basic']] }: { path: { taskId: string }; auth?: string[][] | string[] }) { + public getById({ + path, + auth = [['apiKey'], ['basic']], + }: { path: { taskId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Task> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`tasks/${path.taskId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -141,53 +200,78 @@ export class MambuTasks { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update task */ - public async patch({ + public patch({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: PatchRequest - path: { taskId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }: { body: PatchRequest; path: { taskId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`tasks/${path.taskId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update task */ - public async update({ + public update({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: Task - path: { taskId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(Task, body) + }: { body: Task; path: { taskId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Task> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Task, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`tasks/${path.taskId}`, { @@ -201,45 +285,66 @@ export class MambuTasks { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -266,24 +371,52 @@ export class MambuTasks { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/tasks/rest.type.ts b/src/tasks/rest.type.ts index c72d45c..8c5d3c2 100644 --- a/src/tasks/rest.type.ts +++ b/src/tasks/rest.type.ts @@ -3,15 +3,20 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +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 TaskValidator } from './schemas/task.schema.js' export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -19,17 +24,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = Task[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -37,6 +43,12 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const /** @@ -46,7 +58,7 @@ export interface PatchOperation { /** * The field from where a value should be moved, when using move */ - from?: string + from?: string | undefined /** * The change to perform */ @@ -58,15 +70,13 @@ export interface PatchOperation { /** * The value of the field, can be null */ - value?: { - [k: string]: unknown | undefined - } + value?: unknown } export type PatchRequest = PatchOperation[] export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, + validate: PatchRequestValidator as ValidateFunction, get schema() { return PatchRequest.validate.schema }, @@ -74,17 +84,18 @@ export const PatchRequest = { return PatchRequest.validate.errors ?? undefined }, is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -94,23 +105,23 @@ export interface Task { /** * The key of the user this task is assigned to. */ - assignedUserKey?: string + assignedUserKey?: string | undefined /** * The name of the user who created the task. */ - createdByFullName?: string + createdByFullName?: string | undefined /** * The key of the user that created this task. The value is not editable and it is populated at task creation with the current user key. */ - createdByUserKey?: string + createdByUserKey?: string | undefined /** * The date when the task was created. */ - creationDate?: string + creationDate?: string | undefined /** * The description of the task. */ - description?: string + description?: string | undefined /** * The due date when the task has to be completed. */ @@ -118,23 +129,23 @@ export interface Task { /** * The encoded key of the task, which is auto generated, and must be unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the task, which is uniquely generated for the task. */ - id?: number + id?: number | undefined /** * The last date when the task was modified. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The status of this task, a new task always has an `OPEN` status. */ - status?: 'OPEN' | 'COMPLETED' + status?: 'OPEN' | 'COMPLETED' | undefined /** * The individual linked to this task. If null, it means nobody is linked to this task. */ - taskLinkKey?: string + taskLinkKey?: string | undefined /** * The type of the owner represented by the task link key. */ @@ -151,18 +162,19 @@ export interface Task { | 'ID_DOCUMENT' | 'LINE_OF_CREDIT' | 'GL_JOURNAL_ENTRY' + | undefined /** * The template key used to create the task. */ - templateKey?: string + templateKey?: string | undefined /** * The title of the task. */ - title?: string + title?: string | undefined } export const Task = { - validate: (await import('./schemas/task.schema.js')).validate as ValidateFunction, + validate: TaskValidator as ValidateFunction, get schema() { return Task.validate.schema }, @@ -170,9 +182,10 @@ export const Task = { return Task.validate.errors ?? undefined }, is: (o: unknown): o is Task => Task.validate(o) === true, - assert: (o: unknown) => { - if (!Task.validate(o)) { - throw new ValidationError(Task.errors ?? []) + parse: (o: unknown): { right: Task } | { left: DefinedError[] } => { + if (Task.is(o)) { + return { right: o } } + return { left: (Task.errors ?? []) as DefinedError[] } }, } as const diff --git a/src/tasks/schemas/error-response.schema.js b/src/tasks/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/tasks/schemas/error-response.schema.js +++ b/src/tasks/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/transactionchannels.yaml`, { + this.buildClient(auth).get('configuration/transactionchannels.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update transaction channels configuration */ - public async update({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public update({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/transactionchannels.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml' }, + this.buildClient(auth).put('configuration/transactionchannels.yaml', { responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -134,24 +166,52 @@ export class MambuTransactionChannelsConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/transaction-channels/index.ts b/src/transaction-channels/index.ts index ab07d76..890a857 100644 --- a/src/transaction-channels/index.ts +++ b/src/transaction-channels/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuTransactionChannels } from './rest.client.js' export * as transactionChannels from './rest.type.js' diff --git a/src/transaction-channels/rest.client.ts b/src/transaction-channels/rest.client.ts index 46fc9e4..4aad8d4 100644 --- a/src/transaction-channels/rest.client.ts +++ b/src/transaction-channels/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ErrorResponse, GetAllResponse, TransactionChannel } from './rest.type.js' /** @@ -46,67 +49,101 @@ export class MambuTransactionChannels { /** * Create transaction channel */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: TransactionChannel - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(TransactionChannel, body) + }: { body: TransactionChannel; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', TransactionChannel> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(TransactionChannel, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`organization/transactionChannels`, { + this.buildClient(auth).post('organization/transactionChannels', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: TransactionChannel, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete transaction channel */ - public async delete({ + public delete({ path, auth = [['apiKey'], ['basic']], - }: { - path: { transactionChannelId: string } - auth?: string[][] | string[] - }) { + }: { path: { transactionChannelId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`organization/transactionChannels/${path.transactionChannelId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get transaction channels */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], - }: { query?: { detailsLevel?: string; transactionChannelState?: string }; auth?: string[][] | string[] } = {}) { + }: { query?: { detailsLevel?: string; transactionChannelState?: string }; auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`organization/transactionChannels`, { + this.buildClient(auth).get('organization/transactionChannels', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -116,20 +153,30 @@ export class MambuTransactionChannels { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get transaction channel */ - public async getById({ + public getById({ path, auth = [['apiKey'], ['basic']], - }: { - path: { transactionChannelId: string } - auth?: string[][] | string[] - }) { + }: { path: { transactionChannelId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', TransactionChannel> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`organization/transactionChannels/${path.transactionChannelId}`, { headers: { Accept: 'application/vnd.mambu.v2+json' }, @@ -141,75 +188,108 @@ export class MambuTransactionChannels { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update transaction channel */ - public async update({ + public update({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: TransactionChannel - path: { transactionChannelId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(TransactionChannel, body) + }: { body: TransactionChannel; path: { transactionChannelId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(TransactionChannel, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`organization/transactionChannels/${path.transactionChannelId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 200: { is: (_x: unknown): _x is unknown => true }, + 200: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -236,24 +316,52 @@ export class MambuTransactionChannels { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/transaction-channels/rest.type.ts b/src/transaction-channels/rest.type.ts index 53eba3e..5dbd6d5 100644 --- a/src/transaction-channels/rest.type.ts +++ b/src/transaction-channels/rest.type.ts @@ -3,8 +3,12 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +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 TransactionChannelValidator } from './schemas/transaction-channel.schema.js' /** * The constraints applied to the transaction channel @@ -13,23 +17,23 @@ export interface Constraint { /** * Holds the custom constraints, only for the limited usage case. For the unconstrainedcase, no constraints are applied */ - constraints?: TransactionChannelConstraint[] + constraints?: TransactionChannelConstraint[] | undefined /** * Holds the match filter option for the constraints. It can be ALL so all the constraints must match, or ANY so at least one must match */ - matchFiltersOption?: 'ALL' | 'ANY' + matchFiltersOption?: 'ALL' | 'ANY' | undefined /** * States the limited/unconstrained usage of the transaction channel */ - usage?: 'UNCONSTRAINED' | 'LIMITED' + usage?: 'UNCONSTRAINED' | 'LIMITED' | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -37,17 +41,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = TransactionChannel[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -55,12 +60,18 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, } as const export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -70,16 +81,16 @@ export interface TransactionChannel { /** * `TRUE` if the transaction channel is available for all users, `FALSE` otherwise. */ - availableForAll?: boolean + availableForAll?: boolean | undefined depositConstraints: Constraint /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The general ledger (GL) account associated with the transaction channel. */ - glAccount?: string + glAccount?: string | undefined /** * The ID of the transaction channel. */ @@ -87,7 +98,7 @@ export interface TransactionChannel { /** * `TRUE` if the transaction channel is set as the default, `FALSE` otherwise. */ - isDefault?: boolean + isDefault?: boolean | undefined loanConstraints: Constraint /** * The name of the transaction channel. @@ -96,15 +107,15 @@ export interface TransactionChannel { /** * The state of the transaction channel. */ - state?: 'ACTIVE' | 'INACTIVE' + state?: 'ACTIVE' | 'INACTIVE' | undefined /** * The usage rights that describe the transaction channel. */ - usageRights?: string[] + usageRights?: string[] | undefined } export const TransactionChannel = { - validate: (await import('./schemas/transaction-channel.schema.js')).validate as ValidateFunction, + validate: TransactionChannelValidator as ValidateFunction, get schema() { return TransactionChannel.validate.schema }, @@ -112,10 +123,11 @@ export const TransactionChannel = { return TransactionChannel.validate.errors ?? undefined }, is: (o: unknown): o is TransactionChannel => TransactionChannel.validate(o) === true, - assert: (o: unknown) => { - if (!TransactionChannel.validate(o)) { - throw new ValidationError(TransactionChannel.errors ?? []) + parse: (o: unknown): { right: TransactionChannel } | { left: DefinedError[] } => { + if (TransactionChannel.is(o)) { + return { right: o } } + return { left: (TransactionChannel.errors ?? []) as DefinedError[] } }, } as const @@ -134,13 +146,13 @@ export interface TransactionChannelConstraint { /** * The second filtering value of the filter parameter (constraint). It might not exist. Example: it represents '500' from 'Amount Between 100 and 500' */ - secondValue?: string + secondValue?: string | undefined /** * The first filtering value of the filter constraint. Example: it represents 'Disbursement' from 'Type equals Disbursement' and it also represents 100 from 'Amount Between 100 and 500' */ - value?: string + value?: string | undefined /** * Filtering values used for the Product and Type criteria, where filtering might be applied on one or more values */ - values?: string[] + values?: string[] | undefined } diff --git a/src/transaction-channels/schemas/error-response.schema.js b/src/transaction-channels/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/transaction-channels/schemas/error-response.schema.js +++ b/src/transaction-channels/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/userroles.yaml`, { + this.buildClient(auth).get('configuration/userroles.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Get user roles configuration template */ - public async getTemplate({ auth = [['apiKey'], ['basic']] }: { auth?: string[][] | string[] } = {}) { + public getTemplate({ + auth = [['apiKey'], ['basic']], + }: { auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse, '401' | '403'>, string, 'response:statuscode', IncomingHttpHeaders> + > { return this.awaitResponse( - this.buildClient(auth).get(`configuration/userroles/template.yaml`, { + this.buildClient(auth).get('configuration/userroles/template.yaml', { headers: { Accept: 'application/vnd.mambu.v2+yaml' }, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } /** * Update user roles configuration */ - public async update({ + public update({ headers, auth = [['apiKey'], ['basic']], - }: { headers?: { ['X-Mambu-Async']?: string; ['X-Mambu-Callback']?: string }; auth?: string[][] | string[] } = {}) { + }: { headers?: { 'X-Mambu-Async'?: string; 'X-Mambu-Callback'?: string }; auth?: string[][] | string[] } = {}): Promise< + | SuccessResponse<'200', unknown> + | FailureResponse<'400', unknown, 'response:statuscode'> + | FailureResponse<'401', unknown, 'response:statuscode'> + | FailureResponse<'403', unknown, 'response:statuscode'> + | FailureResponse<'404', unknown, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).put(`configuration/userroles.yaml`, { - headers: { Accept: 'application/vnd.mambu.v2+yaml', ...headers }, + this.buildClient(auth).put('configuration/userroles.yaml', { + headers: headers ?? {}, responseType: 'text', }), { - 200: { is: (_x: unknown): _x is string => true }, - 400: { is: (_x: unknown): _x is string => true }, - 401: { is: (_x: unknown): _x is string => true }, - 403: { is: (_x: unknown): _x is string => true }, - 404: { is: (_x: unknown): _x is string => true }, - } - ) + 200: { parse: (x: unknown) => ({ right: x }) }, + 400: { parse: (x: unknown) => ({ right: x }) }, + 401: { parse: (x: unknown) => ({ right: x }) }, + 403: { parse: (x: unknown) => ({ right: x }) }, + 404: { parse: (x: unknown) => ({ right: x }) }, + }, + ) as ReturnType } public async awaitResponse< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -154,24 +193,52 @@ export class MambuUserRolesConfiguration { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/user-roles/index.ts b/src/user-roles/index.ts index ebe9235..013dc36 100644 --- a/src/user-roles/index.ts +++ b/src/user-roles/index.ts @@ -1,2 +1,2 @@ -export * from './rest.client.js' +export { MambuUserRoles } from './rest.client.js' export * as userRoles from './rest.type.js' diff --git a/src/user-roles/rest.client.ts b/src/user-roles/rest.client.ts index 1252a18..6e31960 100644 --- a/src/user-roles/rest.client.ts +++ b/src/user-roles/rest.client.ts @@ -3,10 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import got from 'got' + +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 { ValidateFunction, ErrorObject } from 'ajv' -import type { IncomingHttpHeaders } from 'http' + import { ErrorResponse, GetAllResponse, PatchRequest, Role } from './rest.type.js' /** @@ -46,64 +49,104 @@ export class MambuUserRoles { /** * Create user role */ - public async create({ + public create({ body, headers, auth = [['apiKey'], ['basic']], - }: { - body: Role - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(Role, body) + }: { body: Role; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'201', Role> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Role, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`userroles`, { + this.buildClient(auth).post('userroles', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: Role, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete user role */ - public async delete({ path, auth = [['apiKey'], ['basic']] }: { path: { roleId: string }; auth?: string[][] | string[] }) { + public delete({ + path, + auth = [['apiKey'], ['basic']], + }: { path: { roleId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`userroles/${path.roleId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get user roles */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { query?: { offset?: string; limit?: string; paginationDetails?: string; detailsLevel?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`userroles`, { + this.buildClient(auth).get('userroles', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -113,22 +156,31 @@ export class MambuUserRoles { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get user role */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { roleId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { roleId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', Role> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`userroles/${path.roleId}`, { searchParams: query ?? {}, @@ -141,55 +193,80 @@ export class MambuUserRoles { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update user role */ - public async patch({ + public patch({ body, path, auth = [['apiKey'], ['basic']], - }: { - body: PatchRequest - path: { roleId: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }: { body: PatchRequest; path: { roleId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`userroles/${path.roleId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update user role */ - public async update({ + public update({ body, path, headers, auth = [['apiKey'], ['basic']], - }: { - body: Role - path: { roleId: string } - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(Role, body) + }: { body: Role; path: { roleId: string }; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', Role> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(Role, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`userroles/${path.roleId}`, { @@ -198,51 +275,72 @@ export class MambuUserRoles { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: Role, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -269,24 +367,52 @@ export class MambuUserRoles { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/user-roles/rest.type.ts b/src/user-roles/rest.type.ts index 223f308..dccd6fe 100644 --- a/src/user-roles/rest.type.ts +++ b/src/user-roles/rest.type.ts @@ -3,8 +3,13 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +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 RoleValidator } from './schemas/role.schema.js' /** * Represents the user permissions and access rights. @@ -13,43 +18,43 @@ export interface BaseUserAccess { /** * `TRUE` if the user has the administrator user type, `FALSE` otherwise. Administrators (admins) have all permissions and can perform any action in Mambu. */ - administratorAccess?: boolean + administratorAccess?: boolean | undefined /** * `TRUE` if the user can authenticate and interact with Mambu APIs, `FALSE` otherwise. The user may still require additional permissions for specific API requests. */ - apiAccess?: boolean + apiAccess?: boolean | undefined /** * `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. */ - creditOfficerAccess?: boolean + creditOfficerAccess?: boolean | undefined /** * `TRUE` if the user is part of the Mambu delivery team, `FALSE` otherwise. */ - deliveryAccess?: boolean + deliveryAccess?: boolean | undefined /** * TRUE` if the user can log in to the Mambu UI using their login credentials, `FALSE` otherwise. */ - mambuAccess?: boolean + mambuAccess?: boolean | undefined /** * 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. */ - permissions?: Local0[] + permissions?: Permissions[] | undefined /** * `TRUE` if the user can provide Mambu technical support, `FALSE` otherwise. */ - supportAccess?: boolean + supportAccess?: boolean | undefined /** * `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. */ - tellerAccess?: boolean + tellerAccess?: boolean | undefined } export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -57,17 +62,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = Role[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -75,9 +81,56 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, +} as const + +/** + * A single change that needs to be made to a resource + */ +export interface PatchOperation { + /** + * The field from where a value should be moved, when using move + */ + from?: string | undefined + /** + * The change to perform + */ + op: 'ADD' | 'REPLACE' | 'REMOVE' | 'MOVE' + /** + * The field to perform the operation on + */ + path: string + /** + * The value of the field, can be null + */ + value?: unknown +} + +export type PatchRequest = PatchOperation[] + +export const PatchRequest = { + validate: PatchRequestValidator as ValidateFunction, + get schema() { + return PatchRequest.validate.schema + }, + get errors() { + return PatchRequest.validate.errors ?? undefined + }, + is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } + } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } + }, } as const -type Local0 = +type Permissions = | 'AUDIT_TRANSACTIONS' | 'VIEW_COMMENTS' | 'CREATE_COMMENTS' @@ -366,75 +419,33 @@ type Local0 = | 'VIEW_PROFIT_SHARING_BRANCHES' | 'MAKE_BULK_CHANGE_INTEREST_AVAILABILITY' -/** - * A single change that needs to be made to a resource - */ -export interface PatchOperation { - /** - * The field from where a value should be moved, when using move - */ - from?: string - /** - * The change to perform - */ - op: 'ADD' | 'REPLACE' | 'REMOVE' | 'MOVE' - /** - * The field to perform the operation on - */ - path: string - /** - * The value of the field, can be null - */ - value?: { - [k: string]: unknown | undefined - } -} - -export type PatchRequest = PatchOperation[] - -export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, - get schema() { - return PatchRequest.validate.schema - }, - get errors() { - return PatchRequest.validate.errors ?? undefined - }, - is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) - } - }, -} as const - export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** * Represents a user role. */ export interface Role { - access?: BaseUserAccess + access?: BaseUserAccess | undefined /** * The date when the role was created in UTC. */ - creationDate?: string + creationDate?: string | undefined /** * The encoded key of the entity, generated automatically, globally unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the role, which can be generated and customized, but must be unique. */ - id?: string + id?: string | undefined /** * The last time the role was modified in UTC. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The unique name of the role. */ @@ -442,11 +453,11 @@ export interface Role { /** * The notes about the role. */ - notes?: string + notes?: string | undefined } export const Role = { - validate: (await import('./schemas/role.schema.js')).validate as ValidateFunction, + validate: RoleValidator as ValidateFunction, get schema() { return Role.validate.schema }, @@ -454,9 +465,10 @@ export const Role = { return Role.validate.errors ?? undefined }, is: (o: unknown): o is Role => Role.validate(o) === true, - assert: (o: unknown) => { - if (!Role.validate(o)) { - throw new ValidationError(Role.errors ?? []) + parse: (o: unknown): { right: Role } | { left: DefinedError[] } => { + if (Role.is(o)) { + return { right: o } } + return { left: (Role.errors ?? []) as DefinedError[] } }, } as const diff --git a/src/user-roles/schemas/error-response.schema.js b/src/user-roles/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/user-roles/schemas/error-response.schema.js +++ b/src/user-roles/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0 + | SuccessResponse<'201', User> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '102' | '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(UserRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( - this.buildClient(auth).post(`users`, { + this.buildClient(auth).post('users', { json: body, headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 201: User, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Delete user */ - public async delete({ path, auth = [['apiKey'], ['basic']] }: { path: { userId: string }; auth?: string[][] | string[] }) { + public delete({ + path, + auth = [['apiKey'], ['basic']], + }: { path: { userId: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'204', unknown> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).delete(`users/${path.userId}`, { - headers: { Accept: 'application/vnd.mambu.v2+json' }, - responseType: 'json', + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get users */ - public async getAll({ + public getAll({ query, auth = [['apiKey'], ['basic']], }: { @@ -108,9 +139,21 @@ export class MambuUsers { branchIdType?: string } auth?: string[][] | string[] - } = {}) { + } = {}): Promise< + | SuccessResponse<'200', GetAllResponse> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( - this.buildClient(auth).get(`users`, { + this.buildClient(auth).get('users', { searchParams: query ?? {}, headers: { Accept: 'application/vnd.mambu.v2+json' }, responseType: 'json', @@ -120,22 +163,31 @@ export class MambuUsers { 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Get user */ - public async getById({ + public getById({ path, query, auth = [['apiKey'], ['basic']], - }: { - path: { userId: string } - query?: { detailsLevel?: string } - auth?: string[][] | string[] - }) { + }: { path: { userId: string }; query?: { detailsLevel?: string }; auth?: string[][] | string[] }): Promise< + | SuccessResponse<'200', User> + | FailureResponse<'400', ErrorResponse, 'response:statuscode'> + | FailureResponse<'401', ErrorResponse, 'response:statuscode'> + | FailureResponse<'403', ErrorResponse, 'response:statuscode'> + | FailureResponse<'404', ErrorResponse, 'response:statuscode'> + | FailureResponse, string, 'response:body', IncomingHttpHeaders> + | FailureResponse< + Exclude, '400' | '401' | '403' | '404'>, + string, + 'response:statuscode', + IncomingHttpHeaders + > + > { return this.awaitResponse( this.buildClient(auth).get(`users/${path.userId}`, { searchParams: query ?? {}, @@ -148,14 +200,14 @@ export class MambuUsers { 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Partially update user */ - public async patch({ + public patch({ body, path, headers, @@ -163,42 +215,72 @@ export class MambuUsers { }: { body: PatchRequest path: { userId: string } - headers?: { ['Idempotency-Key']?: string } + headers?: { 'Idempotency-Key'?: string } auth?: string[][] | string[] - }) { - this.validateRequestBody(PatchRequest, body) + }): Promise< + | SuccessResponse<'204', unknown> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(PatchRequest, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).patch(`users/${path.userId}`, { json: body, - headers: { Accept: 'application/vnd.mambu.v2+json', ...headers }, - responseType: 'json', + headers: headers ?? {}, + responseType: 'text', }), { - 204: { is: (_x: unknown): _x is unknown => true }, + 204: { parse: (x: unknown) => ({ right: x }) }, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } /** * Update user */ - public async update({ + public update({ body, path, headers, auth = [['apiKey'], ['basic']], - }: { - body: User - path: { userId: string } - headers?: { ['Idempotency-Key']?: string } - auth?: string[][] | string[] - }) { - this.validateRequestBody(User, body) + }: { body: User; path: { userId: string }; headers?: { 'Idempotency-Key'?: string }; auth?: string[][] | string[] }): Promise< + | FailureResponse<'102', unknown, 'response:statuscode'> + | SuccessResponse<'200', User> + | 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, + 'response:statuscode', + IncomingHttpHeaders + > + > { + const _body = this.validateRequestBody(User, body) + if ('left' in _body) { + return Promise.resolve(_body) + } return this.awaitResponse( this.buildClient(auth).put(`users/${path.userId}`, { @@ -207,51 +289,72 @@ export class MambuUsers { responseType: 'json', }), { - 102: { is: (_x: unknown): _x is unknown => true }, + 102: { parse: (x: unknown) => ({ right: x }) }, 200: User, 400: ErrorResponse, 401: ErrorResponse, 403: ErrorResponse, 404: ErrorResponse, - } - ) + }, + ) as ReturnType } - public validateRequestBody(schema: { is: (o: unknown) => o is T; assert: (o: unknown) => void }, body: T) { - schema.assert(body) - return body + 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< - T, - S extends Record o is T; validate?: ValidateFunction }>, - >(response: CancelableRequest>, schemas: S) { - type FilterStartingWith = S extends number | string - ? `${S}` extends `${T}${infer _X}` - ? S - : never - : never - type InferSchemaType = T extends { is: (o: unknown) => o is infer S } ? S : never + I, + S extends Record { left: DefinedError[] } | { right: unknown } } | undefined>, + >(response: CancelableRequest>, schemas: S) { const result = await response + const status = + result.statusCode < 200 + ? 'informational' + : result.statusCode < 300 + ? 'success' + : result.statusCode < 400 + ? 'redirection' + : result.statusCode < 500 + ? 'client-error' + : 'server-error' const validator = schemas[result.statusCode] ?? schemas.default - if (validator?.is(result.body) === false || result.statusCode < 200 || result.statusCode >= 300) { + const body = validator?.parse?.(result.body) + if (result.statusCode < 200 || result.statusCode >= 300) { return { - statusCode: result.statusCode, + statusCode: result.statusCode.toString(), + status, headers: result.headers, - left: result.body, - validationErrors: validator?.validate?.errors ?? undefined, - } as { - statusCode: number - headers: IncomingHttpHeaders - left: InferSchemaType - validationErrors?: ErrorObject[] + left: body !== undefined && 'right' in body ? body.right : result.body, + validationErrors: body !== undefined && 'left' in body ? body.left : undefined, + where: 'response:statuscode', } } - return { statusCode: result.statusCode, headers: result.headers, right: result.body } as { - statusCode: number - headers: IncomingHttpHeaders - right: InferSchemaType>]> + if (body === undefined || 'left' in body) { + return { + statusCode: result.statusCode.toString(), + status, + headers: result.headers, + left: result.body, + validationErrors: body?.left, + where: 'response:body', + } } + return { statusCode: result.statusCode.toString(), status, headers: result.headers, right: result.body } } protected buildBasicClient(client: Got) { @@ -278,24 +381,52 @@ export class MambuUsers { async (options) => { const apiKey = this.auth.apiKey const key = typeof apiKey === 'function' ? await apiKey() : apiKey - options.headers['apiKey'] = key + options.headers.apiKey = key }, ], }, }) } - protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client: Got = this.client): Got { + protected buildClient(auths: string[][] | string[] | undefined = this.defaultAuth, client?: Got): Got { const auth = (auths ?? [...this.availableAuth]) .map((auth) => (Array.isArray(auth) ? auth : [auth])) .filter((auth) => auth.every((a) => this.availableAuth.has(a))) + let chosenClient = client ?? this.client for (const chosen of auth[0] ?? []) { if (chosen === 'basic') { - client = this.buildBasicClient(client) + chosenClient = this.buildBasicClient(chosenClient) } else if (chosen === 'apiKey') { - client = this.buildApiKeyClient(client) + chosenClient = this.buildApiKeyClient(chosenClient) } } - return client + return chosenClient } } + +export type Status = Major extends string + ? Major extends `1${number}` + ? 'informational' + : Major extends `2${number}` + ? 'success' + : Major extends `3${number}` + ? 'redirection' + : Major extends `4${number}` + ? 'client-error' + : 'server-error' + : undefined +export interface SuccessResponse { + statusCode: StatusCode + status: Status + headers: IncomingHttpHeaders + right: T +} +export interface FailureResponse { + statusCode: StatusCode + status: Status + headers: Headers + validationErrors: DefinedError[] | undefined + left: T + where: Where +} +export type StatusCode = `${Major}${number}` diff --git a/src/users/rest.type.ts b/src/users/rest.type.ts index fd6539e..31cfb3b 100644 --- a/src/users/rest.type.ts +++ b/src/users/rest.type.ts @@ -3,15 +3,21 @@ * Do not manually touch this */ /* eslint-disable */ -import type { ValidateFunction } from 'ajv' -import { ValidationError } from 'ajv' + +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' export interface ErrorResponse { - errors?: RestError[] + errors?: RestError[] | undefined } export const ErrorResponse = { - validate: (await import('./schemas/error-response.schema.js')).validate as ValidateFunction, + validate: ErrorResponseValidator as ValidateFunction, get schema() { return ErrorResponse.validate.schema }, @@ -19,17 +25,18 @@ export const ErrorResponse = { return ErrorResponse.validate.errors ?? undefined }, is: (o: unknown): o is ErrorResponse => ErrorResponse.validate(o) === true, - assert: (o: unknown) => { - if (!ErrorResponse.validate(o)) { - throw new ValidationError(ErrorResponse.errors ?? []) + parse: (o: unknown): { right: ErrorResponse } | { left: DefinedError[] } => { + if (ErrorResponse.is(o)) { + return { right: o } } + return { left: (ErrorResponse.errors ?? []) as DefinedError[] } }, } as const export type GetAllResponse = User[] export const GetAllResponse = { - validate: (await import('./schemas/get-all-response.schema.js')).validate as ValidateFunction, + validate: GetAllResponseValidator as ValidateFunction, get schema() { return GetAllResponse.validate.schema }, @@ -37,9 +44,56 @@ export const GetAllResponse = { return GetAllResponse.validate.errors ?? undefined }, is: (o: unknown): o is GetAllResponse => GetAllResponse.validate(o) === true, + parse: (o: unknown): { right: GetAllResponse } | { left: DefinedError[] } => { + if (GetAllResponse.is(o)) { + return { right: o } + } + return { left: (GetAllResponse.errors ?? []) as DefinedError[] } + }, +} as const + +/** + * A single change that needs to be made to a resource + */ +export interface PatchOperation { + /** + * The field from where a value should be moved, when using move + */ + from?: string | undefined + /** + * The change to perform + */ + op: 'ADD' | 'REPLACE' | 'REMOVE' | 'MOVE' + /** + * The field to perform the operation on + */ + path: string + /** + * The value of the field, can be null + */ + value?: unknown +} + +export type PatchRequest = PatchOperation[] + +export const PatchRequest = { + validate: PatchRequestValidator as ValidateFunction, + get schema() { + return PatchRequest.validate.schema + }, + get errors() { + return PatchRequest.validate.errors ?? undefined + }, + is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, + parse: (o: unknown): { right: PatchRequest } | { left: DefinedError[] } => { + if (PatchRequest.is(o)) { + return { right: o } + } + return { left: (PatchRequest.errors ?? []) as DefinedError[] } + }, } as const -type Local0 = +type Permissions = | 'AUDIT_TRANSACTIONS' | 'VIEW_COMMENTS' | 'CREATE_COMMENTS' @@ -328,52 +382,10 @@ type Local0 = | 'VIEW_PROFIT_SHARING_BRANCHES' | 'MAKE_BULK_CHANGE_INTEREST_AVAILABILITY' -/** - * A single change that needs to be made to a resource - */ -export interface PatchOperation { - /** - * The field from where a value should be moved, when using move - */ - from?: string - /** - * The change to perform - */ - op: 'ADD' | 'REPLACE' | 'REMOVE' | 'MOVE' - /** - * The field to perform the operation on - */ - path: string - /** - * The value of the field, can be null - */ - value?: { - [k: string]: unknown | undefined - } -} - -export type PatchRequest = PatchOperation[] - -export const PatchRequest = { - validate: (await import('./schemas/patch-request.schema.js')).validate as ValidateFunction, - get schema() { - return PatchRequest.validate.schema - }, - get errors() { - return PatchRequest.validate.errors ?? undefined - }, - is: (o: unknown): o is PatchRequest => PatchRequest.validate(o) === true, - assert: (o: unknown) => { - if (!PatchRequest.validate(o)) { - throw new ValidationError(PatchRequest.errors ?? []) - } - }, -} as const - export interface RestError { - errorCode?: number - errorReason?: string - errorSource?: string + errorCode?: number | undefined + errorReason?: string | undefined + errorSource?: string | undefined } /** @@ -383,11 +395,11 @@ export interface RoleIdentifier { /** * The encoded key of the entity, generated automatically, globally unique. */ - encodedKey?: string + encodedKey?: string | undefined /** * The ID of the role, which can be generated and customized, but must be unique. */ - id?: string + id?: string | undefined } /** @@ -398,19 +410,19 @@ export interface User { /** * The encoded key of the branch this user is assigned to. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * The date the user was created in UTC. */ - creationDate?: string + creationDate?: string | undefined /** * The user email address. Used by Mambu for sending automated notifications or for getting passwords. */ - email?: string + email?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The first name of the user. */ @@ -418,11 +430,11 @@ export interface User { /** * The user's home phone number, which can also contain characters. */ - homePhone?: string + homePhone?: string | undefined /** * The ID of the user, which is generated automatically, but must be unique. */ - id?: string + id?: string | undefined /** * 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`. */ @@ -444,41 +456,44 @@ export interface User { | 'THAI' | 'NORWEGIAN' | 'PHRASE' + | undefined /** * The last time the user logged in in UTC. */ - lastLoggedInDate?: string + lastLoggedInDate?: string | undefined /** * The last time the user was modified in UTC. */ - lastModifiedDate?: string + lastModifiedDate?: string | undefined /** * The last name of the user. */ - lastName?: string + lastName?: string | undefined /** * The user's mobile phone number, which can also contain characters. */ - mobilePhone?: string + mobilePhone?: string | undefined /** * The additional information for the user. */ - notes?: string - role?: RoleIdentifier + notes?: string | undefined + role?: RoleIdentifier | undefined /** * The user title. */ - title?: string + title?: string | undefined /** * The user transaction limits. */ - transactionLimits?: { - [k: string]: number - } + transactionLimits?: + | { + [k: string]: number | undefined + } + | undefined /** * `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. */ - twoFactorAuthentication?: boolean + twoFactorAuthentication?: boolean | undefined /** * The Mambu login user name. */ @@ -486,11 +501,11 @@ export interface User { /** * The current state of the user. */ - userState?: 'ACTIVE' | 'INACTIVE' | 'LOCKED' + userState?: 'ACTIVE' | 'INACTIVE' | 'LOCKED' | undefined } export const User = { - validate: (await import('./schemas/user.schema.js')).validate as ValidateFunction, + validate: UserValidator as ValidateFunction, get schema() { return User.validate.schema }, @@ -498,10 +513,11 @@ export const User = { return User.validate.errors ?? undefined }, is: (o: unknown): o is User => User.validate(o) === true, - assert: (o: unknown) => { - if (!User.validate(o)) { - throw new ValidationError(User.errors ?? []) + parse: (o: unknown): { right: User } | { left: DefinedError[] } => { + if (User.is(o)) { + return { right: o } } + return { left: (User.errors ?? []) as DefinedError[] } }, } as const @@ -513,15 +529,15 @@ export interface UserRequest { /** * The encoded key of the branch this user is assigned to. */ - assignedBranchKey?: string + assignedBranchKey?: string | undefined /** * The user email address. Used by Mambu for sending automated notifications or for getting passwords. */ - email?: string + email?: string | undefined /** * The encoded key of the entity, generated, globally unique */ - encodedKey?: string + encodedKey?: string | undefined /** * The first name of the user. */ @@ -529,7 +545,7 @@ export interface UserRequest { /** * The user's home phone number, which can also contain characters. */ - homePhone?: string + homePhone?: string | undefined /** * 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`. */ @@ -551,37 +567,40 @@ export interface UserRequest { | 'THAI' | 'NORWEGIAN' | 'PHRASE' + | undefined /** * The last name of the user. */ - lastName?: string + lastName?: string | undefined /** * The user's mobile phone number, which can also contain characters. */ - mobilePhone?: string + mobilePhone?: string | undefined /** * The additional information for the user. */ - notes?: string + notes?: string | undefined /** * Password used by the user */ password: string - role?: RoleIdentifier + role?: RoleIdentifier | undefined /** * The user title. */ - title?: string + title?: string | undefined /** * The user transaction limits. */ - transactionLimits?: { - [k: string]: number - } + transactionLimits?: + | { + [k: string]: number | undefined + } + | undefined /** * `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. */ - twoFactorAuthentication?: boolean + twoFactorAuthentication?: boolean | undefined /** * The Mambu login user name. */ @@ -589,7 +608,7 @@ export interface UserRequest { } export const UserRequest = { - validate: (await import('./schemas/user_request.schema.js')).validate as ValidateFunction, + validate: UserRequestValidator as ValidateFunction, get schema() { return UserRequest.validate.schema }, @@ -597,10 +616,11 @@ export const UserRequest = { return UserRequest.validate.errors ?? undefined }, is: (o: unknown): o is UserRequest => UserRequest.validate(o) === true, - assert: (o: unknown) => { - if (!UserRequest.validate(o)) { - throw new ValidationError(UserRequest.errors ?? []) + parse: (o: unknown): { right: UserRequest } | { left: DefinedError[] } => { + if (UserRequest.is(o)) { + return { right: o } } + return { left: (UserRequest.errors ?? []) as DefinedError[] } }, } as const @@ -611,11 +631,11 @@ export interface UserAccess { /** * `TRUE` if the user has the administrator user type, `FALSE` otherwise. Administrators (admins) have all permissions and can perform any action in Mambu. */ - administratorAccess?: boolean + administratorAccess?: boolean | undefined /** * `TRUE` if the user can authenticate and interact with Mambu APIs, `FALSE` otherwise. The user may still require additional permissions for specific API requests. */ - apiAccess?: boolean + apiAccess?: boolean | undefined /** * `TRUE` if the user has access to all branches, `FALSE` if the user only has access to specific branches. */ @@ -627,31 +647,31 @@ export interface UserAccess { /** * `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. */ - creditOfficerAccess?: boolean + creditOfficerAccess?: boolean | undefined /** * `TRUE` if the user is part of the Mambu delivery team, `FALSE` otherwise. */ - deliveryAccess?: boolean + deliveryAccess?: boolean | undefined /** * TRUE` if the user can log in to the Mambu UI using their login credentials, `FALSE` otherwise. */ - mambuAccess?: boolean + mambuAccess?: boolean | undefined /** * 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. */ - managedBranches?: UserManagedBranch[] + managedBranches?: UserManagedBranch[] | undefined /** * 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. */ - permissions?: Local0[] + permissions?: Permissions[] | undefined /** * `TRUE` if the user can provide Mambu technical support, `FALSE` otherwise. */ - supportAccess?: boolean + supportAccess?: boolean | undefined /** * `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. */ - tellerAccess?: boolean + tellerAccess?: boolean | undefined } /** @@ -661,5 +681,5 @@ export interface UserManagedBranch { /** * The encoded key of the branch, it is automatically generated. */ - branchKey?: string + branchKey?: string | undefined } diff --git a/src/users/schemas/error-response.schema.js b/src/users/schemas/error-response.schema.js index 328238a..02523d4 100644 --- a/src/users/schemas/error-response.schema.js +++ b/src/users/schemas/error-response.schema.js @@ -1,5 +1,8 @@ +/* eslint-disable */ +// @ts-nocheck /** - * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code - * eslint-disable + * Generated by Ajv https://ajv.js.org/guide/managing-schemas.html#standalone-validation-code */ -"use strict";export const validate = validate10;export default validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"ErrorResponse","type":"object","properties":{"errors":{"type":"array","title":"errors","items":{"$ref":"#/$defs/RestErroraf30"}}},"additionalProperties":true,"$defs":{"RestErroraf30":{"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"additionalProperties":true}}};const schema12 = {"type":"object","title":"RestErroraf30","properties":{"errorCode":{"type":"integer","title":"errorCode"},"errorReason":{"type":"string","title":"errorReason"},"errorSource":{"type":"string","title":"errorSource"}},"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.errors !== undefined){let data0 = data.errors;const _errs2 = errors;if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0