From 418be520200792824c83138b41008b7dbe2e86d3 Mon Sep 17 00:00:00 2001 From: Daniel Brenot Date: Thu, 26 Jan 2023 14:15:59 -0500 Subject: [PATCH 1/5] Renamed files to .ts and initial project configuration --- .gitignore | 1 + loginradius-sdk/package-lock.json | 1668 +++++++++++++++++ loginradius-sdk/package.json | 18 +- .../api/account/accountApi.ts} | 0 .../roleApi.js => src/api/account/roleApi.ts} | 0 .../sottApi.js => src/api/account/sottApi.ts} | 0 .../api/advanced/configurationApi.ts} | 0 .../api/advanced/consentManagementApi.ts} | 0 .../api/advanced/customObjectApi.ts} | 0 .../advanced/multiFactorAuthenticationApi.ts} | 0 .../api/advanced/reAuthenticationApi.ts} | 0 .../api/advanced/webHookApi.ts} | 0 .../api/authentication/authenticationApi.ts} | 0 .../api/authentication/oneTouchLoginApi.ts} | 0 .../authentication/passwordLessLoginApi.ts} | 0 .../authentication/phoneAuthenticationApi.ts} | 0 .../authentication/pinAuthenticationApi.ts} | 0 .../riskBasedAuthenticationApi.ts} | 0 .../api/authentication/smartLoginApi.ts} | 0 .../api/social/nativeSocialApi.ts} | 0 .../api/social/socialApi.ts} | 0 .../util/helper.js => src/util/helper.ts} | 0 .../{sdk/util/lr.js => src/util/lr.ts} | 0 .../{sdk/util/sott.js => src/util/sott.ts} | 0 loginradius-sdk/tsconfig.json | 103 + 25 files changed, 1787 insertions(+), 3 deletions(-) create mode 100644 loginradius-sdk/package-lock.json rename loginradius-sdk/{sdk/api/account/accountApi.js => src/api/account/accountApi.ts} (100%) rename loginradius-sdk/{sdk/api/account/roleApi.js => src/api/account/roleApi.ts} (100%) rename loginradius-sdk/{sdk/api/account/sottApi.js => src/api/account/sottApi.ts} (100%) rename loginradius-sdk/{sdk/api/advanced/configurationApi.js => src/api/advanced/configurationApi.ts} (100%) rename loginradius-sdk/{sdk/api/advanced/consentManagementApi.js => src/api/advanced/consentManagementApi.ts} (100%) rename loginradius-sdk/{sdk/api/advanced/customObjectApi.js => src/api/advanced/customObjectApi.ts} (100%) rename loginradius-sdk/{sdk/api/advanced/multiFactorAuthenticationApi.js => src/api/advanced/multiFactorAuthenticationApi.ts} (100%) rename loginradius-sdk/{sdk/api/advanced/reAuthenticationApi.js => src/api/advanced/reAuthenticationApi.ts} (100%) rename loginradius-sdk/{sdk/api/advanced/webHookApi.js => src/api/advanced/webHookApi.ts} (100%) rename loginradius-sdk/{sdk/api/authentication/authenticationApi.js => src/api/authentication/authenticationApi.ts} (100%) rename loginradius-sdk/{sdk/api/authentication/oneTouchLoginApi.js => src/api/authentication/oneTouchLoginApi.ts} (100%) rename loginradius-sdk/{sdk/api/authentication/passwordLessLoginApi.js => src/api/authentication/passwordLessLoginApi.ts} (100%) rename loginradius-sdk/{sdk/api/authentication/phoneAuthenticationApi.js => src/api/authentication/phoneAuthenticationApi.ts} (100%) rename loginradius-sdk/{sdk/api/authentication/pinAuthenticationApi.js => src/api/authentication/pinAuthenticationApi.ts} (100%) rename loginradius-sdk/{sdk/api/authentication/riskBasedAuthenticationApi.js => src/api/authentication/riskBasedAuthenticationApi.ts} (100%) rename loginradius-sdk/{sdk/api/authentication/smartLoginApi.js => src/api/authentication/smartLoginApi.ts} (100%) rename loginradius-sdk/{sdk/api/social/nativeSocialApi.js => src/api/social/nativeSocialApi.ts} (100%) rename loginradius-sdk/{sdk/api/social/socialApi.js => src/api/social/socialApi.ts} (100%) rename loginradius-sdk/{sdk/util/helper.js => src/util/helper.ts} (100%) rename loginradius-sdk/{sdk/util/lr.js => src/util/lr.ts} (100%) rename loginradius-sdk/{sdk/util/sott.js => src/util/sott.ts} (100%) create mode 100644 loginradius-sdk/tsconfig.json diff --git a/.gitignore b/.gitignore index 3363920..6f9b769 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ prepros.cfg /demo/node_modules demo/node_modules +/loginradius-sdk/node_modules /nbproject/private/ nbproject/project.properties nbproject/project.xml diff --git a/loginradius-sdk/package-lock.json b/loginradius-sdk/package-lock.json new file mode 100644 index 0000000..37c4ddf --- /dev/null +++ b/loginradius-sdk/package-lock.json @@ -0,0 +1,1668 @@ +{ + "name": "loginradius-sdk", + "version": "11.5.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "loginradius-sdk", + "version": "11.5.0", + "dependencies": { + "eslint": "^8.29.0", + "prettier": "^2.8.1" + }, + "devDependencies": { + "typescript": "^4.9.4" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "1.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.4.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" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.8", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "engines": { + "node": ">=12.22" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "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" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint": { + "version": "8.32.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint/-/eslint-8.32.0.tgz", + "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==", + "dependencies": { + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "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.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.4.0", + "esquery": "^1.4.0", + "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", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "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.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/espree": { + "version": "9.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "dependencies": { + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "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_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.19.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/globals/-/globals-13.19.0.tgz", + "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/js-sdsl": { + "version": "4.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==" + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "2.8.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/prettier/-/prettier-2.8.3.tgz", + "integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/typescript": { + "version": "4.9.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "engines": { + "node": ">=10" + } + } + }, + "dependencies": { + "@eslint/eslintrc": { + "version": "1.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.4.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" + } + }, + "@humanwhocodes/config-array": { + "version": "0.11.8", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + } + }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==" + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "acorn": { + "version": "8.8.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==" + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "requires": {} + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "requires": { + "esutils": "^2.0.2" + } + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" + }, + "eslint": { + "version": "8.32.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint/-/eslint-8.32.0.tgz", + "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==", + "requires": { + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "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.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.4.0", + "esquery": "^1.4.0", + "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", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "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.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + } + }, + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "requires": { + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==" + } + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==" + }, + "espree": { + "version": "9.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "requires": { + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + } + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "requires": { + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + }, + "fastq": { + "version": "1.15.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "requires": { + "flat-cache": "^3.0.4" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.7", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "glob": { + "version": "7.2.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "requires": { + "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" + } + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "requires": { + "is-glob": "^4.0.3" + } + }, + "globals": { + "version": "13.19.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/globals/-/globals-13.19.0.tgz", + "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", + "requires": { + "type-fest": "^0.20.2" + } + }, + "grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "ignore": { + "version": "5.2.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==" + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "js-sdsl": { + "version": "4.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==" + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "requires": { + "argparse": "^2.0.1" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==" + }, + "levn": { + "version": "0.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "requires": { + "p-locate": "^5.0.0" + } + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "requires": { + "p-limit": "^3.0.2" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "requires": { + "callsites": "^3.0.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" + }, + "prettier": { + "version": "2.8.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/prettier/-/prettier-2.8.3.tgz", + "integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==" + }, + "punycode": { + "version": "2.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==" + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "requires": { + "glob": "^7.1.3" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==" + }, + "typescript": { + "version": "4.9.4", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "dev": true + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "requires": { + "punycode": "^2.1.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" + } + } +} diff --git a/loginradius-sdk/package.json b/loginradius-sdk/package.json index 11302db..60d7cc7 100644 --- a/loginradius-sdk/package.json +++ b/loginradius-sdk/package.json @@ -1,14 +1,23 @@ { "name": "loginradius-sdk", "readme": "", + "sideEffects": false, "scripts": { "lint": "prettier --check sdk/**/*.js && eslint sdk/**/*.js", - "lint:fix": "prettier --write sdk/**/*.js && eslint sdk/**/*.js --fix" + "lint:fix": "prettier --write sdk/**/*.js && eslint sdk/**/*.js --fix", + "clean": "npx rimraf ./lib", + "build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:declarations", + "build:esm": "tsc --outDir lib/esm --module ES6 --declaration false", + "build:cjs": "tsc --outDir lib/cjs --module commonjs --declaration false", + "build:declarations": "tsc --declaration --emitDeclarationOnly", + "prepublishOnly": "npm run-script build" }, "version": "11.5.0", "description": "A LoginRadius SDK for node.js", "homepage": "https://www.loginradius.com", - "main": "./sdk/util/lr.js", + "main": "./lib/cjs/util/lr.js", + "module": "./lib/esm/util/lr.js", + "types": "lib/types/util/lr.d.ts", "repository": { "type": "git", "url": "", @@ -30,5 +39,8 @@ "dependencies": { "eslint": "^8.29.0", "prettier": "^2.8.1" + }, + "devDependencies": { + "typescript": "^4.9.4" } -} \ No newline at end of file +} diff --git a/loginradius-sdk/sdk/api/account/accountApi.js b/loginradius-sdk/src/api/account/accountApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/account/accountApi.js rename to loginradius-sdk/src/api/account/accountApi.ts diff --git a/loginradius-sdk/sdk/api/account/roleApi.js b/loginradius-sdk/src/api/account/roleApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/account/roleApi.js rename to loginradius-sdk/src/api/account/roleApi.ts diff --git a/loginradius-sdk/sdk/api/account/sottApi.js b/loginradius-sdk/src/api/account/sottApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/account/sottApi.js rename to loginradius-sdk/src/api/account/sottApi.ts diff --git a/loginradius-sdk/sdk/api/advanced/configurationApi.js b/loginradius-sdk/src/api/advanced/configurationApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/advanced/configurationApi.js rename to loginradius-sdk/src/api/advanced/configurationApi.ts diff --git a/loginradius-sdk/sdk/api/advanced/consentManagementApi.js b/loginradius-sdk/src/api/advanced/consentManagementApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/advanced/consentManagementApi.js rename to loginradius-sdk/src/api/advanced/consentManagementApi.ts diff --git a/loginradius-sdk/sdk/api/advanced/customObjectApi.js b/loginradius-sdk/src/api/advanced/customObjectApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/advanced/customObjectApi.js rename to loginradius-sdk/src/api/advanced/customObjectApi.ts diff --git a/loginradius-sdk/sdk/api/advanced/multiFactorAuthenticationApi.js b/loginradius-sdk/src/api/advanced/multiFactorAuthenticationApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/advanced/multiFactorAuthenticationApi.js rename to loginradius-sdk/src/api/advanced/multiFactorAuthenticationApi.ts diff --git a/loginradius-sdk/sdk/api/advanced/reAuthenticationApi.js b/loginradius-sdk/src/api/advanced/reAuthenticationApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/advanced/reAuthenticationApi.js rename to loginradius-sdk/src/api/advanced/reAuthenticationApi.ts diff --git a/loginradius-sdk/sdk/api/advanced/webHookApi.js b/loginradius-sdk/src/api/advanced/webHookApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/advanced/webHookApi.js rename to loginradius-sdk/src/api/advanced/webHookApi.ts diff --git a/loginradius-sdk/sdk/api/authentication/authenticationApi.js b/loginradius-sdk/src/api/authentication/authenticationApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/authentication/authenticationApi.js rename to loginradius-sdk/src/api/authentication/authenticationApi.ts diff --git a/loginradius-sdk/sdk/api/authentication/oneTouchLoginApi.js b/loginradius-sdk/src/api/authentication/oneTouchLoginApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/authentication/oneTouchLoginApi.js rename to loginradius-sdk/src/api/authentication/oneTouchLoginApi.ts diff --git a/loginradius-sdk/sdk/api/authentication/passwordLessLoginApi.js b/loginradius-sdk/src/api/authentication/passwordLessLoginApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/authentication/passwordLessLoginApi.js rename to loginradius-sdk/src/api/authentication/passwordLessLoginApi.ts diff --git a/loginradius-sdk/sdk/api/authentication/phoneAuthenticationApi.js b/loginradius-sdk/src/api/authentication/phoneAuthenticationApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/authentication/phoneAuthenticationApi.js rename to loginradius-sdk/src/api/authentication/phoneAuthenticationApi.ts diff --git a/loginradius-sdk/sdk/api/authentication/pinAuthenticationApi.js b/loginradius-sdk/src/api/authentication/pinAuthenticationApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/authentication/pinAuthenticationApi.js rename to loginradius-sdk/src/api/authentication/pinAuthenticationApi.ts diff --git a/loginradius-sdk/sdk/api/authentication/riskBasedAuthenticationApi.js b/loginradius-sdk/src/api/authentication/riskBasedAuthenticationApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/authentication/riskBasedAuthenticationApi.js rename to loginradius-sdk/src/api/authentication/riskBasedAuthenticationApi.ts diff --git a/loginradius-sdk/sdk/api/authentication/smartLoginApi.js b/loginradius-sdk/src/api/authentication/smartLoginApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/authentication/smartLoginApi.js rename to loginradius-sdk/src/api/authentication/smartLoginApi.ts diff --git a/loginradius-sdk/sdk/api/social/nativeSocialApi.js b/loginradius-sdk/src/api/social/nativeSocialApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/social/nativeSocialApi.js rename to loginradius-sdk/src/api/social/nativeSocialApi.ts diff --git a/loginradius-sdk/sdk/api/social/socialApi.js b/loginradius-sdk/src/api/social/socialApi.ts similarity index 100% rename from loginradius-sdk/sdk/api/social/socialApi.js rename to loginradius-sdk/src/api/social/socialApi.ts diff --git a/loginradius-sdk/sdk/util/helper.js b/loginradius-sdk/src/util/helper.ts similarity index 100% rename from loginradius-sdk/sdk/util/helper.js rename to loginradius-sdk/src/util/helper.ts diff --git a/loginradius-sdk/sdk/util/lr.js b/loginradius-sdk/src/util/lr.ts similarity index 100% rename from loginradius-sdk/sdk/util/lr.js rename to loginradius-sdk/src/util/lr.ts diff --git a/loginradius-sdk/sdk/util/sott.js b/loginradius-sdk/src/util/sott.ts similarity index 100% rename from loginradius-sdk/sdk/util/sott.js rename to loginradius-sdk/src/util/sott.ts diff --git a/loginradius-sdk/tsconfig.json b/loginradius-sdk/tsconfig.json new file mode 100644 index 0000000..75dcaea --- /dev/null +++ b/loginradius-sdk/tsconfig.json @@ -0,0 +1,103 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} From 137daed707aaa8c04834546cc02e1317b13312a7 Mon Sep 17 00:00:00 2001 From: Daniel Brenot Date: Fri, 27 Jan 2023 00:20:51 -0500 Subject: [PATCH 2/5] Rewrote api files in typescript --- .gitignore | 1 + loginradius-sdk/.eslintrc | 12 +- loginradius-sdk/.prettierrc | 4 + loginradius-sdk/package-lock.json | 806 ++++++++++++++++- loginradius-sdk/package.json | 15 +- loginradius-sdk/src/api/account/accountApi.ts | 505 +++++------ loginradius-sdk/src/api/account/roleApi.ts | 310 +++---- loginradius-sdk/src/api/account/sottApi.ts | 36 +- .../src/api/advanced/configurationApi.ts | 32 +- .../src/api/advanced/consentManagementApi.ts | 137 ++- .../src/api/advanced/customObjectApi.ts | 277 +++--- .../advanced/multiFactorAuthenticationApi.ts | 761 ++++++++-------- .../src/api/advanced/reAuthenticationApi.ts | 297 +++---- .../src/api/advanced/webHookApi.ts | 87 +- .../api/authentication/authenticationApi.ts | 840 +++++++++--------- .../api/authentication/oneTouchLoginApi.ts | 137 ++- .../authentication/passwordLessLoginApi.ts | 153 ++-- .../authentication/phoneAuthenticationApi.ts | 281 +++--- .../authentication/pinAuthenticationApi.ts | 286 +++--- .../riskBasedAuthenticationApi.ts | 165 ++-- .../src/api/authentication/smartLoginApi.ts | 103 ++- .../src/api/social/nativeSocialApi.ts | 180 ++-- loginradius-sdk/src/api/social/socialApi.ts | 131 ++- loginradius-sdk/src/types.ts | 14 + loginradius-sdk/src/util/helper.ts | 426 +++++---- loginradius-sdk/src/util/lr.ts | 314 +------ loginradius-sdk/src/util/sott.ts | 22 +- loginradius-sdk/tsconfig.json | 7 +- 28 files changed, 3471 insertions(+), 2868 deletions(-) create mode 100644 loginradius-sdk/.prettierrc create mode 100644 loginradius-sdk/src/types.ts diff --git a/.gitignore b/.gitignore index 6f9b769..c0d46f5 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ prepros.cfg /demo/node_modules demo/node_modules /loginradius-sdk/node_modules +/loginradius-sdk/lib /nbproject/private/ nbproject/project.properties nbproject/project.xml diff --git a/loginradius-sdk/.eslintrc b/loginradius-sdk/.eslintrc index c3cb901..eb8c57e 100644 --- a/loginradius-sdk/.eslintrc +++ b/loginradius-sdk/.eslintrc @@ -5,7 +5,15 @@ "es6": true, "node": true }, - "extends": "eslint:recommended", + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint", "prettier"], + "extends": [ + "plugin:@typescript-eslint/recommended", + "eslint:recommended" + ], + "ignorePatterns": [ + "lib" + ], "globals": { "Atomics": "readonly", "SharedArrayBuffer": "readonly" @@ -14,6 +22,7 @@ "ecmaVersion": 2018 }, "rules": { + "@typescript-eslint/no-explicit-any": 0, "accessor-pairs": "error", "array-bracket-newline": "error", "array-bracket-spacing": "error", @@ -218,6 +227,7 @@ "no-unused-vars": "warn", "no-use-before-define": "off", "no-useless-call": "error", + "no-useless-catch": "off", "no-useless-computed-key": "error", "no-useless-concat": "error", "no-useless-constructor": "error", diff --git a/loginradius-sdk/.prettierrc b/loginradius-sdk/.prettierrc new file mode 100644 index 0000000..29ed0c4 --- /dev/null +++ b/loginradius-sdk/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "trailingComma": "none" +} \ No newline at end of file diff --git a/loginradius-sdk/package-lock.json b/loginradius-sdk/package-lock.json index 37c4ddf..2cc90c9 100644 --- a/loginradius-sdk/package-lock.json +++ b/loginradius-sdk/package-lock.json @@ -1,17 +1,21 @@ { "name": "loginradius-sdk", - "version": "11.5.0", + "version": "12.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "loginradius-sdk", - "version": "11.5.0", + "version": "12.0.0", "dependencies": { "eslint": "^8.29.0", "prettier": "^2.8.1" }, "devDependencies": { + "@types/node": "^18.11.18", + "@typescript-eslint/eslint-plugin": "^5.49.0", + "eslint-config-prettier": "^8.6.0", + "eslint-plugin-prettier": "^4.2.1", "typescript": "^4.9.4" } }, @@ -92,6 +96,202 @@ "node": ">= 8" } }, + "node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "node_modules/@types/node": { + "version": "18.11.18", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@types/node/-/node-18.11.18.tgz", + "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", + "dev": true + }, + "node_modules/@types/semver": { + "version": "7.3.13", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.49.0.tgz", + "integrity": "sha512-IhxabIpcf++TBaBa1h7jtOWyon80SXPRLDq0dVz5SLFC/eW6tofkw/O7Ar3lkx5z5U6wzbKDrl2larprp5kk5Q==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.49.0", + "@typescript-eslint/type-utils": "5.49.0", + "@typescript-eslint/utils": "5.49.0", + "debug": "^4.3.4", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/parser/-/parser-5.49.0.tgz", + "integrity": "sha512-veDlZN9mUhGqU31Qiv2qEp+XrJj5fgZpJ8PW30sHU+j/8/e5ruAhLaVDAeznS7A7i4ucb/s8IozpDtt9NqCkZg==", + "dev": true, + "peer": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.49.0", + "@typescript-eslint/types": "5.49.0", + "@typescript-eslint/typescript-estree": "5.49.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/scope-manager/-/scope-manager-5.49.0.tgz", + "integrity": "sha512-clpROBOiMIzpbWNxCe1xDK14uPZh35u4QaZO1GddilEzoCLAEz4szb51rBpdgurs5k2YzPtJeTEN3qVbG+LRUQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.49.0", + "@typescript-eslint/visitor-keys": "5.49.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/type-utils/-/type-utils-5.49.0.tgz", + "integrity": "sha512-eUgLTYq0tR0FGU5g1YHm4rt5H/+V2IPVkP0cBmbhRyEmyGe4XvJ2YJ6sYTmONfjmdMqyMLad7SB8GvblbeESZA==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "5.49.0", + "@typescript-eslint/utils": "5.49.0", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/types/-/types-5.49.0.tgz", + "integrity": "sha512-7If46kusG+sSnEpu0yOz2xFv5nRz158nzEXnJFCGVEHWnuzolXKwrH5Bsf9zsNlOQkyZuk0BZKKoJQI+1JPBBg==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/typescript-estree/-/typescript-estree-5.49.0.tgz", + "integrity": "sha512-PBdx+V7deZT/3GjNYPVQv1Nc0U46dAHbIuOG8AZ3on3vuEKiPDwFE/lG1snN2eUB9IhF7EyF7K1hmTcLztNIsA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.49.0", + "@typescript-eslint/visitor-keys": "5.49.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/utils/-/utils-5.49.0.tgz", + "integrity": "sha512-cPJue/4Si25FViIb74sHCLtM4nTSBXtLx1d3/QT6mirQ/c65bV8arBEebBJJizfq8W2YyMoPI/WWPFWitmNqnQ==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.49.0", + "@typescript-eslint/types": "5.49.0", + "@typescript-eslint/typescript-estree": "5.49.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/visitor-keys/-/visitor-keys-5.49.0.tgz", + "integrity": "sha512-v9jBMjpNWyn8B6k/Mjt6VbUS4J1GvUlR4x3Y+ibnP1z7y7V4n0WRz+50DY6+Myj0UaXVSuUlHohO+eZ8IJEnkg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.49.0", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/acorn": { "version": "8.8.2", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/acorn/-/acorn-8.8.2.tgz", @@ -146,6 +346,15 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/balanced-match/-/balanced-match-1.0.2.tgz", @@ -160,6 +369,18 @@ "concat-map": "0.0.1" } }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/callsites/-/callsites-3.1.0.tgz", @@ -235,6 +456,18 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/doctrine/-/doctrine-3.0.0.tgz", @@ -306,6 +539,39 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/eslint-config-prettier": { + "version": "8.6.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz", + "integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "4.2.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", + "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "eslint": ">=7.28.0", + "prettier": ">=2.0.0" + }, + "peerDependenciesMeta": { + "eslint-config-prettier": { + "optional": true + } + } + }, "node_modules/eslint-scope": { "version": "7.1.1", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-scope/-/eslint-scope-7.1.1.tgz", @@ -404,6 +670,40 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "node_modules/fast-diff": { + "version": "1.2.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.2.12", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "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" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -433,6 +733,18 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/find-up/-/find-up-5.0.0.tgz", @@ -505,6 +817,23 @@ "node": ">=8" } }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "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_modules/grapheme-splitter": { "version": "1.0.4", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", @@ -579,6 +908,15 @@ "node": ">=0.10.0" } }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-path-inside": { "version": "3.0.3", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/is-path-inside/-/is-path-inside-3.0.3.tgz", @@ -646,6 +984,40 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/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/merge2": { + "version": "1.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/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://pelmorex.jfrog.io/artifactory/api/npm/npm/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/minimatch": { "version": "3.1.2", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/minimatch/-/minimatch-3.1.2.tgz", @@ -667,6 +1039,12 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" }, + "node_modules/natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/once/-/once-1.4.0.tgz", @@ -748,6 +1126,24 @@ "node": ">=8" } }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -767,6 +1163,18 @@ "node": ">=10.13.0" } }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/punycode/-/punycode-2.3.0.tgz", @@ -824,6 +1232,21 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/semver": { + "version": "7.3.8", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/shebang-command/-/shebang-command-2.0.0.tgz", @@ -843,6 +1266,15 @@ "node": ">=8" } }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -878,6 +1310,39 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/type-check/-/type-check-0.4.0.tgz", @@ -945,6 +1410,12 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/yocto-queue/-/yocto-queue-0.1.0.tgz", @@ -1014,6 +1485,141 @@ "fastq": "^1.6.0" } }, + "@types/json-schema": { + "version": "7.0.11", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "@types/node": { + "version": "18.11.18", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@types/node/-/node-18.11.18.tgz", + "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", + "dev": true + }, + "@types/semver": { + "version": "7.3.13", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, + "@typescript-eslint/eslint-plugin": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.49.0.tgz", + "integrity": "sha512-IhxabIpcf++TBaBa1h7jtOWyon80SXPRLDq0dVz5SLFC/eW6tofkw/O7Ar3lkx5z5U6wzbKDrl2larprp5kk5Q==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.49.0", + "@typescript-eslint/type-utils": "5.49.0", + "@typescript-eslint/utils": "5.49.0", + "debug": "^4.3.4", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/parser": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/parser/-/parser-5.49.0.tgz", + "integrity": "sha512-veDlZN9mUhGqU31Qiv2qEp+XrJj5fgZpJ8PW30sHU+j/8/e5ruAhLaVDAeznS7A7i4ucb/s8IozpDtt9NqCkZg==", + "dev": true, + "peer": true, + "requires": { + "@typescript-eslint/scope-manager": "5.49.0", + "@typescript-eslint/types": "5.49.0", + "@typescript-eslint/typescript-estree": "5.49.0", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/scope-manager/-/scope-manager-5.49.0.tgz", + "integrity": "sha512-clpROBOiMIzpbWNxCe1xDK14uPZh35u4QaZO1GddilEzoCLAEz4szb51rBpdgurs5k2YzPtJeTEN3qVbG+LRUQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.49.0", + "@typescript-eslint/visitor-keys": "5.49.0" + } + }, + "@typescript-eslint/type-utils": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/type-utils/-/type-utils-5.49.0.tgz", + "integrity": "sha512-eUgLTYq0tR0FGU5g1YHm4rt5H/+V2IPVkP0cBmbhRyEmyGe4XvJ2YJ6sYTmONfjmdMqyMLad7SB8GvblbeESZA==", + "dev": true, + "requires": { + "@typescript-eslint/typescript-estree": "5.49.0", + "@typescript-eslint/utils": "5.49.0", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/types": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/types/-/types-5.49.0.tgz", + "integrity": "sha512-7If46kusG+sSnEpu0yOz2xFv5nRz158nzEXnJFCGVEHWnuzolXKwrH5Bsf9zsNlOQkyZuk0BZKKoJQI+1JPBBg==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/typescript-estree/-/typescript-estree-5.49.0.tgz", + "integrity": "sha512-PBdx+V7deZT/3GjNYPVQv1Nc0U46dAHbIuOG8AZ3on3vuEKiPDwFE/lG1snN2eUB9IhF7EyF7K1hmTcLztNIsA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.49.0", + "@typescript-eslint/visitor-keys": "5.49.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/utils": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/utils/-/utils-5.49.0.tgz", + "integrity": "sha512-cPJue/4Si25FViIb74sHCLtM4nTSBXtLx1d3/QT6mirQ/c65bV8arBEebBJJizfq8W2YyMoPI/WWPFWitmNqnQ==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.49.0", + "@typescript-eslint/types": "5.49.0", + "@typescript-eslint/typescript-estree": "5.49.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" + }, + "dependencies": { + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.49.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/@typescript-eslint/visitor-keys/-/visitor-keys-5.49.0.tgz", + "integrity": "sha512-v9jBMjpNWyn8B6k/Mjt6VbUS4J1GvUlR4x3Y+ibnP1z7y7V4n0WRz+50DY6+Myj0UaXVSuUlHohO+eZ8IJEnkg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.49.0", + "eslint-visitor-keys": "^3.3.0" + } + }, "acorn": { "version": "8.8.2", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/acorn/-/acorn-8.8.2.tgz", @@ -1054,6 +1660,12 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, + "array-union": { + "version": "2.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, "balanced-match": { "version": "1.0.2", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1068,6 +1680,15 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "callsites": { "version": "3.1.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/callsites/-/callsites-3.1.0.tgz", @@ -1123,6 +1744,15 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, "doctrine": { "version": "3.0.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/doctrine/-/doctrine-3.0.0.tgz", @@ -1182,6 +1812,22 @@ "text-table": "^0.2.0" } }, + "eslint-config-prettier": { + "version": "8.6.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz", + "integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==", + "dev": true, + "requires": {} + }, + "eslint-plugin-prettier": { + "version": "4.2.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", + "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", + "dev": true, + "requires": { + "prettier-linter-helpers": "^1.0.0" + } + }, "eslint-scope": { "version": "7.1.1", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/eslint-scope/-/eslint-scope-7.1.1.tgz", @@ -1252,6 +1898,36 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-diff": { + "version": "1.2.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, + "fast-glob": { + "version": "3.2.12", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "requires": { + "@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" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } + } + }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -1278,6 +1954,15 @@ "flat-cache": "^3.0.4" } }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "find-up": { "version": "5.0.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/find-up/-/find-up-5.0.0.tgz", @@ -1335,6 +2020,20 @@ "type-fest": "^0.20.2" } }, + "globby": { + "version": "11.1.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "requires": { + "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" + } + }, "grapheme-splitter": { "version": "1.0.4", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", @@ -1391,6 +2090,12 @@ "is-extglob": "^2.1.1" } }, + "is-number": { + "version": "7.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, "is-path-inside": { "version": "3.0.3", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/is-path-inside/-/is-path-inside-3.0.3.tgz", @@ -1446,6 +2151,31 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, "minimatch": { "version": "3.1.2", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/minimatch/-/minimatch-3.1.2.tgz", @@ -1464,6 +2194,12 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" }, + "natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "once": { "version": "1.4.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/once/-/once-1.4.0.tgz", @@ -1524,6 +2260,18 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, + "path-type": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -1534,6 +2282,15 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/prettier/-/prettier-2.8.3.tgz", "integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==" }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "requires": { + "fast-diff": "^1.1.2" + } + }, "punycode": { "version": "2.3.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/punycode/-/punycode-2.3.0.tgz", @@ -1575,6 +2332,15 @@ "queue-microtask": "^1.2.2" } }, + "semver": { + "version": "7.3.8", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, "shebang-command": { "version": "2.0.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/shebang-command/-/shebang-command-2.0.0.tgz", @@ -1588,6 +2354,12 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, + "slash": { + "version": "3.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, "strip-ansi": { "version": "6.0.1", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -1614,6 +2386,30 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "type-check": { "version": "0.4.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/type-check/-/type-check-0.4.0.tgz", @@ -1659,6 +2455,12 @@ "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, + "yallist": { + "version": "4.0.0", + "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "yocto-queue": { "version": "0.1.0", "resolved": "https://pelmorex.jfrog.io/artifactory/api/npm/npm/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/loginradius-sdk/package.json b/loginradius-sdk/package.json index 60d7cc7..180e749 100644 --- a/loginradius-sdk/package.json +++ b/loginradius-sdk/package.json @@ -3,8 +3,8 @@ "readme": "", "sideEffects": false, "scripts": { - "lint": "prettier --check sdk/**/*.js && eslint sdk/**/*.js", - "lint:fix": "prettier --write sdk/**/*.js && eslint sdk/**/*.js --fix", + "lint": "prettier --check src/**/*.ts && eslint src/**/*.ts", + "lint:fix": "prettier --write 'src/**/*.ts' && eslint 'src/**/*.ts' --fix", "clean": "npx rimraf ./lib", "build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:declarations", "build:esm": "tsc --outDir lib/esm --module ES6 --declaration false", @@ -12,12 +12,12 @@ "build:declarations": "tsc --declaration --emitDeclarationOnly", "prepublishOnly": "npm run-script build" }, - "version": "11.5.0", + "version": "12.0.0", "description": "A LoginRadius SDK for node.js", "homepage": "https://www.loginradius.com", "main": "./lib/cjs/util/lr.js", "module": "./lib/esm/util/lr.js", - "types": "lib/types/util/lr.d.ts", + "types": "./lib/types/util/lr.d.ts", "repository": { "type": "git", "url": "", @@ -36,11 +36,18 @@ "email": "developers@loginradius.com" } ], + "files": [ + "lib" + ], "dependencies": { "eslint": "^8.29.0", "prettier": "^2.8.1" }, "devDependencies": { + "@types/node": "^18.11.18", + "@typescript-eslint/eslint-plugin": "^5.49.0", + "eslint-config-prettier": "^8.6.0", + "eslint-plugin-prettier": "^4.2.1", "typescript": "^4.9.4" } } diff --git a/loginradius-sdk/src/api/account/accountApi.ts b/loginradius-sdk/src/api/account/accountApi.ts index d0755f5..87777a8 100644 --- a/loginradius-sdk/src/api/account/accountApi.ts +++ b/loginradius-sdk/src/api/account/accountApi.ts @@ -2,9 +2,18 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); + +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class AccountApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API is used to retrieve all of the accepted Policies by the user, associated with their UID. @@ -12,21 +21,20 @@ module.exports = function (config) { * @return Complete Policy History data *15.1.1 */ - - module.getPrivacyPolicyHistoryByUid = function (uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + getPrivacyPolicyHistoryByUid (uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/privacypolicy/history'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to create an account in Cloud Storage. This API bypass the normal email verification process and manually creates the user.

In order to use this API, you need to format a JSON request body with all of the mandatory fields @@ -35,28 +43,28 @@ module.exports = function (config) { * @return Response containing Definition for Complete profile data *18.1 */ - - module.createAccount = function (accountCreateModel, fields) { - if (helper.checkJson(accountCreateModel)) { - return Promise.reject(helper.getValidationMessage('accountCreateModel')); + createAccount (accountCreateModel, fields) { + if (checkJson(accountCreateModel)) { + return Promise.reject(getValidationMessage('accountCreateModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/manage/account'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, accountCreateModel ); - }; + } /** * This API is used to retrieve all of the profile data, associated with the specified account by email in Cloud Storage. @@ -65,24 +73,23 @@ module.exports = function (config) { * @return Response containing Definition for Complete profile data *18.2 */ - - module.getAccountProfileByEmail = function (email, fields) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + getAccountProfileByEmail (email, fields) { + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.email = email; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/manage/account'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to retrieve all of the profile data associated with the specified account by user name in Cloud Storage. @@ -91,24 +98,23 @@ module.exports = function (config) { * @return Response containing Definition for Complete profile data *18.3 */ - - module.getAccountProfileByUserName = function (userName, fields) { - if (helper.isNullOrWhiteSpace(userName)) { - return Promise.reject(helper.getValidationMessage('userName')); + getAccountProfileByUserName (userName, fields) { + if (isNullOrWhiteSpace(userName)) { + return Promise.reject(getValidationMessage('userName')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.userName = userName; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/manage/account'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to retrieve all of the profile data, associated with the account by phone number in Cloud Storage. @@ -118,23 +124,23 @@ module.exports = function (config) { *18.4 */ - module.getAccountProfileByPhone = function (phone, fields) { - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + getAccountProfileByPhone (phone, fields) { + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.phone = phone; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/manage/account'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to retrieve all of the profile data, associated with the account by uid in Cloud Storage. @@ -144,22 +150,22 @@ module.exports = function (config) { *18.5 */ - module.getAccountProfileByUid = function (uid, fields) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + getAccountProfileByUid (uid, fields) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/manage/account/' + uid; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to update the information of existing accounts in your Cloud Storage. See our Advanced API Usage section Here for more capabilities. @@ -171,25 +177,20 @@ module.exports = function (config) { *18.15 */ - module.updateAccountByUid = function ( - accountUserProfileUpdateModel, - uid, - fields, - nullSupport - ) { - if (helper.checkJson(accountUserProfileUpdateModel)) { + updateAccountByUid (accountUserProfileUpdateModel, uid, fields, nullSupport) { + if (checkJson(accountUserProfileUpdateModel)) { return Promise.reject( - helper.getValidationMessage('accountUserProfileUpdateModel') + getValidationMessage('accountUserProfileUpdateModel') ); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } if (nullSupport !== null) { @@ -198,13 +199,14 @@ module.exports = function (config) { var resourcePath = 'identity/v2/manage/account/' + uid; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, accountUserProfileUpdateModel ); - }; + } /** * This API is used to update the PhoneId by using the Uid's. Admin can update the PhoneId's for both the verified and unverified profiles. It will directly replace the PhoneId and bypass the OTP verification process. @@ -215,28 +217,34 @@ module.exports = function (config) { *18.16 */ - module.updatePhoneIDByUid = function (phone, uid, fields) { - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + updatePhoneIDByUid (phone, uid, fields) { + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.phone = phone; var resourcePath = 'identity/v2/manage/account/' + uid + '/phoneid'; - return config.request('PUT', resourcePath, queryParameters, bodyParameters); - }; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + bodyParameters + ); + } /** * This API use to retrive the hashed password of a specified account in Cloud Storage. @@ -245,19 +253,19 @@ module.exports = function (config) { *18.17 */ - module.getAccountPasswordHashByUid = function (uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + getAccountPasswordHashByUid (uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/password'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to set the password of an account in Cloud Storage. @@ -266,26 +274,31 @@ module.exports = function (config) { * @return Response containing Definition for Complete PasswordHash data *18.18 */ - - module.setAccountPasswordByUid = function (password, uid) { - if (helper.isNullOrWhiteSpace(password)) { - return Promise.reject(helper.getValidationMessage('password')); + setAccountPasswordByUid (password, uid) { + if (isNullOrWhiteSpace(password)) { + return Promise.reject(getValidationMessage('password')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.password = password; var resourcePath = 'identity/v2/manage/account/' + uid + '/password'; - return config.request('PUT', resourcePath, queryParameters, bodyParameters); - }; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + bodyParameters + ); + } /** * This API deletes the Users account and allows them to re-register for a new account. @@ -293,20 +306,19 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *18.19 */ - - module.deleteAccountByUid = function (uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + deleteAccountByUid (uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid; - return config.request('DELETE', resourcePath, queryParameters, null); - }; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } /** * This API is used to invalidate the Email Verification status on an account. @@ -317,29 +329,25 @@ module.exports = function (config) { *18.20 */ - module.invalidateAccountEmailVerification = function ( - uid, - emailTemplate, - verificationUrl - ) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + invalidateAccountEmailVerification (uid, emailTemplate, verificationUrl) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } var resourcePath = 'identity/v2/manage/account/' + uid + '/invalidateemail'; - return config.request('PUT', resourcePath, queryParameters, null); - }; + return request(this.config, 'PUT', resourcePath, queryParameters, null); + } /** * This API Returns a Forgot Password Token it can also be used to send a Forgot Password email to the customer. Note: If you have the UserName workflow enabled, you may replace the 'email' parameter with 'username' in the body. @@ -350,42 +358,37 @@ module.exports = function (config) { * @return Response containing Definition of Complete Forgot Password data *18.22 */ - - module.getForgotPasswordToken = function ( - email, - emailTemplate, - resetPasswordUrl, - sendEmail - ) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + getForgotPasswordToken (email, emailTemplate, resetPasswordUrl, sendEmail) { + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(resetPasswordUrl)) { + if (!isNullOrWhiteSpace(resetPasswordUrl)) { queryParameters.resetPasswordUrl = resetPasswordUrl; } if (sendEmail !== null) { queryParameters.sendEmail = sendEmail; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.email = email; var resourcePath = 'identity/v2/manage/account/forgot/token'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API Returns an Email Verification token. @@ -393,28 +396,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete Verification data *18.23 */ - - module.getEmailVerificationToken = function (email) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + getEmailVerificationToken (email) { + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.email = email; var resourcePath = 'identity/v2/manage/account/verify/token'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * The API is used to get LoginRadius access token based on UID. @@ -422,21 +425,20 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *18.24 */ - - module.getAccessTokenByUid = function (uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + getAccessTokenByUid (uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.uid = uid; var resourcePath = 'identity/v2/manage/account/access_token'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API Allows you to reset the phone no verification of an end user’s account. @@ -445,23 +447,22 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *18.27 */ - - module.resetPhoneIDVerificationByUid = function (uid, smsTemplate) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + resetPhoneIDVerificationByUid (uid, smsTemplate) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } var resourcePath = 'identity/v2/manage/account/' + uid + '/invalidatephone'; - return config.request('PUT', resourcePath, queryParameters, null); - }; + return request(this.config, 'PUT', resourcePath, queryParameters, null); + } /** * This API is used to add/upsert another emails in account profile by different-different email types. If the email type is same then it will simply update the existing email, otherwise it will add a new email in Email array. @@ -471,31 +472,31 @@ module.exports = function (config) { * @return Response containing Definition for Complete profile data *18.29 */ - - module.upsertEmail = function (upsertEmailModel, uid, fields) { - if (helper.checkJson(upsertEmailModel)) { - return Promise.reject(helper.getValidationMessage('upsertEmailModel')); + upsertEmail (upsertEmailModel, uid, fields) { + if (checkJson(upsertEmailModel)) { + return Promise.reject(getValidationMessage('upsertEmailModel')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/manage/account/' + uid + '/email'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, upsertEmailModel ); - }; + } /** * Use this API to Remove emails from a user Account @@ -505,34 +506,34 @@ module.exports = function (config) { * @return Response containing Definition for Complete profile data *18.30 */ - - module.removeEmail = function (email, uid, fields) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + removeEmail (email, uid, fields) { + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.email = email; var resourcePath = 'identity/v2/manage/account/' + uid + '/email'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to refresh an access token via it's associated refresh token. @@ -540,21 +541,20 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *18.31 */ - - module.refreshAccessTokenByRefreshToken = function (refreshToken) { - if (helper.isNullOrWhiteSpace(refreshToken)) { - return Promise.reject(helper.getValidationMessage('refreshToken')); + refreshAccessTokenByRefreshToken (refreshToken) { + if (isNullOrWhiteSpace(refreshToken)) { + return Promise.reject(getValidationMessage('refreshToken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.refresh_Token = refreshToken; var resourcePath = 'identity/v2/manage/account/access_token/refresh'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * The Revoke Refresh Access Token API is used to revoke a refresh token or the Provider Access Token, revoking an existing refresh token will invalidate the refresh token but the associated access token will work until the expiry. @@ -562,21 +562,20 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *18.32 */ - - module.revokeRefreshToken = function (refreshToken) { - if (helper.isNullOrWhiteSpace(refreshToken)) { - return Promise.reject(helper.getValidationMessage('refreshToken')); + revokeRefreshToken (refreshToken) { + if (isNullOrWhiteSpace(refreshToken)) { + return Promise.reject(getValidationMessage('refreshToken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.refresh_Token = refreshToken; var resourcePath = 'identity/v2/manage/account/access_token/refresh/revoke'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * Note: This is intended for specific workflows where an email may be associated to multiple UIDs. This API is used to retrieve all of the identities (UID and Profiles), associated with a specified email in Cloud Storage. @@ -585,24 +584,23 @@ module.exports = function (config) { * @return Complete user Identity data *18.35 */ - - module.getAccountIdentitiesByEmail = function (email, fields) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + getAccountIdentitiesByEmail (email, fields) { + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.email = email; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/manage/account/identities'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to delete all user profiles associated with an Email. @@ -610,21 +608,20 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *18.36 */ - - module.accountDeleteByEmail = function (email) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + accountDeleteByEmail (email) { + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.email = email; var resourcePath = 'identity/v2/manage/account'; - return config.request('DELETE', resourcePath, queryParameters, null); - }; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } /** * This API is used to update a user's Uid. It will update all profiles, custom objects and consent management logs associated with the Uid. @@ -633,23 +630,27 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *18.41 */ - - module.accountUpdateUid = function (updateUidModel, uid) { - if (helper.checkJson(updateUidModel)) { - return Promise.reject(helper.getValidationMessage('updateUidModel')); + accountUpdateUid (updateUidModel, uid) { + if (checkJson(updateUidModel)) { + return Promise.reject(getValidationMessage('updateUidModel')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.uid = uid; var resourcePath = 'identity/v2/manage/account/uid'; - return config.request('PUT', resourcePath, queryParameters, updateUidModel); - }; - return module; -}; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + updateUidModel + ); + } +} diff --git a/loginradius-sdk/src/api/account/roleApi.ts b/loginradius-sdk/src/api/account/roleApi.ts index 79661d0..c1eb40e 100644 --- a/loginradius-sdk/src/api/account/roleApi.ts +++ b/loginradius-sdk/src/api/account/roleApi.ts @@ -2,9 +2,18 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); + +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class RoleApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * API is used to retrieve all the assigned roles of a particular User. @@ -12,20 +21,19 @@ module.exports = function (config) { * @return Response containing Definition of Complete Roles data *18.6 */ - - module.getRolesByUid = function (uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + getRolesByUid (uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/role'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to assign your desired roles to a given user. @@ -34,28 +42,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete Roles data *18.7 */ - - module.assignRolesByUid = function (accountRolesModel, uid) { - if (helper.checkJson(accountRolesModel)) { - return Promise.reject(helper.getValidationMessage('accountRolesModel')); + assignRolesByUid (accountRolesModel, uid) { + if (checkJson(accountRolesModel)) { + return Promise.reject(getValidationMessage('accountRolesModel')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/role'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, accountRolesModel ); - }; + } /** * This API is used to unassign roles from a user. @@ -64,28 +72,28 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *18.8 */ - - module.unassignRolesByUid = function (accountRolesModel, uid) { - if (helper.checkJson(accountRolesModel)) { - return Promise.reject(helper.getValidationMessage('accountRolesModel')); + unassignRolesByUid (accountRolesModel, uid) { + if (checkJson(accountRolesModel)) { + return Promise.reject(getValidationMessage('accountRolesModel')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/role'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, accountRolesModel ); - }; + } /** * This API Gets the contexts that have been configured and the associated roles and permissions. @@ -93,20 +101,19 @@ module.exports = function (config) { * @return Complete user RoleContext data *18.9 */ - - module.getRoleContextByUid = function (uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + getRoleContextByUid (uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/rolecontext'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * The API is used to retrieve role context by the context name. @@ -114,20 +121,19 @@ module.exports = function (config) { * @return Complete user RoleContext data *18.10 */ - - module.getRoleContextByContextName = function (contextName) { - if (helper.isNullOrWhiteSpace(contextName)) { - return Promise.reject(helper.getValidationMessage('contextName')); + getRoleContextByContextName (contextName) { + if (isNullOrWhiteSpace(contextName)) { + return Promise.reject(getValidationMessage('contextName')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/rolecontext/' + contextName; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API creates a Context with a set of Roles @@ -137,29 +143,28 @@ module.exports = function (config) { *18.11 */ - module.updateRoleContextByUid = function (accountRoleContextModel, uid) { - if (helper.checkJson(accountRoleContextModel)) { - return Promise.reject( - helper.getValidationMessage('accountRoleContextModel') - ); + updateRoleContextByUid (accountRoleContextModel, uid) { + if (checkJson(accountRoleContextModel)) { + return Promise.reject(getValidationMessage('accountRoleContextModel')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/rolecontext'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, accountRoleContextModel ); - }; + } /** * This API Deletes the specified Role Context @@ -168,24 +173,23 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *18.12 */ - - module.deleteRoleContextByUid = function (contextName, uid) { - if (helper.isNullOrWhiteSpace(contextName)) { - return Promise.reject(helper.getValidationMessage('contextName')); + deleteRoleContextByUid (contextName, uid) { + if (isNullOrWhiteSpace(contextName)) { + return Promise.reject(getValidationMessage('contextName')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/rolecontext/' + contextName; - return config.request('DELETE', resourcePath, queryParameters, null); - }; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } /** * This API Deletes the specified Role from a Context. @@ -195,27 +199,24 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *18.13 */ - - module.deleteRolesFromRoleContextByUid = function ( + deleteRolesFromRoleContextByUid ( contextName, roleContextRemoveRoleModel, uid ) { - if (helper.isNullOrWhiteSpace(contextName)) { - return Promise.reject(helper.getValidationMessage('contextName')); + if (isNullOrWhiteSpace(contextName)) { + return Promise.reject(getValidationMessage('contextName')); } - if (helper.checkJson(roleContextRemoveRoleModel)) { - return Promise.reject( - helper.getValidationMessage('roleContextRemoveRoleModel') - ); + if (checkJson(roleContextRemoveRoleModel)) { + return Promise.reject(getValidationMessage('roleContextRemoveRoleModel')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + @@ -224,13 +225,14 @@ module.exports = function (config) { contextName + '/role'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, roleContextRemoveRoleModel ); - }; + } /** * This API Deletes Additional Permissions from Context. @@ -240,29 +242,26 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *18.14 */ - - module.deleteAdditionalPermissionFromRoleContextByUid = function ( + deleteAdditionalPermissionFromRoleContextByUid ( contextName, roleContextAdditionalPermissionRemoveRoleModel, uid ) { - if (helper.isNullOrWhiteSpace(contextName)) { - return Promise.reject(helper.getValidationMessage('contextName')); + if (isNullOrWhiteSpace(contextName)) { + return Promise.reject(getValidationMessage('contextName')); } - if (helper.checkJson(roleContextAdditionalPermissionRemoveRoleModel)) { + if (checkJson(roleContextAdditionalPermissionRemoveRoleModel)) { return Promise.reject( - helper.getValidationMessage( - 'roleContextAdditionalPermissionRemoveRoleModel' - ) + getValidationMessage('roleContextAdditionalPermissionRemoveRoleModel') ); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + @@ -271,30 +270,30 @@ module.exports = function (config) { contextName + '/additionalpermission'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, roleContextAdditionalPermissionRemoveRoleModel ); - }; + } /** * This API retrieves the complete list of created roles with permissions of your app. * @return Complete user Roles List data *41.1 */ + getRolesList () { + var queryParameters: any = {}; - module.getRolesList = function () { - var queryParameters = {}; - - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/role'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API creates a role with permissions. @@ -302,20 +301,25 @@ module.exports = function (config) { * @return Complete user Roles data *41.2 */ - - module.createRoles = function (rolesModel) { - if (helper.checkJson(rolesModel)) { - return Promise.reject(helper.getValidationMessage('rolesModel')); + createRoles (rolesModel) { + if (checkJson(rolesModel)) { + return Promise.reject(getValidationMessage('rolesModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/role'; - return config.request('POST', resourcePath, queryParameters, rolesModel); - }; + return request( + this.config, + 'POST', + resourcePath, + queryParameters, + rolesModel + ); + } /** * This API is used to delete the role. @@ -323,20 +327,19 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *41.3 */ - - module.deleteRole = function (role) { - if (helper.isNullOrWhiteSpace(role)) { - return Promise.reject(helper.getValidationMessage('role')); + deleteRole (role) { + if (isNullOrWhiteSpace(role)) { + return Promise.reject(getValidationMessage('role')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/role/' + role; - return config.request('DELETE', resourcePath, queryParameters, null); - }; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } /** * This API is used to add permissions to a given role. @@ -345,28 +348,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete role data *41.4 */ - - module.addRolePermissions = function (permissionsModel, role) { - if (helper.checkJson(permissionsModel)) { - return Promise.reject(helper.getValidationMessage('permissionsModel')); + addRolePermissions (permissionsModel, role) { + if (checkJson(permissionsModel)) { + return Promise.reject(getValidationMessage('permissionsModel')); } - if (helper.isNullOrWhiteSpace(role)) { - return Promise.reject(helper.getValidationMessage('role')); + if (isNullOrWhiteSpace(role)) { + return Promise.reject(getValidationMessage('role')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/role/' + role + '/permission'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, permissionsModel ); - }; + } /** * API is used to remove permissions from a role. @@ -375,27 +378,26 @@ module.exports = function (config) { * @return Response containing Definition of Complete role data *41.5 */ - - module.removeRolePermissions = function (permissionsModel, role) { - if (helper.checkJson(permissionsModel)) { - return Promise.reject(helper.getValidationMessage('permissionsModel')); + removeRolePermissions (permissionsModel, role) { + if (checkJson(permissionsModel)) { + return Promise.reject(getValidationMessage('permissionsModel')); } - if (helper.isNullOrWhiteSpace(role)) { - return Promise.reject(helper.getValidationMessage('role')); + if (isNullOrWhiteSpace(role)) { + return Promise.reject(getValidationMessage('role')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/role/' + role + '/permission'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, permissionsModel ); - }; - return module; -}; + } +} diff --git a/loginradius-sdk/src/api/account/sottApi.ts b/loginradius-sdk/src/api/account/sottApi.ts index 6c2ddca..b78ecd3 100644 --- a/loginradius-sdk/src/api/account/sottApi.ts +++ b/loginradius-sdk/src/api/account/sottApi.ts @@ -2,29 +2,31 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); - /** - * This API allows you to generate SOTT with a given expiration time. - * @param {timeDifference} The time difference you would like to pass, If you not pass difference then the default value is 10 minutes - * @return Sott data For Registration - *18.28 - */ +import { LoginRadiusConfig } from '../../types'; +import { request } from '../../util/helper'; + +export default class SottApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} - module.generateSott = function (timeDifference) { - var queryParameters = {}; + /** + * This API allows you to generate SOTT with a given expiration time. + * @param {timeDifference} The time difference you would like to pass, If you not pass difference then the default value is 10 minutes + * @return Sott data For Registration + *18.28 + */ + generateSott (timeDifference) { + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; if (timeDifference !== null) { queryParameters.timeDifference = timeDifference; } var resourcePath = 'identity/v2/manage/account/sott'; - return config.request('GET', resourcePath, queryParameters, null); - }; - return module; -}; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } +} diff --git a/loginradius-sdk/src/api/advanced/configurationApi.ts b/loginradius-sdk/src/api/advanced/configurationApi.ts index fbe54a1..edb0b7e 100644 --- a/loginradius-sdk/src/api/advanced/configurationApi.ts +++ b/loginradius-sdk/src/api/advanced/configurationApi.ts @@ -2,23 +2,26 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { LoginRadiusConfig } from '../../types'; +import { request } from '../../util/helper'; + +export default class ConfigurationApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API is used to get the configurations which are set in the LoginRadius Dashboard for a particular LoginRadius site/environment * @return Response containing LoginRadius App configurations which are set in the LoginRadius Dashboard for a particular LoginRadius site/environment *100 */ - module.getConfigurations = function () { + getConfigurations () { var resourcePath = 'ciam/appinfo'; - var queryParameters = {}; - queryParameters.apiKey = config.apiKey; + var queryParameters: any = {}; + queryParameters.apiKey = this.config.apiKey; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API allows you to query your LoginRadius account for basic server information and server time information which is useful when generating an SOTT token. @@ -27,17 +30,16 @@ module.exports = function (config) { *3.1 */ - module.getServerInfo = function (timeDifference) { - var queryParameters = {}; + getServerInfo (timeDifference) { + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; if (timeDifference !== null) { queryParameters.timeDifference = timeDifference; } var resourcePath = 'identity/v2/serverinfo'; - return config.request('GET', resourcePath, queryParameters, null); - }; - return module; -}; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } +} diff --git a/loginradius-sdk/src/api/advanced/consentManagementApi.ts b/loginradius-sdk/src/api/advanced/consentManagementApi.ts index ba28a79..561b2ba 100644 --- a/loginradius-sdk/src/api/advanced/consentManagementApi.ts +++ b/loginradius-sdk/src/api/advanced/consentManagementApi.ts @@ -2,9 +2,17 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class ConsentManagementApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API is used to get the Consent logs of the user. @@ -12,20 +20,19 @@ module.exports = function (config) { * @return Response containing consent logs *18.37 */ - - module.getConsentLogsByUid = function (uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + getConsentLogsByUid (uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/consent/logs'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is to submit consent form using consent token. @@ -34,31 +41,28 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *43.1 */ - - module.submitConsentByConsentToken = function ( - consentToken, - consentSubmitModel - ) { - if (helper.isNullOrWhiteSpace(consentToken)) { - return Promise.reject(helper.getValidationMessage('consentToken')); + submitConsentByConsentToken (consentToken, consentSubmitModel) { + if (isNullOrWhiteSpace(consentToken)) { + return Promise.reject(getValidationMessage('consentToken')); } - if (helper.checkJson(consentSubmitModel)) { - return Promise.reject(helper.getValidationMessage('consentSubmitModel')); + if (checkJson(consentSubmitModel)) { + return Promise.reject(getValidationMessage('consentSubmitModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.consentToken = consentToken; var resourcePath = 'identity/v2/auth/consent'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, consentSubmitModel ); - }; + } /** * This API is used to fetch consent logs. @@ -66,20 +70,19 @@ module.exports = function (config) { * @return Response containing consent logs *43.2 */ - - module.getConsentLogs = function (accessToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + getConsentLogs (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/consent/logs'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * API to provide a way to end user to submit a consent form for particular event type. @@ -88,31 +91,28 @@ module.exports = function (config) { * @return Response containing Definition for Complete profile data *43.3 */ - - module.submitConsentByAccessToken = function ( - accessToken, - consentSubmitModel - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + submitConsentByAccessToken (accessToken, consentSubmitModel) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(consentSubmitModel)) { - return Promise.reject(helper.getValidationMessage('consentSubmitModel')); + if (checkJson(consentSubmitModel)) { + return Promise.reject(getValidationMessage('consentSubmitModel')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/consent/profile'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, consentSubmitModel ); - }; + } /** * This API is used to check if consent is submitted for a particular event or not. @@ -122,25 +122,24 @@ module.exports = function (config) { * @return Response containing consent profile *43.4 */ - - module.verifyConsentByAccessToken = function (accessToken, event, isCustom) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + verifyConsentByAccessToken (accessToken, event, isCustom) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(event)) { - return Promise.reject(helper.getValidationMessage('event')); + if (isNullOrWhiteSpace(event)) { + return Promise.reject(getValidationMessage('event')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.event = event; queryParameters.isCustom = isCustom; var resourcePath = 'identity/v2/auth/consent/verify'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is to update consents using access token. @@ -149,30 +148,26 @@ module.exports = function (config) { * @return Response containing consent profile *43.5 */ - - module.updateConsentProfileByAccessToken = function ( - accessToken, - consentUpdateModel - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + updateConsentProfileByAccessToken (accessToken, consentUpdateModel) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(consentUpdateModel)) { - return Promise.reject(helper.getValidationMessage('consentUpdateModel')); + if (checkJson(consentUpdateModel)) { + return Promise.reject(getValidationMessage('consentUpdateModel')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/consent'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, consentUpdateModel ); - }; - return module; -}; + } +} diff --git a/loginradius-sdk/src/api/advanced/customObjectApi.ts b/loginradius-sdk/src/api/advanced/customObjectApi.ts index 9f19b4d..cfb9c35 100644 --- a/loginradius-sdk/src/api/advanced/customObjectApi.ts +++ b/loginradius-sdk/src/api/advanced/customObjectApi.ts @@ -2,9 +2,17 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class CustomObjectApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API is used to write information in JSON format to the custom object for the specified account. @@ -14,31 +22,26 @@ module.exports = function (config) { * @return Response containing Definition for Complete user custom object data *6.1 */ - - module.createCustomObjectByToken = function ( - accessToken, - objectName, - payload - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + createCustomObjectByToken (accessToken, objectName, payload) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(objectName)) { - return Promise.reject(helper.getValidationMessage('objectName')); + if (isNullOrWhiteSpace(objectName)) { + return Promise.reject(getValidationMessage('objectName')); } - if (helper.checkJson(payload)) { - return Promise.reject(helper.getValidationMessage('payload')); + if (checkJson(payload)) { + return Promise.reject(getValidationMessage('payload')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.objectName = objectName; var resourcePath = 'identity/v2/auth/customobject'; - return config.request('POST', resourcePath, queryParameters, payload); - }; + return request(this.config, 'POST', resourcePath, queryParameters, payload); + } /** * This API is used to update the specified custom object data of the specified account. If the value of updatetype is 'replace' then it will fully replace custom object with the new custom object and if the value of updatetype is 'partialreplace' then it will perform an upsert type operation @@ -50,30 +53,29 @@ module.exports = function (config) { * @return Response containing Definition for Complete user custom object data *6.2 */ - - module.updateCustomObjectByToken = function ( + updateCustomObjectByToken ( accessToken, objectName, objectRecordId, payload, updateType ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(objectName)) { - return Promise.reject(helper.getValidationMessage('objectName')); + if (isNullOrWhiteSpace(objectName)) { + return Promise.reject(getValidationMessage('objectName')); } - if (helper.isNullOrWhiteSpace(objectRecordId)) { - return Promise.reject(helper.getValidationMessage('objectRecordId')); + if (isNullOrWhiteSpace(objectRecordId)) { + return Promise.reject(getValidationMessage('objectRecordId')); } - if (helper.checkJson(payload)) { - return Promise.reject(helper.getValidationMessage('payload')); + if (checkJson(payload)) { + return Promise.reject(getValidationMessage('payload')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.objectName = objectName; if (updateType !== null) { queryParameters.updateType = updateType; @@ -81,8 +83,8 @@ module.exports = function (config) { var resourcePath = 'identity/v2/auth/customobject/' + objectRecordId; - return config.request('PUT', resourcePath, queryParameters, payload); - }; + return request(this.config, 'PUT', resourcePath, queryParameters, payload); + } /** * This API is used to retrieve the specified Custom Object data for the specified account. @@ -91,24 +93,23 @@ module.exports = function (config) { * @return Complete user CustomObject data *6.3 */ - - module.getCustomObjectByToken = function (accessToken, objectName) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + getCustomObjectByToken (accessToken, objectName) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(objectName)) { - return Promise.reject(helper.getValidationMessage('objectName')); + if (isNullOrWhiteSpace(objectName)) { + return Promise.reject(getValidationMessage('objectName')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.objectName = objectName; var resourcePath = 'identity/v2/auth/customobject'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to retrieve the Custom Object data for the specified account. @@ -118,31 +119,26 @@ module.exports = function (config) { * @return Response containing Definition for Complete user custom object data *6.4 */ - - module.getCustomObjectByRecordIDAndToken = function ( - accessToken, - objectName, - objectRecordId - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + getCustomObjectByRecordIDAndToken (accessToken, objectName, objectRecordId) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(objectName)) { - return Promise.reject(helper.getValidationMessage('objectName')); + if (isNullOrWhiteSpace(objectName)) { + return Promise.reject(getValidationMessage('objectName')); } - if (helper.isNullOrWhiteSpace(objectRecordId)) { - return Promise.reject(helper.getValidationMessage('objectRecordId')); + if (isNullOrWhiteSpace(objectRecordId)) { + return Promise.reject(getValidationMessage('objectRecordId')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.objectName = objectName; var resourcePath = 'identity/v2/auth/customobject/' + objectRecordId; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to remove the specified Custom Object data using ObjectRecordId of a specified account. @@ -152,31 +148,26 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *6.5 */ - - module.deleteCustomObjectByToken = function ( - accessToken, - objectName, - objectRecordId - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + deleteCustomObjectByToken (accessToken, objectName, objectRecordId) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(objectName)) { - return Promise.reject(helper.getValidationMessage('objectName')); + if (isNullOrWhiteSpace(objectName)) { + return Promise.reject(getValidationMessage('objectName')); } - if (helper.isNullOrWhiteSpace(objectRecordId)) { - return Promise.reject(helper.getValidationMessage('objectRecordId')); + if (isNullOrWhiteSpace(objectRecordId)) { + return Promise.reject(getValidationMessage('objectRecordId')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.objectName = objectName; var resourcePath = 'identity/v2/auth/customobject/' + objectRecordId; - return config.request('DELETE', resourcePath, queryParameters, null); - }; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } /** * This API is used to write information in JSON format to the custom object for the specified account. @@ -186,27 +177,26 @@ module.exports = function (config) { * @return Response containing Definition for Complete user custom object data *19.1 */ - - module.createCustomObjectByUid = function (objectName, payload, uid) { - if (helper.isNullOrWhiteSpace(objectName)) { - return Promise.reject(helper.getValidationMessage('objectName')); + createCustomObjectByUid (objectName, payload, uid) { + if (isNullOrWhiteSpace(objectName)) { + return Promise.reject(getValidationMessage('objectName')); } - if (helper.checkJson(payload)) { - return Promise.reject(helper.getValidationMessage('payload')); + if (checkJson(payload)) { + return Promise.reject(getValidationMessage('payload')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.objectName = objectName; var resourcePath = 'identity/v2/manage/account/' + uid + '/customobject'; - return config.request('POST', resourcePath, queryParameters, payload); - }; + return request(this.config, 'POST', resourcePath, queryParameters, payload); + } /** * This API is used to update the specified custom object data of a specified account. If the value of updatetype is 'replace' then it will fully replace custom object with new custom object and if the value of updatetype is partialreplace then it will perform an upsert type operation. @@ -218,30 +208,29 @@ module.exports = function (config) { * @return Response containing Definition for Complete user custom object data *19.2 */ - - module.updateCustomObjectByUid = function ( + updateCustomObjectByUid ( objectName, objectRecordId, payload, uid, updateType ) { - if (helper.isNullOrWhiteSpace(objectName)) { - return Promise.reject(helper.getValidationMessage('objectName')); + if (isNullOrWhiteSpace(objectName)) { + return Promise.reject(getValidationMessage('objectName')); } - if (helper.isNullOrWhiteSpace(objectRecordId)) { - return Promise.reject(helper.getValidationMessage('objectRecordId')); + if (isNullOrWhiteSpace(objectRecordId)) { + return Promise.reject(getValidationMessage('objectRecordId')); } - if (helper.checkJson(payload)) { - return Promise.reject(helper.getValidationMessage('payload')); + if (checkJson(payload)) { + return Promise.reject(getValidationMessage('payload')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.objectName = objectName; if (updateType !== null) { queryParameters.updateType = updateType; @@ -250,8 +239,8 @@ module.exports = function (config) { var resourcePath = 'identity/v2/manage/account/' + uid + '/customobject/' + objectRecordId; - return config.request('PUT', resourcePath, queryParameters, payload); - }; + return request(this.config, 'PUT', resourcePath, queryParameters, payload); + } /** * This API is used to retrieve all the custom objects by UID from cloud storage. @@ -260,24 +249,23 @@ module.exports = function (config) { * @return Complete user CustomObject data *19.3 */ - - module.getCustomObjectByUid = function (objectName, uid) { - if (helper.isNullOrWhiteSpace(objectName)) { - return Promise.reject(helper.getValidationMessage('objectName')); + getCustomObjectByUid (objectName, uid) { + if (isNullOrWhiteSpace(objectName)) { + return Promise.reject(getValidationMessage('objectName')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.objectName = objectName; var resourcePath = 'identity/v2/manage/account/' + uid + '/customobject'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to retrieve the Custom Object data for the specified account. @@ -287,32 +275,27 @@ module.exports = function (config) { * @return Response containing Definition for Complete user custom object data *19.4 */ - - module.getCustomObjectByRecordID = function ( - objectName, - objectRecordId, - uid - ) { - if (helper.isNullOrWhiteSpace(objectName)) { - return Promise.reject(helper.getValidationMessage('objectName')); + getCustomObjectByRecordID (objectName, objectRecordId, uid) { + if (isNullOrWhiteSpace(objectName)) { + return Promise.reject(getValidationMessage('objectName')); } - if (helper.isNullOrWhiteSpace(objectRecordId)) { - return Promise.reject(helper.getValidationMessage('objectRecordId')); + if (isNullOrWhiteSpace(objectRecordId)) { + return Promise.reject(getValidationMessage('objectRecordId')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.objectName = objectName; var resourcePath = 'identity/v2/manage/account/' + uid + '/customobject/' + objectRecordId; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to remove the specified Custom Object data using ObjectRecordId of specified account. @@ -322,31 +305,25 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *19.5 */ - - module.deleteCustomObjectByRecordID = function ( - objectName, - objectRecordId, - uid - ) { - if (helper.isNullOrWhiteSpace(objectName)) { - return Promise.reject(helper.getValidationMessage('objectName')); + deleteCustomObjectByRecordID (objectName, objectRecordId, uid) { + if (isNullOrWhiteSpace(objectName)) { + return Promise.reject(getValidationMessage('objectName')); } - if (helper.isNullOrWhiteSpace(objectRecordId)) { - return Promise.reject(helper.getValidationMessage('objectRecordId')); + if (isNullOrWhiteSpace(objectRecordId)) { + return Promise.reject(getValidationMessage('objectRecordId')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.objectName = objectName; var resourcePath = 'identity/v2/manage/account/' + uid + '/customobject/' + objectRecordId; - return config.request('DELETE', resourcePath, queryParameters, null); - }; - return module; -}; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } +} diff --git a/loginradius-sdk/src/api/advanced/multiFactorAuthenticationApi.ts b/loginradius-sdk/src/api/advanced/multiFactorAuthenticationApi.ts index 21ea8d9..4e9e827 100644 --- a/loginradius-sdk/src/api/advanced/multiFactorAuthenticationApi.ts +++ b/loginradius-sdk/src/api/advanced/multiFactorAuthenticationApi.ts @@ -2,9 +2,17 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class MultiFactorAuthenticationApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API is used to configure the Multi-factor authentication after login by using the access token when MFA is set as optional on the LoginRadius site. @@ -13,23 +21,22 @@ module.exports = function (config) { * @return Response containing Definition of Complete Multi-Factor Authentication Settings data *5.7 */ - - module.mfaConfigureByAccessToken = function (accessToken, smsTemplate2FA) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaConfigureByAccessToken (accessToken, smsTemplate2FA) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(smsTemplate2FA)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.smsTemplate2FA = smsTemplate2FA; } var resourcePath = 'identity/v2/auth/account/2fa'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to trigger the Multi-factor authentication settings after login for secure actions @@ -39,37 +46,33 @@ module.exports = function (config) { * @return Response containing Definition for Complete profile data *5.9 */ - - module.mfaUpdateSetting = function ( - accessToken, - multiFactorAuthModelWithLockout, - fields - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaUpdateSetting (accessToken, multiFactorAuthModelWithLockout, fields) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(multiFactorAuthModelWithLockout)) { + if (checkJson(multiFactorAuthModelWithLockout)) { return Promise.reject( - helper.getValidationMessage('multiFactorAuthModelWithLockout') + getValidationMessage('multiFactorAuthModelWithLockout') ); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/auth/account/2fa/verification/otp'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, multiFactorAuthModelWithLockout ); - }; + } /** * This API is used to Enable Multi-factor authentication by access token on user login @@ -80,44 +83,42 @@ module.exports = function (config) { * @return Response containing Definition for Complete profile data *5.10 */ - - module.mfaUpdateByAccessToken = function ( + mfaUpdateByAccessToken ( accessToken, multiFactorAuthModelByGoogleAuthenticatorCode, fields, smsTemplate ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(multiFactorAuthModelByGoogleAuthenticatorCode)) { + if (checkJson(multiFactorAuthModelByGoogleAuthenticatorCode)) { return Promise.reject( - helper.getValidationMessage( - 'multiFactorAuthModelByGoogleAuthenticatorCode' - ) + getValidationMessage('multiFactorAuthModelByGoogleAuthenticatorCode') ); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } var resourcePath = 'identity/v2/auth/account/2fa/verification/googleauthenticatorcode'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, multiFactorAuthModelByGoogleAuthenticatorCode ); - }; + } /** * This API is used to update the Multi-factor authentication phone number by sending the verification OTP to the provided phone number @@ -127,33 +128,34 @@ module.exports = function (config) { * @return Response containing Definition for Complete SMS data *5.11 */ - - module.mfaUpdatePhoneNumberByToken = function ( - accessToken, - phoneNo2FA, - smsTemplate2FA - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaUpdatePhoneNumberByToken (accessToken, phoneNo2FA, smsTemplate2FA) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(phoneNo2FA)) { - return Promise.reject(helper.getValidationMessage('phoneNo2FA')); + if (isNullOrWhiteSpace(phoneNo2FA)) { + return Promise.reject(getValidationMessage('phoneNo2FA')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(smsTemplate2FA)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.smsTemplate2FA = smsTemplate2FA; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.phoneNo2FA = phoneNo2FA; var resourcePath = 'identity/v2/auth/account/2fa'; - return config.request('PUT', resourcePath, queryParameters, bodyParameters); - }; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + bodyParameters + ); + } /** * This API Resets the Google Authenticator configurations on a given account via the access token @@ -162,31 +164,28 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *5.12.1 */ - - module.mfaResetGoogleAuthByToken = function ( - accessToken, - googleauthenticator - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaResetGoogleAuthByToken (accessToken, googleauthenticator) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.googleauthenticator = googleauthenticator; var resourcePath = 'identity/v2/auth/account/2fa/authenticator'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API resets the SMS Authenticator configurations on a given account via the access token. @@ -195,28 +194,28 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *5.12.2 */ - - module.mfaResetSMSAuthByToken = function (accessToken, otpauthenticator) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaResetSMSAuthByToken (accessToken, otpauthenticator) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.otpauthenticator = otpauthenticator; var resourcePath = 'identity/v2/auth/account/2fa/authenticator'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to get a set of backup codes via access token to allow the user login on a site that has Multi-factor Authentication enabled in the event that the user does not have a secondary factor available. We generate 10 codes, each code can only be consumed once. If any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically @@ -224,20 +223,19 @@ module.exports = function (config) { * @return Response containing Definition of Complete Backup Code data *5.13 */ - - module.mfaBackupCodeByAccessToken = function (accessToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaBackupCodeByAccessToken (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/2fa/backupcode'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * API is used to reset the backup codes on a given account via the access token. This API call will generate 10 new codes, each code can only be consumed once @@ -245,20 +243,19 @@ module.exports = function (config) { * @return Response containing Definition of Complete Backup Code data *5.14 */ - - module.mfaResetBackupCodeByAccessToken = function (accessToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaResetBackupCodeByAccessToken (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/2fa/backupcode/reset'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is created to send the OTP to the email if email OTP authenticator is enabled in app's MFA configuration. @@ -268,31 +265,26 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *5.17 */ - - module.mfaEmailOtpByAccessToken = function ( - accessToken, - emailId, - emailTemplate2FA - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaEmailOtpByAccessToken (accessToken, emailId, emailTemplate2FA) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(emailId)) { - return Promise.reject(helper.getValidationMessage('emailId')); + if (isNullOrWhiteSpace(emailId)) { + return Promise.reject(getValidationMessage('emailId')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.emailId = emailId; - if (!helper.isNullOrWhiteSpace(emailTemplate2FA)) { + if (!isNullOrWhiteSpace(emailTemplate2FA)) { queryParameters.emailTemplate2FA = emailTemplate2FA; } var resourcePath = 'identity/v2/auth/account/2fa/otp/email'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to set up MFA Email OTP authenticator on profile after login. @@ -301,33 +293,33 @@ module.exports = function (config) { * @return Response containing Definition for Complete profile data *5.18 */ - - module.mfaValidateEmailOtpByAccessToken = function ( + mfaValidateEmailOtpByAccessToken ( accessToken, multiFactorAuthModelByEmailOtpWithLockout ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(multiFactorAuthModelByEmailOtpWithLockout)) { + if (checkJson(multiFactorAuthModelByEmailOtpWithLockout)) { return Promise.reject( - helper.getValidationMessage('multiFactorAuthModelByEmailOtpWithLockout') + getValidationMessage('multiFactorAuthModelByEmailOtpWithLockout') ); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/2fa/verification/otp/email'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, multiFactorAuthModelByEmailOtpWithLockout ); - }; + } /** * This API is used to reset the Email OTP Authenticator settings for an MFA-enabled user @@ -335,20 +327,19 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *5.19 */ - - module.mfaResetEmailOtpAuthenticatorByAccessToken = function (accessToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaResetEmailOtpAuthenticatorByAccessToken (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/2fa/authenticator/otp/email'; - return config.request('DELETE', resourcePath, queryParameters, null); - }; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } /** * This API is used to set up MFA Security Question authenticator on profile after login. @@ -357,33 +348,33 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *5.20 */ - - module.mfaSecurityQuestionAnswerByAccessToken = function ( + mfaSecurityQuestionAnswerByAccessToken ( accessToken, securityQuestionAnswerModelByAccessToken ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(securityQuestionAnswerModelByAccessToken)) { + if (checkJson(securityQuestionAnswerModelByAccessToken)) { return Promise.reject( - helper.getValidationMessage('securityQuestionAnswerModelByAccessToken') + getValidationMessage('securityQuestionAnswerModelByAccessToken') ); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/2fa/securityquestionanswer'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, securityQuestionAnswerModelByAccessToken ); - }; + } /** * This API is used to Reset MFA Security Question Authenticator By Access Token @@ -391,23 +382,20 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *5.21 */ - - module.mfaResetSecurityQuestionAuthenticatorByAccessToken = function ( - accessToken - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaResetSecurityQuestionAuthenticatorByAccessToken (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/2fa/authenticator/securityquestionanswer'; - return config.request('DELETE', resourcePath, queryParameters, null); - }; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } /** * This API can be used to login by emailid on a Multi-factor authentication enabled LoginRadius site. @@ -424,8 +412,7 @@ module.exports = function (config) { *9.8.1 */ - - module.mfaLoginByEmail = function ( + mfaLoginByEmail ( email, password, emailTemplate, @@ -436,50 +423,51 @@ module.exports = function (config) { verificationUrl, emailTemplate2FA ) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - if (helper.isNullOrWhiteSpace(password)) { - return Promise.reject(helper.getValidationMessage('password')); + if (isNullOrWhiteSpace(password)) { + return Promise.reject(getValidationMessage('password')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(loginUrl)) { + if (!isNullOrWhiteSpace(loginUrl)) { queryParameters.loginUrl = loginUrl; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - if (!helper.isNullOrWhiteSpace(smsTemplate2FA)) { + if (!isNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.smsTemplate2FA = smsTemplate2FA; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } - if (!helper.isNullOrWhiteSpace(emailTemplate2FA)) { + if (!isNullOrWhiteSpace(emailTemplate2FA)) { queryParameters.emailTemplate2FA = emailTemplate2FA; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.email = email; bodyParameters.password = password; var resourcePath = 'identity/v2/auth/login/2fa'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API can be used to login by username on a Multi-factor authentication enabled LoginRadius site. @@ -495,8 +483,7 @@ module.exports = function (config) { * @return Complete user UserProfile data *9.8.2 */ - - module.mfaLoginByUserName = function ( + mfaLoginByUserName ( password, username, emailTemplate, @@ -507,50 +494,51 @@ module.exports = function (config) { verificationUrl, emailTemplate2FA ) { - if (helper.isNullOrWhiteSpace(password)) { - return Promise.reject(helper.getValidationMessage('password')); + if (isNullOrWhiteSpace(password)) { + return Promise.reject(getValidationMessage('password')); } - if (helper.isNullOrWhiteSpace(username)) { - return Promise.reject(helper.getValidationMessage('username')); + if (isNullOrWhiteSpace(username)) { + return Promise.reject(getValidationMessage('username')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(loginUrl)) { + if (!isNullOrWhiteSpace(loginUrl)) { queryParameters.loginUrl = loginUrl; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - if (!helper.isNullOrWhiteSpace(smsTemplate2FA)) { + if (!isNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.smsTemplate2FA = smsTemplate2FA; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } - if (!helper.isNullOrWhiteSpace(emailTemplate2FA)) { + if (!isNullOrWhiteSpace(emailTemplate2FA)) { queryParameters.emailTemplate2FA = emailTemplate2FA; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.password = password; bodyParameters.username = username; var resourcePath = 'identity/v2/auth/login/2fa'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API can be used to login by Phone on a Multi-factor authentication enabled LoginRadius site. @@ -566,8 +554,7 @@ module.exports = function (config) { * @return Complete user UserProfile data *9.8.3 */ - - module.mfaLoginByPhone = function ( + mfaLoginByPhone ( password, phone, emailTemplate, @@ -578,49 +565,50 @@ module.exports = function (config) { verificationUrl, emailTemplate2FA ) { - if (helper.isNullOrWhiteSpace(password)) { - return Promise.reject(helper.getValidationMessage('password')); + if (isNullOrWhiteSpace(password)) { + return Promise.reject(getValidationMessage('password')); } - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(loginUrl)) { + if (!isNullOrWhiteSpace(loginUrl)) { queryParameters.loginUrl = loginUrl; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - if (!helper.isNullOrWhiteSpace(smsTemplate2FA)) { + if (!isNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.smsTemplate2FA = smsTemplate2FA; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } - if (!helper.isNullOrWhiteSpace(emailTemplate2FA)) { + if (!isNullOrWhiteSpace(emailTemplate2FA)) { queryParameters.emailTemplate2FA = emailTemplate2FA; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.password = password; bodyParameters.phone = phone; var resourcePath = 'identity/v2/auth/login/2fa'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to login via Multi-factor authentication by passing the One Time Password received via SMS @@ -635,8 +623,7 @@ module.exports = function (config) { * @return Complete user UserProfile data *9.12 */ - - module.mfaValidateOTPByPhone = function ( + mfaValidateOTPByPhone ( multiFactorAuthModelWithLockout, secondFactorAuthenticationToken, fields, @@ -646,49 +633,50 @@ module.exports = function (config) { rbaCountryEmailTemplate, rbaIpEmailTemplate ) { - if (helper.checkJson(multiFactorAuthModelWithLockout)) { + if (checkJson(multiFactorAuthModelWithLockout)) { return Promise.reject( - helper.getValidationMessage('multiFactorAuthModelWithLockout') + getValidationMessage('multiFactorAuthModelWithLockout') ); } - if (helper.isNullOrWhiteSpace(secondFactorAuthenticationToken)) { + if (isNullOrWhiteSpace(secondFactorAuthenticationToken)) { return Promise.reject( - helper.getValidationMessage('secondFactorAuthenticationToken') + getValidationMessage('secondFactorAuthenticationToken') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.secondFactorAuthenticationToken = secondFactorAuthenticationToken; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(smsTemplate2FA)) { + if (!isNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.smsTemplate2FA = smsTemplate2FA; } - if (!helper.isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { queryParameters.rbaBrowserEmailTemplate = rbaBrowserEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCityEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCityEmailTemplate)) { queryParameters.rbaCityEmailTemplate = rbaCityEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCountryEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCountryEmailTemplate)) { queryParameters.rbaCountryEmailTemplate = rbaCountryEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaIpEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaIpEmailTemplate)) { queryParameters.rbaIpEmailTemplate = rbaIpEmailTemplate; } var resourcePath = 'identity/v2/auth/login/2fa/verification/otp'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, multiFactorAuthModelWithLockout ); - }; + } /** * This API is used to login via Multi-factor-authentication by passing the google authenticator code. @@ -702,8 +690,7 @@ module.exports = function (config) { * @return Complete user UserProfile data *9.13 */ - - module.mfaValidateGoogleAuthCode = function ( + mfaValidateGoogleAuthCode ( googleAuthenticatorCode, secondFactorAuthenticationToken, fields, @@ -712,45 +699,49 @@ module.exports = function (config) { rbaCountryEmailTemplate, rbaIpEmailTemplate ) { - if (helper.isNullOrWhiteSpace(googleAuthenticatorCode)) { - return Promise.reject( - helper.getValidationMessage('googleAuthenticatorCode') - ); + if (isNullOrWhiteSpace(googleAuthenticatorCode)) { + return Promise.reject(getValidationMessage('googleAuthenticatorCode')); } - if (helper.isNullOrWhiteSpace(secondFactorAuthenticationToken)) { + if (isNullOrWhiteSpace(secondFactorAuthenticationToken)) { return Promise.reject( - helper.getValidationMessage('secondFactorAuthenticationToken') + getValidationMessage('secondFactorAuthenticationToken') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.secondFactorAuthenticationToken = secondFactorAuthenticationToken; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { queryParameters.rbaBrowserEmailTemplate = rbaBrowserEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCityEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCityEmailTemplate)) { queryParameters.rbaCityEmailTemplate = rbaCityEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCountryEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCountryEmailTemplate)) { queryParameters.rbaCountryEmailTemplate = rbaCountryEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaIpEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaIpEmailTemplate)) { queryParameters.rbaIpEmailTemplate = rbaIpEmailTemplate; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.googleAuthenticatorCode = googleAuthenticatorCode; var resourcePath = 'identity/v2/auth/login/2fa/verification/googleauthenticatorcode'; - return config.request('PUT', resourcePath, queryParameters, bodyParameters); - }; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + bodyParameters + ); + } /** * This API is used to validate the backup code provided by the user and if valid, we return an access token allowing the user to login incases where Multi-factor authentication (MFA) is enabled and the secondary factor is unavailable. When a user initially downloads the Backup codes, We generate 10 codes, each code can only be consumed once. if any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically @@ -764,8 +755,7 @@ module.exports = function (config) { * @return Complete user UserProfile data *9.14 */ - - module.mfaValidateBackupCode = function ( + mfaValidateBackupCode ( multiFactorAuthModelByBackupCode, secondFactorAuthenticationToken, fields, @@ -774,46 +764,47 @@ module.exports = function (config) { rbaCountryEmailTemplate, rbaIpEmailTemplate ) { - if (helper.checkJson(multiFactorAuthModelByBackupCode)) { + if (checkJson(multiFactorAuthModelByBackupCode)) { return Promise.reject( - helper.getValidationMessage('multiFactorAuthModelByBackupCode') + getValidationMessage('multiFactorAuthModelByBackupCode') ); } - if (helper.isNullOrWhiteSpace(secondFactorAuthenticationToken)) { + if (isNullOrWhiteSpace(secondFactorAuthenticationToken)) { return Promise.reject( - helper.getValidationMessage('secondFactorAuthenticationToken') + getValidationMessage('secondFactorAuthenticationToken') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.secondFactorAuthenticationToken = secondFactorAuthenticationToken; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { queryParameters.rbaBrowserEmailTemplate = rbaBrowserEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCityEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCityEmailTemplate)) { queryParameters.rbaCityEmailTemplate = rbaCityEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCountryEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCountryEmailTemplate)) { queryParameters.rbaCountryEmailTemplate = rbaCountryEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaIpEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaIpEmailTemplate)) { queryParameters.rbaIpEmailTemplate = rbaIpEmailTemplate; } var resourcePath = 'identity/v2/auth/login/2fa/verification/backupcode'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, multiFactorAuthModelByBackupCode ); - }; + } /** * This API is used to update (if configured) the phone number used for Multi-factor authentication by sending the verification OTP to the provided phone number @@ -823,36 +814,41 @@ module.exports = function (config) { * @return Response containing Definition for Complete SMS data *9.16 */ - - module.mfaUpdatePhoneNumber = function ( + mfaUpdatePhoneNumber ( phoneNo2FA, secondFactorAuthenticationToken, smsTemplate2FA ) { - if (helper.isNullOrWhiteSpace(phoneNo2FA)) { - return Promise.reject(helper.getValidationMessage('phoneNo2FA')); + if (isNullOrWhiteSpace(phoneNo2FA)) { + return Promise.reject(getValidationMessage('phoneNo2FA')); } - if (helper.isNullOrWhiteSpace(secondFactorAuthenticationToken)) { + if (isNullOrWhiteSpace(secondFactorAuthenticationToken)) { return Promise.reject( - helper.getValidationMessage('secondFactorAuthenticationToken') + getValidationMessage('secondFactorAuthenticationToken') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.secondFactorAuthenticationToken = secondFactorAuthenticationToken; - if (!helper.isNullOrWhiteSpace(smsTemplate2FA)) { + if (!isNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.smsTemplate2FA = smsTemplate2FA; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.phoneNo2FA = phoneNo2FA; var resourcePath = 'identity/v2/auth/login/2fa'; - return config.request('PUT', resourcePath, queryParameters, bodyParameters); - }; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + bodyParameters + ); + } /** * This API is used to resending the verification OTP to the provided phone number @@ -861,29 +857,25 @@ module.exports = function (config) { * @return Response containing Definition for Complete SMS data *9.17 */ - - module.mfaResendOTP = function ( - secondFactorAuthenticationToken, - smsTemplate2FA - ) { - if (helper.isNullOrWhiteSpace(secondFactorAuthenticationToken)) { + mfaResendOTP (secondFactorAuthenticationToken, smsTemplate2FA) { + if (isNullOrWhiteSpace(secondFactorAuthenticationToken)) { return Promise.reject( - helper.getValidationMessage('secondFactorAuthenticationToken') + getValidationMessage('secondFactorAuthenticationToken') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.secondFactorAuthenticationToken = secondFactorAuthenticationToken; - if (!helper.isNullOrWhiteSpace(smsTemplate2FA)) { + if (!isNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.smsTemplate2FA = smsTemplate2FA; } var resourcePath = 'identity/v2/auth/login/2fa/resend'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * An API designed to send the MFA Email OTP to the email. @@ -893,33 +885,34 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *9.18 */ - - module.mfaEmailOTP = function ( - emailIdModel, - secondFactorAuthenticationToken, - emailTemplate2FA - ) { - if (helper.checkJson(emailIdModel)) { - return Promise.reject(helper.getValidationMessage('emailIdModel')); + mfaEmailOTP (emailIdModel, secondFactorAuthenticationToken, emailTemplate2FA) { + if (checkJson(emailIdModel)) { + return Promise.reject(getValidationMessage('emailIdModel')); } - if (helper.isNullOrWhiteSpace(secondFactorAuthenticationToken)) { + if (isNullOrWhiteSpace(secondFactorAuthenticationToken)) { return Promise.reject( - helper.getValidationMessage('secondFactorAuthenticationToken') + getValidationMessage('secondFactorAuthenticationToken') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.secondFactorAuthenticationToken = secondFactorAuthenticationToken; - if (!helper.isNullOrWhiteSpace(emailTemplate2FA)) { + if (!isNullOrWhiteSpace(emailTemplate2FA)) { queryParameters.emailTemplate2FA = emailTemplate2FA; } var resourcePath = 'identity/v2/auth/login/2fa/otp/email'; - return config.request('POST', resourcePath, queryParameters, emailIdModel); - }; + return request( + this.config, + 'POST', + resourcePath, + queryParameters, + emailIdModel + ); + } /** * This API is used to Verify MFA Email OTP by MFA Token @@ -932,8 +925,7 @@ module.exports = function (config) { * @return Response Containing Access Token and Complete Profile Data *9.25 */ - - module.mfaValidateEmailOtp = function ( + mfaValidateEmailOtp ( multiFactorAuthModelByEmailOtp, secondFactorAuthenticationToken, rbaBrowserEmailTemplate, @@ -941,43 +933,44 @@ module.exports = function (config) { rbaCountryEmailTemplate, rbaIpEmailTemplate ) { - if (helper.checkJson(multiFactorAuthModelByEmailOtp)) { + if (checkJson(multiFactorAuthModelByEmailOtp)) { return Promise.reject( - helper.getValidationMessage('multiFactorAuthModelByEmailOtp') + getValidationMessage('multiFactorAuthModelByEmailOtp') ); } - if (helper.isNullOrWhiteSpace(secondFactorAuthenticationToken)) { + if (isNullOrWhiteSpace(secondFactorAuthenticationToken)) { return Promise.reject( - helper.getValidationMessage('secondFactorAuthenticationToken') + getValidationMessage('secondFactorAuthenticationToken') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.secondFactorAuthenticationToken = secondFactorAuthenticationToken; - if (!helper.isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { queryParameters.rbaBrowserEmailTemplate = rbaBrowserEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCityEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCityEmailTemplate)) { queryParameters.rbaCityEmailTemplate = rbaCityEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCountryEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCountryEmailTemplate)) { queryParameters.rbaCountryEmailTemplate = rbaCountryEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaIpEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaIpEmailTemplate)) { queryParameters.rbaIpEmailTemplate = rbaIpEmailTemplate; } var resourcePath = 'identity/v2/auth/login/2fa/verification/otp/email'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, multiFactorAuthModelByEmailOtp ); - }; + } /** * This API is used to set the security questions on the profile with the MFA token when MFA flow is required. @@ -986,36 +979,36 @@ module.exports = function (config) { * @return Response Containing Access Token and Complete Profile Data *9.26 */ - - module.mfaSecurityQuestionAnswer = function ( + mfaSecurityQuestionAnswer ( securityQuestionAnswerUpdateModel, secondFactorAuthenticationToken ) { - if (helper.checkJson(securityQuestionAnswerUpdateModel)) { + if (checkJson(securityQuestionAnswerUpdateModel)) { return Promise.reject( - helper.getValidationMessage('securityQuestionAnswerUpdateModel') + getValidationMessage('securityQuestionAnswerUpdateModel') ); } - if (helper.isNullOrWhiteSpace(secondFactorAuthenticationToken)) { + if (isNullOrWhiteSpace(secondFactorAuthenticationToken)) { return Promise.reject( - helper.getValidationMessage('secondFactorAuthenticationToken') + getValidationMessage('secondFactorAuthenticationToken') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.secondFactorAuthenticationToken = secondFactorAuthenticationToken; var resourcePath = 'identity/v2/auth/login/2fa/securityquestionanswer'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, securityQuestionAnswerUpdateModel ); - }; + } /** * This API is used to resending the verification OTP to the provided phone number @@ -1028,8 +1021,7 @@ module.exports = function (config) { * @return Response Containing Access Token and Complete Profile Data *9.27 */ - - module.mfaSecurityQuestionAnswerVerification = function ( + mfaSecurityQuestionAnswerVerification ( securityQuestionAnswerUpdateModel, secondFactorAuthenticationToken, rbaBrowserEmailTemplate, @@ -1037,44 +1029,45 @@ module.exports = function (config) { rbaCountryEmailTemplate, rbaIpEmailTemplate ) { - if (helper.checkJson(securityQuestionAnswerUpdateModel)) { + if (checkJson(securityQuestionAnswerUpdateModel)) { return Promise.reject( - helper.getValidationMessage('securityQuestionAnswerUpdateModel') + getValidationMessage('securityQuestionAnswerUpdateModel') ); } - if (helper.isNullOrWhiteSpace(secondFactorAuthenticationToken)) { + if (isNullOrWhiteSpace(secondFactorAuthenticationToken)) { return Promise.reject( - helper.getValidationMessage('secondFactorAuthenticationToken') + getValidationMessage('secondFactorAuthenticationToken') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.secondFactorAuthenticationToken = secondFactorAuthenticationToken; - if (!helper.isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { queryParameters.rbaBrowserEmailTemplate = rbaBrowserEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCityEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCityEmailTemplate)) { queryParameters.rbaCityEmailTemplate = rbaCityEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCountryEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCountryEmailTemplate)) { queryParameters.rbaCountryEmailTemplate = rbaCountryEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaIpEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaIpEmailTemplate)) { queryParameters.rbaIpEmailTemplate = rbaIpEmailTemplate; } var resourcePath = 'identity/v2/auth/login/2fa/verification/securityquestionanswer'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, securityQuestionAnswerUpdateModel ); - }; + } /** * This API resets the SMS Authenticator configurations on a given account via the UID. @@ -1083,29 +1076,29 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *18.21.1 */ - - module.mfaResetSMSAuthenticatorByUid = function (otpauthenticator, uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + mfaResetSMSAuthenticatorByUid (otpauthenticator, uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.uid = uid; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.otpauthenticator = otpauthenticator; var resourcePath = 'identity/v2/manage/account/2fa/authenticator'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API resets the Google Authenticator configurations on a given account via the UID. @@ -1114,32 +1107,29 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *18.21.2 */ - - module.mfaResetGoogleAuthenticatorByUid = function ( - googleauthenticator, - uid - ) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + mfaResetGoogleAuthenticatorByUid (googleauthenticator, uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.uid = uid; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.googleauthenticator = googleauthenticator; var resourcePath = 'identity/v2/manage/account/2fa/authenticator'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to reset the backup codes on a given account via the UID. This API call will generate 10 new codes, each code can only be consumed once. @@ -1147,21 +1137,20 @@ module.exports = function (config) { * @return Response containing Definition of Complete Backup Code data *18.25 */ - - module.mfaBackupCodeByUid = function (uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + mfaBackupCodeByUid (uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.uid = uid; var resourcePath = 'identity/v2/manage/account/2fa/backupcode'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to reset the backup codes on a given account via the UID. This API call will generate 10 new codes, each code can only be consumed once. @@ -1169,21 +1158,20 @@ module.exports = function (config) { * @return Response containing Definition of Complete Backup Code data *18.26 */ - - module.mfaResetBackupCodeByUid = function (uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + mfaResetBackupCodeByUid (uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.uid = uid; var resourcePath = 'identity/v2/manage/account/2fa/backupcode/reset'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to reset the Email OTP Authenticator settings for an MFA-enabled user. @@ -1191,21 +1179,20 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *18.42 */ - - module.mfaResetEmailOtpAuthenticatorByUid = function (uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + mfaResetEmailOtpAuthenticatorByUid (uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.uid = uid; var resourcePath = 'identity/v2/manage/account/2fa/authenticator/otp/email'; - return config.request('DELETE', resourcePath, queryParameters, null); - }; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } /** * This API is used to reset the Security Question Authenticator settings for an MFA-enabled user. @@ -1213,21 +1200,19 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *18.43 */ - - module.mfaResetSecurityQuestionAuthenticatorByUid = function (uid) { - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + mfaResetSecurityQuestionAuthenticatorByUid (uid) { + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; queryParameters.uid = uid; var resourcePath = 'identity/v2/manage/account/2fa/authenticator/securityquestionanswer'; - return config.request('DELETE', resourcePath, queryParameters, null); - }; - return module; -}; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } +} diff --git a/loginradius-sdk/src/api/advanced/reAuthenticationApi.ts b/loginradius-sdk/src/api/advanced/reAuthenticationApi.ts index 070ba83..562b910 100644 --- a/loginradius-sdk/src/api/advanced/reAuthenticationApi.ts +++ b/loginradius-sdk/src/api/advanced/reAuthenticationApi.ts @@ -2,9 +2,17 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class ReAuthenticationApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API is used to trigger the Multi-Factor Autentication workflow for the provided access token @@ -13,23 +21,22 @@ module.exports = function (config) { * @return Response containing Definition of Complete Multi-Factor Authentication Settings data *14.3 */ - - module.mfaReAuthenticate = function (accessToken, smsTemplate2FA) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaReAuthenticate (accessToken, smsTemplate2FA) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(smsTemplate2FA)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.smsTemplate2FA = smsTemplate2FA; } var resourcePath = 'identity/v2/auth/account/reauth/2fa'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to re-authenticate via Multi-factor authentication by passing the One Time Password received via SMS @@ -38,28 +45,28 @@ module.exports = function (config) { * @return Complete user Multi-Factor Authentication Token data *14.4 */ - - module.mfaReAuthenticateByOTP = function (accessToken, reauthByOtpModel) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaReAuthenticateByOTP (accessToken, reauthByOtpModel) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(reauthByOtpModel)) { - return Promise.reject(helper.getValidationMessage('reauthByOtpModel')); + if (checkJson(reauthByOtpModel)) { + return Promise.reject(getValidationMessage('reauthByOtpModel')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/reauth/2fa/otp'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, reauthByOtpModel ); - }; + } /** * This API is used to re-authenticate by set of backup codes via access token on the site that has Multi-factor authentication enabled in re-authentication for the user that does not have the device @@ -68,33 +75,28 @@ module.exports = function (config) { * @return Complete user Multi-Factor Authentication Token data *14.5 */ - - module.mfaReAuthenticateByBackupCode = function ( - accessToken, - reauthByBackupCodeModel - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + mfaReAuthenticateByBackupCode (accessToken, reauthByBackupCodeModel) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(reauthByBackupCodeModel)) { - return Promise.reject( - helper.getValidationMessage('reauthByBackupCodeModel') - ); + if (checkJson(reauthByBackupCodeModel)) { + return Promise.reject(getValidationMessage('reauthByBackupCodeModel')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/reauth/2fa/backupcode'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, reauthByBackupCodeModel ); - }; + } /** * This API is used to re-authenticate via Multi-factor-authentication by passing the google authenticator code @@ -103,34 +105,34 @@ module.exports = function (config) { * @return Complete user Multi-Factor Authentication Token data *14.6 */ - - module.mfaReAuthenticateByGoogleAuth = function ( + mfaReAuthenticateByGoogleAuth ( accessToken, reauthByGoogleAuthenticatorCodeModel ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(reauthByGoogleAuthenticatorCodeModel)) { + if (checkJson(reauthByGoogleAuthenticatorCodeModel)) { return Promise.reject( - helper.getValidationMessage('reauthByGoogleAuthenticatorCodeModel') + getValidationMessage('reauthByGoogleAuthenticatorCodeModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/reauth/2fa/googleauthenticatorcode'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, reauthByGoogleAuthenticatorCodeModel ); - }; + } /** * This API is used to re-authenticate via Multi-factor-authentication by passing the password @@ -140,37 +142,37 @@ module.exports = function (config) { * @return Complete user Multi-Factor Authentication Token data *14.7 */ - - module.mfaReAuthenticateByPassword = function ( + mfaReAuthenticateByPassword ( accessToken, passwordEventBasedAuthModelWithLockout, smsTemplate2FA ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(passwordEventBasedAuthModelWithLockout)) { + if (checkJson(passwordEventBasedAuthModelWithLockout)) { return Promise.reject( - helper.getValidationMessage('passwordEventBasedAuthModelWithLockout') + getValidationMessage('passwordEventBasedAuthModelWithLockout') ); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(smsTemplate2FA)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.smsTemplate2FA = smsTemplate2FA; } var resourcePath = 'identity/v2/auth/account/reauth/password'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, passwordEventBasedAuthModelWithLockout ); - }; + } /** * This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by OTP. @@ -179,33 +181,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *18.38 */ - - module.verifyMultiFactorOtpReauthentication = function ( - eventBasedMultiFactorToken, - uid - ) { - if (helper.checkJson(eventBasedMultiFactorToken)) { - return Promise.reject( - helper.getValidationMessage('eventBasedMultiFactorToken') - ); + verifyMultiFactorOtpReauthentication (eventBasedMultiFactorToken, uid) { + if (checkJson(eventBasedMultiFactorToken)) { + return Promise.reject(getValidationMessage('eventBasedMultiFactorToken')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/reauth/2fa'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, eventBasedMultiFactorToken ); - }; + } /** * This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by password. @@ -214,33 +211,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *18.39 */ - - module.verifyMultiFactorPasswordReauthentication = function ( - eventBasedMultiFactorToken, - uid - ) { - if (helper.checkJson(eventBasedMultiFactorToken)) { - return Promise.reject( - helper.getValidationMessage('eventBasedMultiFactorToken') - ); + verifyMultiFactorPasswordReauthentication (eventBasedMultiFactorToken, uid) { + if (checkJson(eventBasedMultiFactorToken)) { + return Promise.reject(getValidationMessage('eventBasedMultiFactorToken')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/reauth/password'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, eventBasedMultiFactorToken ); - }; + } /** * This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by PIN. @@ -249,33 +241,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *18.40 */ - - module.verifyMultiFactorPINReauthentication = function ( - eventBasedMultiFactorToken, - uid - ) { - if (helper.checkJson(eventBasedMultiFactorToken)) { - return Promise.reject( - helper.getValidationMessage('eventBasedMultiFactorToken') - ); + verifyMultiFactorPINReauthentication (eventBasedMultiFactorToken, uid) { + if (checkJson(eventBasedMultiFactorToken)) { + return Promise.reject(getValidationMessage('eventBasedMultiFactorToken')); } - if (helper.isNullOrWhiteSpace(uid)) { - return Promise.reject(helper.getValidationMessage('uid')); + if (isNullOrWhiteSpace(uid)) { + return Promise.reject(getValidationMessage('uid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - queryParameters.apiSecret = config.apiSecret; + queryParameters.apiKey = this.config.apiKey; + queryParameters.apiSecret = this.config.apiSecret; var resourcePath = 'identity/v2/manage/account/' + uid + '/reauth/pin'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, eventBasedMultiFactorToken ); - }; + } /** * This API is used to validate the triggered MFA authentication flow with a password. @@ -285,37 +272,37 @@ module.exports = function (config) { * @return Response containing Definition response of MFA reauthentication *42.13 */ - - module.verifyPINAuthentication = function ( + verifyPINAuthentication ( accessToken, pINAuthEventBasedAuthModelWithLockout, smsTemplate2FA ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(pINAuthEventBasedAuthModelWithLockout)) { + if (checkJson(pINAuthEventBasedAuthModelWithLockout)) { return Promise.reject( - helper.getValidationMessage('pINAuthEventBasedAuthModelWithLockout') + getValidationMessage('pINAuthEventBasedAuthModelWithLockout') ); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(smsTemplate2FA)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.smsTemplate2FA = smsTemplate2FA; } var resourcePath = 'identity/v2/auth/account/reauth/pin'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, pINAuthEventBasedAuthModelWithLockout ); - }; + } /** * This API is used to validate the triggered MFA authentication flow with an Email OTP. @@ -324,33 +311,28 @@ module.exports = function (config) { * @return Response containing Definition response of MFA reauthentication *42.14 */ - - module.reAuthValidateEmailOtp = function ( - accessToken, - reauthByEmailOtpModel - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + reAuthValidateEmailOtp (accessToken, reauthByEmailOtpModel) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(reauthByEmailOtpModel)) { - return Promise.reject( - helper.getValidationMessage('reauthByEmailOtpModel') - ); + if (checkJson(reauthByEmailOtpModel)) { + return Promise.reject(getValidationMessage('reauthByEmailOtpModel')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/reauth/2fa/otp/email/verify'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, reauthByEmailOtpModel ); - }; + } /** * This API is used to send the MFA Email OTP to the email for Re-authentication @@ -360,31 +342,26 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *42.15 */ - - module.reAuthSendEmailOtp = function ( - accessToken, - emailId, - emailTemplate2FA - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + reAuthSendEmailOtp (accessToken, emailId, emailTemplate2FA) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(emailId)) { - return Promise.reject(helper.getValidationMessage('emailId')); + if (isNullOrWhiteSpace(emailId)) { + return Promise.reject(getValidationMessage('emailId')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.emailId = emailId; - if (!helper.isNullOrWhiteSpace(emailTemplate2FA)) { + if (!isNullOrWhiteSpace(emailTemplate2FA)) { queryParameters.emailTemplate2FA = emailTemplate2FA; } var resourcePath = 'identity/v2/auth/account/reauth/2fa/otp/email'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to validate the triggered MFA re-authentication flow with security questions answers. @@ -393,33 +370,29 @@ module.exports = function (config) { * @return Response containing Definition response of MFA reauthentication *42.16 */ - - module.reAuthBySecurityQuestion = function ( - accessToken, - securityQuestionAnswerUpdateModel - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + reAuthBySecurityQuestion (accessToken, securityQuestionAnswerUpdateModel) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(securityQuestionAnswerUpdateModel)) { + if (checkJson(securityQuestionAnswerUpdateModel)) { return Promise.reject( - helper.getValidationMessage('securityQuestionAnswerUpdateModel') + getValidationMessage('securityQuestionAnswerUpdateModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/reauth/2fa/securityquestionanswer/verify'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, securityQuestionAnswerUpdateModel ); - }; - return module; -}; + } +} diff --git a/loginradius-sdk/src/api/advanced/webHookApi.ts b/loginradius-sdk/src/api/advanced/webHookApi.ts index 9b52b69..3356c2b 100644 --- a/loginradius-sdk/src/api/advanced/webHookApi.ts +++ b/loginradius-sdk/src/api/advanced/webHookApi.ts @@ -2,9 +2,17 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class WebHookApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API is used to fatch all the subscribed URLs, for particular event @@ -12,21 +20,20 @@ module.exports = function (config) { * @return Response Containing List of Webhhook Data *40.1 */ - - module.getWebHookSubscribedURLs = function (event) { - if (helper.isNullOrWhiteSpace(event)) { - return Promise.reject(helper.getValidationMessage('event')); + getWebHookSubscribedURLs (event) { + if (isNullOrWhiteSpace(event)) { + return Promise.reject(getValidationMessage('event')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apikey = config.apiKey; - queryParameters.apisecret = config.apiSecret; + queryParameters.apikey = this.config.apiKey; + queryParameters.apisecret = this.config.apiSecret; queryParameters.event = event; var resourcePath = 'api/v2/webhook'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * API can be used to configure a WebHook on your LoginRadius site. Webhooks also work on subscribe and notification model, subscribe your hook and get a notification. Equivalent to RESThook but these provide security on basis of signature and RESThook work on unique URL. Following are the events that are allowed by LoginRadius to trigger a WebHook service call. @@ -34,44 +41,41 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *40.2 */ - - module.webHookSubscribe = function (webHookSubscribeModel) { - if (helper.checkJson(webHookSubscribeModel)) { - return Promise.reject( - helper.getValidationMessage('webHookSubscribeModel') - ); + webHookSubscribe (webHookSubscribeModel) { + if (checkJson(webHookSubscribeModel)) { + return Promise.reject(getValidationMessage('webHookSubscribeModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apikey = config.apiKey; - queryParameters.apisecret = config.apiSecret; + queryParameters.apikey = this.config.apiKey; + queryParameters.apisecret = this.config.apiSecret; var resourcePath = 'api/v2/webhook'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, webHookSubscribeModel ); - }; + } /** * API can be used to test a subscribed WebHook. * @return Response containing Definition of Complete Validation data *40.3 */ + webhookTest () { + var queryParameters: any = {}; - module.webhookTest = function () { - var queryParameters = {}; - - queryParameters.apikey = config.apiKey; - queryParameters.apisecret = config.apiSecret; + queryParameters.apikey = this.config.apiKey; + queryParameters.apisecret = this.config.apiSecret; var resourcePath = 'api/v2/webhook/test'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * API can be used to unsubscribe a WebHook configured on your LoginRadius site. @@ -79,26 +83,23 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *40.4 */ - - module.webHookUnsubscribe = function (webHookSubscribeModel) { - if (helper.checkJson(webHookSubscribeModel)) { - return Promise.reject( - helper.getValidationMessage('webHookSubscribeModel') - ); + webHookUnsubscribe (webHookSubscribeModel) { + if (checkJson(webHookSubscribeModel)) { + return Promise.reject(getValidationMessage('webHookSubscribeModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apikey = config.apiKey; - queryParameters.apisecret = config.apiSecret; + queryParameters.apikey = this.config.apiKey; + queryParameters.apisecret = this.config.apiSecret; var resourcePath = 'api/v2/webhook'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, webHookSubscribeModel ); - }; - return module; -}; + } +} diff --git a/loginradius-sdk/src/api/authentication/authenticationApi.ts b/loginradius-sdk/src/api/authentication/authenticationApi.ts index f49be30..af59d7e 100644 --- a/loginradius-sdk/src/api/authentication/authenticationApi.ts +++ b/loginradius-sdk/src/api/authentication/authenticationApi.ts @@ -2,9 +2,17 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class AuthenticationApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. @@ -12,20 +20,19 @@ module.exports = function (config) { * @return Response containing Definition for Complete SecurityQuestions data *2.1 */ - - module.getSecurityQuestionsByEmail = function (email) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + getSecurityQuestionsByEmail (email) { + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.email = email; var resourcePath = 'identity/v2/auth/securityquestion/email'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. @@ -33,20 +40,19 @@ module.exports = function (config) { * @return Response containing Definition for Complete SecurityQuestions data *2.2 */ - - module.getSecurityQuestionsByUserName = function (userName) { - if (helper.isNullOrWhiteSpace(userName)) { - return Promise.reject(helper.getValidationMessage('userName')); + getSecurityQuestionsByUserName (userName) { + if (isNullOrWhiteSpace(userName)) { + return Promise.reject(getValidationMessage('userName')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.userName = userName; var resourcePath = 'identity/v2/auth/securityquestion/username'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. @@ -54,20 +60,19 @@ module.exports = function (config) { * @return Response containing Definition for Complete SecurityQuestions data *2.3 */ - - module.getSecurityQuestionsByPhone = function (phone) { - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + getSecurityQuestionsByPhone (phone) { + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.phone = phone; var resourcePath = 'identity/v2/auth/securityquestion/phone'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. @@ -75,20 +80,19 @@ module.exports = function (config) { * @return Response containing Definition for Complete SecurityQuestions data *2.4 */ - - module.getSecurityQuestionsByAccessToken = function (accessToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + getSecurityQuestionsByAccessToken (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/securityquestion/accesstoken'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This api validates access token, if valid then returns a response with its expiry otherwise error. @@ -96,20 +100,19 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *4.1 */ - - module.authValidateAccessToken = function (accessToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + authValidateAccessToken (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/access_token/validate'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This api call invalidates the active access token or expires an access token's validity. @@ -117,24 +120,23 @@ module.exports = function (config) { * @param {preventRefresh} Boolean value that when set as true, in addition of the access token being invalidated, it will no longer have the capability of being refreshed. * @return Response containing Definition of Complete Validation data *4.2 - */ - - module.authInValidateAccessToken = function (accessToken, preventRefresh) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + this.config.this.config.*/ + authInValidateAccessToken (accessToken, preventRefresh) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; if (preventRefresh !== null) { queryParameters.preventRefresh = preventRefresh; } var resourcePath = 'identity/v2/auth/access_token/invalidate'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This api call provide the active access token Information @@ -142,20 +144,19 @@ module.exports = function (config) { * @return Response containing Definition of Token Information *4.3 */ - - module.getAccessTokenInfo = function (accessToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + getAccessTokenInfo (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/access_token'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API retrieves a copy of the user data based on the access token. @@ -167,38 +168,37 @@ module.exports = function (config) { * @return Response containing Definition for Complete profile data *5.2 */ - - module.getProfileByAccessToken = function ( + getProfileByAccessToken ( accessToken, fields, emailTemplate, verificationUrl, welcomeEmailTemplate ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/account'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API sends a welcome email @@ -207,23 +207,22 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *5.3 */ - - module.sendWelcomeEmail = function (accessToken, welcomeEmailTemplate) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + sendWelcomeEmail (accessToken, welcomeEmailTemplate) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/account/sendwelcomeemail'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to update the user's profile by passing the access token. @@ -237,8 +236,7 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation and UserProfile data *5.4 */ - - module.updateProfileByAccessToken = function ( + updateProfileByAccessToken ( accessToken, userProfileUpdateModel, emailTemplate, @@ -247,43 +245,42 @@ module.exports = function (config) { smsTemplate, verificationUrl ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(userProfileUpdateModel)) { - return Promise.reject( - helper.getValidationMessage('userProfileUpdateModel') - ); + if (checkJson(userProfileUpdateModel)) { + return Promise.reject(getValidationMessage('userProfileUpdateModel')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } if (nullSupport !== null) { queryParameters.nullSupport = nullSupport; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } var resourcePath = 'identity/v2/auth/account'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, userProfileUpdateModel ); - }; + } /** * This API will send a confirmation email for account deletion to the customer's email when passed the customer's access token @@ -293,30 +290,25 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *5.5 */ - - module.deleteAccountWithEmailConfirmation = function ( - accessToken, - deleteUrl, - emailTemplate - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + deleteAccountWithEmailConfirmation (accessToken, deleteUrl, emailTemplate) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(deleteUrl)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(deleteUrl)) { queryParameters.deleteUrl = deleteUrl; } - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } var resourcePath = 'identity/v2/auth/account'; - return config.request('DELETE', resourcePath, queryParameters, null); - }; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } /** * This API is used to delete an account by passing it a delete token. @@ -324,20 +316,19 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *5.6 */ - - module.deleteAccountByDeleteToken = function (deletetoken) { - if (helper.isNullOrWhiteSpace(deletetoken)) { - return Promise.reject(helper.getValidationMessage('deletetoken')); + deleteAccountByDeleteToken (deletetoken) { + if (isNullOrWhiteSpace(deletetoken)) { + return Promise.reject(getValidationMessage('deletetoken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.deletetoken = deletetoken; var resourcePath = 'identity/v2/auth/account/delete'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to allow a customer with a valid access token to unlock their account provided that they successfully pass the prompted Bot Protection challenges. The Block or Suspend block types are not applicable for this API. For additional details see our Auth Security Configuration documentation.You are only required to pass the Post Parameters that correspond to the prompted challenges. @@ -346,28 +337,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *5.15 */ - - module.unlockAccountByToken = function (accessToken, unlockProfileModel) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + unlockAccountByToken (accessToken, unlockProfileModel) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(unlockProfileModel)) { - return Promise.reject(helper.getValidationMessage('unlockProfileModel')); + if (checkJson(unlockProfileModel)) { + return Promise.reject(getValidationMessage('unlockProfileModel')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/account/unlock'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, unlockProfileModel ); - }; + } /** * This API is used to get a user's profile using the clientGuid parameter if no callback feature enabled @@ -379,38 +370,37 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *5.16 */ - - module.getProfileByPing = function ( + getProfileByPing ( clientGuid, emailTemplate, fields, verificationUrl, welcomeEmailTemplate ) { - if (helper.isNullOrWhiteSpace(clientGuid)) { - return Promise.reject(helper.getValidationMessage('clientGuid')); + if (isNullOrWhiteSpace(clientGuid)) { + return Promise.reject(getValidationMessage('clientGuid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.clientGuid = clientGuid; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/account/ping'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to check the email exists or not on your site. @@ -418,20 +408,19 @@ module.exports = function (config) { * @return Response containing Definition Complete ExistResponse data *8.1 */ - - module.checkEmailAvailability = function (email) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + checkEmailAvailability (email) { + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.email = email; var resourcePath = 'identity/v2/auth/email'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to verify the email of user. Note: This API will only return the full profile if you have 'Enable auto login after email verification' set in your LoginRadius Admin Console's Email Workflow settings under 'Verification Email'. @@ -442,34 +431,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation, UserProfile data and Access Token *8.2 */ - - module.verifyEmail = function ( - verificationToken, - fields, - url, - welcomeEmailTemplate - ) { - if (helper.isNullOrWhiteSpace(verificationToken)) { - return Promise.reject(helper.getValidationMessage('verificationToken')); + verifyEmail (verificationToken, fields, url, welcomeEmailTemplate) { + if (isNullOrWhiteSpace(verificationToken)) { + return Promise.reject(getValidationMessage('verificationToken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.verificationToken = verificationToken; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(url)) { + if (!isNullOrWhiteSpace(url)) { queryParameters.url = url; } - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/email'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to verify the email of user when the OTP Email verification flow is enabled, please note that you must contact LoginRadius to have this feature enabled. @@ -480,40 +463,40 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation, UserProfile data and Access Token *8.3 */ - - module.verifyEmailByOTP = function ( + verifyEmailByOTP ( emailVerificationByOtpModel, fields, url, welcomeEmailTemplate ) { - if (helper.checkJson(emailVerificationByOtpModel)) { + if (checkJson(emailVerificationByOtpModel)) { return Promise.reject( - helper.getValidationMessage('emailVerificationByOtpModel') + getValidationMessage('emailVerificationByOtpModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(url)) { + if (!isNullOrWhiteSpace(url)) { queryParameters.url = url; } - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/email'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, emailVerificationByOtpModel ); - }; + } /** * This API is used to add additional emails to a user's account. @@ -525,47 +508,41 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *8.5 */ - - module.addEmail = function ( - accessToken, - email, - type, - emailTemplate, - verificationUrl - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + addEmail (accessToken, email, type, emailTemplate, verificationUrl) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - if (helper.isNullOrWhiteSpace(type)) { - return Promise.reject(helper.getValidationMessage('type')); + if (isNullOrWhiteSpace(type)) { + return Promise.reject(getValidationMessage('type')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.email = email; bodyParameters.type = type; var resourcePath = 'identity/v2/auth/email'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to remove additional emails from a user's account. @@ -574,31 +551,31 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *8.6 */ - - module.removeEmail = function (accessToken, email) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + removeEmail (accessToken, email) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.email = email; var resourcePath = 'identity/v2/auth/email'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API retrieves a copy of the user data based on the Email @@ -610,44 +587,42 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.2.1 */ - - module.loginByEmail = function ( + loginByEmail ( emailAuthenticationModel, emailTemplate, fields, loginUrl, verificationUrl ) { - if (helper.checkJson(emailAuthenticationModel)) { - return Promise.reject( - helper.getValidationMessage('emailAuthenticationModel') - ); + if (checkJson(emailAuthenticationModel)) { + return Promise.reject(getValidationMessage('emailAuthenticationModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(loginUrl)) { + if (!isNullOrWhiteSpace(loginUrl)) { queryParameters.loginUrl = loginUrl; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } var resourcePath = 'identity/v2/auth/login'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, emailAuthenticationModel ); - }; + } /** * This API retrieves a copy of the user data based on the Username @@ -659,44 +634,44 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.2.2 */ - - module.loginByUserName = function ( + loginByUserName ( userNameAuthenticationModel, emailTemplate, fields, loginUrl, verificationUrl ) { - if (helper.checkJson(userNameAuthenticationModel)) { + if (checkJson(userNameAuthenticationModel)) { return Promise.reject( - helper.getValidationMessage('userNameAuthenticationModel') + getValidationMessage('userNameAuthenticationModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(loginUrl)) { + if (!isNullOrWhiteSpace(loginUrl)) { queryParameters.loginUrl = loginUrl; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } var resourcePath = 'identity/v2/auth/login'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, userNameAuthenticationModel ); - }; + } /** * This API is used to send the reset password url to a specified account. Note: If you have the UserName workflow enabled, you may replace the 'email' parameter with 'username' @@ -706,34 +681,34 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *10.1 */ - - module.forgotPassword = function (email, resetPasswordUrl, emailTemplate) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + forgotPassword (email, resetPasswordUrl, emailTemplate) { + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - if (helper.isNullOrWhiteSpace(resetPasswordUrl)) { - return Promise.reject(helper.getValidationMessage('resetPasswordUrl')); + if (isNullOrWhiteSpace(resetPasswordUrl)) { + return Promise.reject(getValidationMessage('resetPasswordUrl')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.resetPasswordUrl = resetPasswordUrl; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.email = email; var resourcePath = 'identity/v2/auth/password'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to reset password for the specified account by security question @@ -741,30 +716,28 @@ module.exports = function (config) { * @return Response containing Definition of Validation data and access token *10.3.1 */ - - module.resetPasswordBySecurityAnswerAndEmail = function ( + resetPasswordBySecurityAnswerAndEmail ( resetPasswordBySecurityAnswerAndEmailModel ) { - if (helper.checkJson(resetPasswordBySecurityAnswerAndEmailModel)) { + if (checkJson(resetPasswordBySecurityAnswerAndEmailModel)) { return Promise.reject( - helper.getValidationMessage( - 'resetPasswordBySecurityAnswerAndEmailModel' - ) + getValidationMessage('resetPasswordBySecurityAnswerAndEmailModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/password/securityanswer'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPasswordBySecurityAnswerAndEmailModel ); - }; + } /** * This API is used to reset password for the specified account by security question @@ -772,30 +745,28 @@ module.exports = function (config) { * @return Response containing Definition of Validation data and access token *10.3.2 */ - - module.resetPasswordBySecurityAnswerAndPhone = function ( + resetPasswordBySecurityAnswerAndPhone ( resetPasswordBySecurityAnswerAndPhoneModel ) { - if (helper.checkJson(resetPasswordBySecurityAnswerAndPhoneModel)) { + if (checkJson(resetPasswordBySecurityAnswerAndPhoneModel)) { return Promise.reject( - helper.getValidationMessage( - 'resetPasswordBySecurityAnswerAndPhoneModel' - ) + getValidationMessage('resetPasswordBySecurityAnswerAndPhoneModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/password/securityanswer'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPasswordBySecurityAnswerAndPhoneModel ); - }; + } /** * This API is used to reset password for the specified account by security question @@ -803,30 +774,28 @@ module.exports = function (config) { * @return Response containing Definition of Validation data and access token *10.3.3 */ - - module.resetPasswordBySecurityAnswerAndUserName = function ( + resetPasswordBySecurityAnswerAndUserName ( resetPasswordBySecurityAnswerAndUserNameModel ) { - if (helper.checkJson(resetPasswordBySecurityAnswerAndUserNameModel)) { + if (checkJson(resetPasswordBySecurityAnswerAndUserNameModel)) { return Promise.reject( - helper.getValidationMessage( - 'resetPasswordBySecurityAnswerAndUserNameModel' - ) + getValidationMessage('resetPasswordBySecurityAnswerAndUserNameModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/password/securityanswer'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPasswordBySecurityAnswerAndUserNameModel ); - }; + } /** * This API is used to set a new password for the specified account. @@ -834,26 +803,26 @@ module.exports = function (config) { * @return Response containing Definition of Validation data and access token *10.7.1 */ - - module.resetPasswordByResetToken = function (resetPasswordByResetTokenModel) { - if (helper.checkJson(resetPasswordByResetTokenModel)) { + resetPasswordByResetToken (resetPasswordByResetTokenModel) { + if (checkJson(resetPasswordByResetTokenModel)) { return Promise.reject( - helper.getValidationMessage('resetPasswordByResetTokenModel') + getValidationMessage('resetPasswordByResetTokenModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/password/reset'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPasswordByResetTokenModel ); - }; + } /** * This API is used to set a new password for the specified account. @@ -861,26 +830,26 @@ module.exports = function (config) { * @return Response containing Definition of Validation data and access token *10.7.2 */ - - module.resetPasswordByEmailOTP = function (resetPasswordByEmailAndOtpModel) { - if (helper.checkJson(resetPasswordByEmailAndOtpModel)) { + resetPasswordByEmailOTP (resetPasswordByEmailAndOtpModel) { + if (checkJson(resetPasswordByEmailAndOtpModel)) { return Promise.reject( - helper.getValidationMessage('resetPasswordByEmailAndOtpModel') + getValidationMessage('resetPasswordByEmailAndOtpModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/password/reset'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPasswordByEmailAndOtpModel ); - }; + } /** * This API is used to set a new password for the specified account if you are using the username as the unique identifier in your workflow @@ -888,28 +857,26 @@ module.exports = function (config) { * @return Response containing Definition of Validation data and access token *10.7.3 */ - - module.resetPasswordByOTPAndUserName = function ( - resetPasswordByUserNameModel - ) { - if (helper.checkJson(resetPasswordByUserNameModel)) { + resetPasswordByOTPAndUserName (resetPasswordByUserNameModel) { + if (checkJson(resetPasswordByUserNameModel)) { return Promise.reject( - helper.getValidationMessage('resetPasswordByUserNameModel') + getValidationMessage('resetPasswordByUserNameModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/password/reset'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPasswordByUserNameModel ); - }; + } /** * This API is used to change the accounts password based on the previous password @@ -919,30 +886,35 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *10.8 */ - - module.changePassword = function (accessToken, newPassword, oldPassword) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + changePassword (accessToken, newPassword, oldPassword) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(newPassword)) { - return Promise.reject(helper.getValidationMessage('newPassword')); + if (isNullOrWhiteSpace(newPassword)) { + return Promise.reject(getValidationMessage('newPassword')); } - if (helper.isNullOrWhiteSpace(oldPassword)) { - return Promise.reject(helper.getValidationMessage('oldPassword')); + if (isNullOrWhiteSpace(oldPassword)) { + return Promise.reject(getValidationMessage('oldPassword')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.newPassword = newPassword; bodyParameters.oldPassword = oldPassword; var resourcePath = 'identity/v2/auth/password/change'; - return config.request('PUT', resourcePath, queryParameters, bodyParameters); - }; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + bodyParameters + ); + } /** * This API is used to unlink up a social provider account with the specified account based on the access token and the social providers user access token. The unlinked account will automatically get removed from your database. @@ -952,35 +924,35 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *12.2 */ - - module.unlinkSocialIdentities = function (accessToken, provider, providerId) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + unlinkSocialIdentities (accessToken, provider, providerId) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(provider)) { - return Promise.reject(helper.getValidationMessage('provider')); + if (isNullOrWhiteSpace(provider)) { + return Promise.reject(getValidationMessage('provider')); } - if (helper.isNullOrWhiteSpace(providerId)) { - return Promise.reject(helper.getValidationMessage('providerId')); + if (isNullOrWhiteSpace(providerId)) { + return Promise.reject(getValidationMessage('providerId')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.provider = provider; bodyParameters.providerId = providerId; var resourcePath = 'identity/v2/auth/socialidentity'; - return config.request( + return request( + this.config, 'DELETE', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to link up a social provider account with an existing LoginRadius account on the basis of access token and the social providers user access token. @@ -989,31 +961,31 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *12.4 */ - - module.linkSocialIdentities = function (accessToken, candidateToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + linkSocialIdentities (accessToken, candidateToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(candidateToken)) { - return Promise.reject(helper.getValidationMessage('candidateToken')); + if (isNullOrWhiteSpace(candidateToken)) { + return Promise.reject(getValidationMessage('candidateToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.candidateToken = candidateToken; var resourcePath = 'identity/v2/auth/socialidentity'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to link up a social provider account with an existing LoginRadius account on the basis of ping and the social providers user access token. @@ -1022,31 +994,31 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *12.5 */ - - module.linkSocialIdentitiesByPing = function (accessToken, clientGuid) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + linkSocialIdentitiesByPing (accessToken, clientGuid) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(clientGuid)) { - return Promise.reject(helper.getValidationMessage('clientGuid')); + if (isNullOrWhiteSpace(clientGuid)) { + return Promise.reject(getValidationMessage('clientGuid')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.clientGuid = clientGuid; var resourcePath = 'identity/v2/auth/socialidentity'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to set or change UserName by access token. @@ -1055,26 +1027,31 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *13.1 */ - - module.setOrChangeUserName = function (accessToken, username) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + setOrChangeUserName (accessToken, username) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(username)) { - return Promise.reject(helper.getValidationMessage('username')); + if (isNullOrWhiteSpace(username)) { + return Promise.reject(getValidationMessage('username')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.username = username; var resourcePath = 'identity/v2/auth/username'; - return config.request('PUT', resourcePath, queryParameters, bodyParameters); - }; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + bodyParameters + ); + } /** * This API is used to check the UserName exists or not on your site. @@ -1082,20 +1059,19 @@ module.exports = function (config) { * @return Response containing Definition Complete ExistResponse data *13.2 */ - - module.checkUserNameAvailability = function (username) { - if (helper.isNullOrWhiteSpace(username)) { - return Promise.reject(helper.getValidationMessage('username')); + checkUserNameAvailability (username) { + if (isNullOrWhiteSpace(username)) { + return Promise.reject(getValidationMessage('username')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.username = username; var resourcePath = 'identity/v2/auth/username'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to update the privacy policy stored in the user's profile by providing the access token of the user accepting the privacy policy @@ -1104,23 +1080,22 @@ module.exports = function (config) { * @return Response containing Definition for Complete profile data *15.1 */ - - module.acceptPrivacyPolicy = function (accessToken, fields) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + acceptPrivacyPolicy (accessToken, fields) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/auth/privacypolicy/accept'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API will return all the accepted privacy policies for the user by providing the access token of that user. @@ -1128,20 +1103,19 @@ module.exports = function (config) { * @return Complete Policy History data *15.2 */ - - module.getPrivacyPolicyHistoryByAccessToken = function (accessToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + getPrivacyPolicyHistoryByAccessToken (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/privacypolicy/history'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API creates a user in the database as well as sends a verification email to the user. @@ -1155,8 +1129,7 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation, UserProfile data and Access Token *17.1.1 */ - - module.userRegistrationByEmail = function ( + userRegistrationByEmail ( authUserRegistrationModel, sott, emailTemplate, @@ -1165,43 +1138,42 @@ module.exports = function (config) { verificationUrl, welcomeEmailTemplate ) { - if (helper.checkJson(authUserRegistrationModel)) { - return Promise.reject( - helper.getValidationMessage('authUserRegistrationModel') - ); + if (checkJson(authUserRegistrationModel)) { + return Promise.reject(getValidationMessage('authUserRegistrationModel')); } - if (helper.isNullOrWhiteSpace(sott)) { - return Promise.reject(helper.getValidationMessage('sott')); + if (isNullOrWhiteSpace(sott)) { + return Promise.reject(getValidationMessage('sott')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.sott = sott; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(options)) { + if (!isNullOrWhiteSpace(options)) { queryParameters.options = options; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/register'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, authUserRegistrationModel ); - }; + } /** * This API creates a user in the database as well as sends a verification email to the user. @@ -1215,8 +1187,7 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation, UserProfile data and Access Token *17.2 */ - - module.userRegistrationByCaptcha = function ( + userRegistrationByCaptcha ( authUserRegistrationModelWithCaptcha, emailTemplate, fields, @@ -1225,42 +1196,43 @@ module.exports = function (config) { verificationUrl, welcomeEmailTemplate ) { - if (helper.checkJson(authUserRegistrationModelWithCaptcha)) { + if (checkJson(authUserRegistrationModelWithCaptcha)) { return Promise.reject( - helper.getValidationMessage('authUserRegistrationModelWithCaptcha') + getValidationMessage('authUserRegistrationModelWithCaptcha') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(options)) { + if (!isNullOrWhiteSpace(options)) { queryParameters.options = options; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/register/captcha'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, authUserRegistrationModelWithCaptcha ); - }; + } /** * This API resends the verification email to the user. @@ -1270,31 +1242,31 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *17.3 */ - - module.authResendEmailVerification = function ( - email, - emailTemplate, - verificationUrl - ) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + authResendEmailVerification (email, emailTemplate, verificationUrl) { + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.email = email; var resourcePath = 'identity/v2/auth/register'; - return config.request('PUT', resourcePath, queryParameters, bodyParameters); - }; - return module; -}; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + bodyParameters + ); + } +} diff --git a/loginradius-sdk/src/api/authentication/oneTouchLoginApi.ts b/loginradius-sdk/src/api/authentication/oneTouchLoginApi.ts index c2416a0..61245ca 100644 --- a/loginradius-sdk/src/api/authentication/oneTouchLoginApi.ts +++ b/loginradius-sdk/src/api/authentication/oneTouchLoginApi.ts @@ -2,9 +2,17 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class OneTouchLoginApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API is used to send a link to a specified email for a frictionless login/registration @@ -15,40 +23,38 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *1.2 */ - - module.oneTouchLoginByEmail = function ( + oneTouchLoginByEmail ( oneTouchLoginByEmailModel, oneTouchLoginEmailTemplate, redirecturl, welcomeemailtemplate ) { - if (helper.checkJson(oneTouchLoginByEmailModel)) { - return Promise.reject( - helper.getValidationMessage('oneTouchLoginByEmailModel') - ); + if (checkJson(oneTouchLoginByEmailModel)) { + return Promise.reject(getValidationMessage('oneTouchLoginByEmailModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(oneTouchLoginEmailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(oneTouchLoginEmailTemplate)) { queryParameters.oneTouchLoginEmailTemplate = oneTouchLoginEmailTemplate; } - if (!helper.isNullOrWhiteSpace(redirecturl)) { + if (!isNullOrWhiteSpace(redirecturl)) { queryParameters.redirecturl = redirecturl; } - if (!helper.isNullOrWhiteSpace(welcomeemailtemplate)) { + if (!isNullOrWhiteSpace(welcomeemailtemplate)) { queryParameters.welcomeemailtemplate = welcomeemailtemplate; } var resourcePath = 'identity/v2/auth/onetouchlogin/email'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, oneTouchLoginByEmailModel ); - }; + } /** * This API is used to send one time password to a given phone number for a frictionless login/registration. @@ -57,32 +63,27 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *1.4 */ - - module.oneTouchLoginByPhone = function ( - oneTouchLoginByPhoneModel, - smsTemplate - ) { - if (helper.checkJson(oneTouchLoginByPhoneModel)) { - return Promise.reject( - helper.getValidationMessage('oneTouchLoginByPhoneModel') - ); + oneTouchLoginByPhone (oneTouchLoginByPhoneModel, smsTemplate) { + if (checkJson(oneTouchLoginByPhoneModel)) { + return Promise.reject(getValidationMessage('oneTouchLoginByPhoneModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } var resourcePath = 'identity/v2/auth/onetouchlogin/phone'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, oneTouchLoginByPhoneModel ); - }; + } /** * This API is used to verify the otp for One Touch Login. @@ -93,37 +94,37 @@ module.exports = function (config) { * @return Response Containing Access Token and Complete Profile Data *1.5 */ - - module.oneTouchLoginOTPVerification = function ( - otp, - phone, - fields, - smsTemplate - ) { - if (helper.isNullOrWhiteSpace(otp)) { - return Promise.reject(helper.getValidationMessage('otp')); + oneTouchLoginOTPVerification (otp, phone, fields, smsTemplate) { + if (isNullOrWhiteSpace(otp)) { + return Promise.reject(getValidationMessage('otp')); } - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.otp = otp; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.phone = phone; var resourcePath = 'identity/v2/auth/onetouchlogin/phone/verify'; - return config.request('PUT', resourcePath, queryParameters, bodyParameters); - }; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + bodyParameters + ); + } /** * This API verifies the provided token for One Touch Login @@ -132,26 +133,22 @@ module.exports = function (config) { * @return Complete verified response data *8.4.2 */ - - module.oneTouchEmailVerification = function ( - verificationToken, - welcomeEmailTemplate - ) { - if (helper.isNullOrWhiteSpace(verificationToken)) { - return Promise.reject(helper.getValidationMessage('verificationToken')); + oneTouchEmailVerification (verificationToken, welcomeEmailTemplate) { + if (isNullOrWhiteSpace(verificationToken)) { + return Promise.reject(getValidationMessage('verificationToken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.verificationToken = verificationToken; - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/email/onetouchlogin'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to check if the One Touch Login link has been clicked or not. @@ -160,22 +157,20 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.21.2 */ - - module.oneTouchLoginPing = function (clientGuid, fields) { - if (helper.isNullOrWhiteSpace(clientGuid)) { - return Promise.reject(helper.getValidationMessage('clientGuid')); + oneTouchLoginPing (clientGuid, fields) { + if (isNullOrWhiteSpace(clientGuid)) { + return Promise.reject(getValidationMessage('clientGuid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.clientGuid = clientGuid; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/auth/login/smartlogin/ping'; - return config.request('GET', resourcePath, queryParameters, null); - }; - return module; -}; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } +} diff --git a/loginradius-sdk/src/api/authentication/passwordLessLoginApi.ts b/loginradius-sdk/src/api/authentication/passwordLessLoginApi.ts index 3bf69f7..93c285b 100644 --- a/loginradius-sdk/src/api/authentication/passwordLessLoginApi.ts +++ b/loginradius-sdk/src/api/authentication/passwordLessLoginApi.ts @@ -2,9 +2,17 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class PasswordlessLoginApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API verifies an account by OTP and allows the customer to login. @@ -14,36 +22,34 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.6 */ - - module.passwordlessLoginPhoneVerification = function ( + passwordlessLoginPhoneVerification ( passwordLessLoginOtpModel, fields, smsTemplate ) { - if (helper.checkJson(passwordLessLoginOtpModel)) { - return Promise.reject( - helper.getValidationMessage('passwordLessLoginOtpModel') - ); + if (checkJson(passwordLessLoginOtpModel)) { + return Promise.reject(getValidationMessage('passwordLessLoginOtpModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } var resourcePath = 'identity/v2/auth/login/passwordlesslogin/otp/verify'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, passwordLessLoginOtpModel ); - }; + } /** * API can be used to send a One-time Passcode (OTP) provided that the account has a verified PhoneID @@ -52,23 +58,22 @@ module.exports = function (config) { * @return Response Containing Definition of SMS Data *9.15 */ - - module.passwordlessLoginByPhone = function (phone, smsTemplate) { - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + passwordlessLoginByPhone (phone, smsTemplate) { + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.phone = phone; - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } var resourcePath = 'identity/v2/auth/login/passwordlesslogin/otp'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to send a Passwordless Login verification link to the provided Email ID @@ -78,30 +83,25 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *9.18.1 */ - - module.passwordlessLoginByEmail = function ( - email, - passwordLessLoginTemplate, - verificationUrl - ) { - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + passwordlessLoginByEmail (email, passwordLessLoginTemplate, verificationUrl) { + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.email = email; - if (!helper.isNullOrWhiteSpace(passwordLessLoginTemplate)) { + if (!isNullOrWhiteSpace(passwordLessLoginTemplate)) { queryParameters.passwordLessLoginTemplate = passwordLessLoginTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } var resourcePath = 'identity/v2/auth/login/passwordlesslogin/email'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to send a Passwordless Login Verification Link to a customer by providing their UserName @@ -111,30 +111,29 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *9.18.2 */ - - module.passwordlessLoginByUserName = function ( + passwordlessLoginByUserName ( username, passwordLessLoginTemplate, verificationUrl ) { - if (helper.isNullOrWhiteSpace(username)) { - return Promise.reject(helper.getValidationMessage('username')); + if (isNullOrWhiteSpace(username)) { + return Promise.reject(getValidationMessage('username')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.username = username; - if (!helper.isNullOrWhiteSpace(passwordLessLoginTemplate)) { + if (!isNullOrWhiteSpace(passwordLessLoginTemplate)) { queryParameters.passwordLessLoginTemplate = passwordLessLoginTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } var resourcePath = 'identity/v2/auth/login/passwordlesslogin/email'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to verify the Passwordless Login verification link. Note: If you are using Passwordless Login by Phone you will need to use the Passwordless Login Phone Verification API @@ -144,30 +143,29 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.19 */ - - module.passwordlessLoginVerification = function ( + passwordlessLoginVerification ( verificationToken, fields, welcomeEmailTemplate ) { - if (helper.isNullOrWhiteSpace(verificationToken)) { - return Promise.reject(helper.getValidationMessage('verificationToken')); + if (isNullOrWhiteSpace(verificationToken)) { + return Promise.reject(getValidationMessage('verificationToken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apikey = config.apiKey; + queryParameters.apikey = this.config.apiKey; queryParameters.verificationToken = verificationToken; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/login/passwordlesslogin/email/verify'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to verify the otp sent to the email when doing a passwordless login. @@ -176,33 +174,33 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.23 */ - - module.passwordlessLoginVerificationByEmailAndOTP = function ( + passwordlessLoginVerificationByEmailAndOTP ( passwordLessLoginByEmailAndOtpModel, fields ) { - if (helper.checkJson(passwordLessLoginByEmailAndOtpModel)) { + if (checkJson(passwordLessLoginByEmailAndOtpModel)) { return Promise.reject( - helper.getValidationMessage('passwordLessLoginByEmailAndOtpModel') + getValidationMessage('passwordLessLoginByEmailAndOtpModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/auth/login/passwordlesslogin/email/verifyotp'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, passwordLessLoginByEmailAndOtpModel ); - }; + } /** * This API is used to verify the otp sent to the email when doing a passwordless login. @@ -211,32 +209,31 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.24 */ - - module.passwordlessLoginVerificationByUserNameAndOTP = function ( + passwordlessLoginVerificationByUserNameAndOTP ( passwordLessLoginByUserNameAndOtpModel, fields ) { - if (helper.checkJson(passwordLessLoginByUserNameAndOtpModel)) { + if (checkJson(passwordLessLoginByUserNameAndOtpModel)) { return Promise.reject( - helper.getValidationMessage('passwordLessLoginByUserNameAndOtpModel') + getValidationMessage('passwordLessLoginByUserNameAndOtpModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/auth/login/passwordlesslogin/username/verifyotp'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, passwordLessLoginByUserNameAndOtpModel ); - }; - return module; -}; + } +} diff --git a/loginradius-sdk/src/api/authentication/phoneAuthenticationApi.ts b/loginradius-sdk/src/api/authentication/phoneAuthenticationApi.ts index 8222bd7..7fbfc72 100644 --- a/loginradius-sdk/src/api/authentication/phoneAuthenticationApi.ts +++ b/loginradius-sdk/src/api/authentication/phoneAuthenticationApi.ts @@ -2,9 +2,17 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class PhoneAuthenticationApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API retrieves a copy of the user data based on the Phone @@ -15,40 +23,33 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.2.3 */ - - module.loginByPhone = function ( - phoneAuthenticationModel, - fields, - loginUrl, - smsTemplate - ) { - if (helper.checkJson(phoneAuthenticationModel)) { - return Promise.reject( - helper.getValidationMessage('phoneAuthenticationModel') - ); + loginByPhone (phoneAuthenticationModel, fields, loginUrl, smsTemplate) { + if (checkJson(phoneAuthenticationModel)) { + return Promise.reject(getValidationMessage('phoneAuthenticationModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(fields)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(loginUrl)) { + if (!isNullOrWhiteSpace(loginUrl)) { queryParameters.loginUrl = loginUrl; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } var resourcePath = 'identity/v2/auth/login'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, phoneAuthenticationModel ); - }; + } /** * This API is used to send the OTP to reset the account password. @@ -57,30 +58,30 @@ module.exports = function (config) { * @return Response Containing Validation Data and SMS Data *10.4 */ - - module.forgotPasswordByPhoneOTP = function (phone, smsTemplate) { - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + forgotPasswordByPhoneOTP (phone, smsTemplate) { + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.phone = phone; var resourcePath = 'identity/v2/auth/password/otp'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to reset the password @@ -88,26 +89,24 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *10.5 */ - - module.resetPasswordByPhoneOTP = function (resetPasswordByOTPModel) { - if (helper.checkJson(resetPasswordByOTPModel)) { - return Promise.reject( - helper.getValidationMessage('resetPasswordByOTPModel') - ); + resetPasswordByPhoneOTP (resetPasswordByOTPModel) { + if (checkJson(resetPasswordByOTPModel)) { + return Promise.reject(getValidationMessage('resetPasswordByOTPModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/password/otp'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPasswordByOTPModel ); - }; + } /** * This API is used to validate the verification code sent to verify a user's phone number @@ -118,32 +117,37 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *11.1.1 */ - - module.phoneVerificationByOTP = function (otp, phone, fields, smsTemplate) { - if (helper.isNullOrWhiteSpace(otp)) { - return Promise.reject(helper.getValidationMessage('otp')); + phoneVerificationByOTP (otp, phone, fields, smsTemplate) { + if (isNullOrWhiteSpace(otp)) { + return Promise.reject(getValidationMessage('otp')); } - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.otp = otp; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.phone = phone; var resourcePath = 'identity/v2/auth/phone/otp'; - return config.request('PUT', resourcePath, queryParameters, bodyParameters); - }; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + bodyParameters + ); + } /** * This API is used to consume the verification code sent to verify a user's phone number. Use this call for front-end purposes in cases where the user is already logged in by passing the user's access token. @@ -153,31 +157,26 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *11.1.2 */ - - module.phoneVerificationOTPByAccessToken = function ( - accessToken, - otp, - smsTemplate - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + phoneVerificationOTPByAccessToken (accessToken, otp, smsTemplate) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(otp)) { - return Promise.reject(helper.getValidationMessage('otp')); + if (isNullOrWhiteSpace(otp)) { + return Promise.reject(getValidationMessage('otp')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.otp = otp; - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } var resourcePath = 'identity/v2/auth/phone/otp'; - return config.request('PUT', resourcePath, queryParameters, null); - }; + return request(this.config, 'PUT', resourcePath, queryParameters, null); + } /** * This API is used to resend a verification OTP to verify a user's Phone Number. The user will receive a verification code that they will need to input @@ -186,30 +185,30 @@ module.exports = function (config) { * @return Response Containing Validation Data and SMS Data *11.2.1 */ - - module.phoneResendVerificationOTP = function (phone, smsTemplate) { - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + phoneResendVerificationOTP (phone, smsTemplate) { + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.phone = phone; var resourcePath = 'identity/v2/auth/phone/otp'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to resend a verification OTP to verify a user's Phone Number in cases in which an active token already exists @@ -219,38 +218,34 @@ module.exports = function (config) { * @return Response Containing Validation Data and SMS Data *11.2.2 */ - - module.phoneResendVerificationOTPByToken = function ( - accessToken, - phone, - smsTemplate - ) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + phoneResendVerificationOTPByToken (accessToken, phone, smsTemplate) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.phone = phone; var resourcePath = 'identity/v2/auth/phone/otp'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, bodyParameters ); - }; + } /** * This API is used to update the login Phone Number of users @@ -260,29 +255,34 @@ module.exports = function (config) { * @return Response Containing Validation Data and SMS Data *11.5 */ - - module.updatePhoneNumber = function (accessToken, phone, smsTemplate) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + updatePhoneNumber (accessToken, phone, smsTemplate) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - var bodyParameters = {}; + var bodyParameters: any = {}; bodyParameters.phone = phone; var resourcePath = 'identity/v2/auth/phone'; - return config.request('PUT', resourcePath, queryParameters, bodyParameters); - }; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + bodyParameters + ); + } /** * This API is used to check the Phone Number exists or not on your site. @@ -290,20 +290,19 @@ module.exports = function (config) { * @return Response containing Definition Complete ExistResponse data *11.6 */ - - module.checkPhoneNumberAvailability = function (phone) { - if (helper.isNullOrWhiteSpace(phone)) { - return Promise.reject(helper.getValidationMessage('phone')); + checkPhoneNumberAvailability (phone) { + if (isNullOrWhiteSpace(phone)) { + return Promise.reject(getValidationMessage('phone')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.phone = phone; var resourcePath = 'identity/v2/auth/phone'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to delete the Phone ID on a user's account via the access token @@ -311,20 +310,19 @@ module.exports = function (config) { * @return Response containing Definition of Delete Request *11.7 */ - - module.removePhoneIDByAccessToken = function (accessToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + removePhoneIDByAccessToken (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/phone'; - return config.request('DELETE', resourcePath, queryParameters, null); - }; + return request(this.config, 'DELETE', resourcePath, queryParameters, null); + } /** * This API registers the new users into your Cloud Storage and triggers the phone verification process. @@ -339,8 +337,7 @@ module.exports = function (config) { * @param {emailTemplate} Email Template Name *17.1.2 */ - - module.userRegistrationByPhone = function ( + userRegistrationByPhone ( authUserRegistrationModel, sott, fields, @@ -350,45 +347,43 @@ module.exports = function (config) { welcomeEmailTemplate, emailTemplate ) { - if (helper.checkJson(authUserRegistrationModel)) { - return Promise.reject( - helper.getValidationMessage('authUserRegistrationModel') - ); + if (checkJson(authUserRegistrationModel)) { + return Promise.reject(getValidationMessage('authUserRegistrationModel')); } - if (helper.isNullOrWhiteSpace(sott)) { - return Promise.reject(helper.getValidationMessage('sott')); + if (isNullOrWhiteSpace(sott)) { + return Promise.reject(getValidationMessage('sott')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.sott = sott; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(options)) { + if (!isNullOrWhiteSpace(options)) { queryParameters.options = options; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } var resourcePath = 'identity/v2/auth/register'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, authUserRegistrationModel ); - }; - return module; -}; + } +} diff --git a/loginradius-sdk/src/api/authentication/pinAuthenticationApi.ts b/loginradius-sdk/src/api/authentication/pinAuthenticationApi.ts index 5337d48..02ea42b 100644 --- a/loginradius-sdk/src/api/authentication/pinAuthenticationApi.ts +++ b/loginradius-sdk/src/api/authentication/pinAuthenticationApi.ts @@ -2,9 +2,17 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class PinAuthenticationApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API is used to login a user by pin and session token. @@ -13,28 +21,28 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.22 */ - - module.pinLogin = function (loginByPINModel, sessionToken) { - if (helper.checkJson(loginByPINModel)) { - return Promise.reject(helper.getValidationMessage('loginByPINModel')); + pinLogin (loginByPINModel, sessionToken) { + if (checkJson(loginByPINModel)) { + return Promise.reject(getValidationMessage('loginByPINModel')); } - if (helper.isNullOrWhiteSpace(sessionToken)) { - return Promise.reject(helper.getValidationMessage('sessionToken')); + if (isNullOrWhiteSpace(sessionToken)) { + return Promise.reject(getValidationMessage('sessionToken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.session_token = sessionToken; var resourcePath = 'identity/v2/auth/login/pin'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, loginByPINModel ); - }; + } /** * This API sends the reset pin email to specified email address. @@ -44,36 +52,34 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *42.1 */ - - module.sendForgotPINEmailByEmail = function ( + sendForgotPINEmailByEmail ( forgotPINLinkByEmailModel, emailTemplate, resetPINUrl ) { - if (helper.checkJson(forgotPINLinkByEmailModel)) { - return Promise.reject( - helper.getValidationMessage('forgotPINLinkByEmailModel') - ); + if (checkJson(forgotPINLinkByEmailModel)) { + return Promise.reject(getValidationMessage('forgotPINLinkByEmailModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(resetPINUrl)) { + if (!isNullOrWhiteSpace(resetPINUrl)) { queryParameters.resetPINUrl = resetPINUrl; } var resourcePath = 'identity/v2/auth/pin/forgot/email'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, forgotPINLinkByEmailModel ); - }; + } /** * This API sends the reset pin email using username. @@ -83,36 +89,36 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *42.2 */ - - module.sendForgotPINEmailByUsername = function ( + sendForgotPINEmailByUsername ( forgotPINLinkByUserNameModel, emailTemplate, resetPINUrl ) { - if (helper.checkJson(forgotPINLinkByUserNameModel)) { + if (checkJson(forgotPINLinkByUserNameModel)) { return Promise.reject( - helper.getValidationMessage('forgotPINLinkByUserNameModel') + getValidationMessage('forgotPINLinkByUserNameModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(resetPINUrl)) { + if (!isNullOrWhiteSpace(resetPINUrl)) { queryParameters.resetPINUrl = resetPINUrl; } var resourcePath = 'identity/v2/auth/pin/forgot/username'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, forgotPINLinkByUserNameModel ); - }; + } /** * This API is used to reset pin using reset token. @@ -120,26 +126,24 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *42.3 */ - - module.resetPINByResetToken = function (resetPINByResetToken) { - if (helper.checkJson(resetPINByResetToken)) { - return Promise.reject( - helper.getValidationMessage('resetPINByResetToken') - ); + resetPINByResetToken (resetPINByResetToken) { + if (checkJson(resetPINByResetToken)) { + return Promise.reject(getValidationMessage('resetPINByResetToken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/pin/reset/token'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPINByResetToken ); - }; + } /** * This API is used to reset pin using security question answer and email. @@ -147,30 +151,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *42.4 */ - - module.resetPINByEmailAndSecurityAnswer = function ( + resetPINByEmailAndSecurityAnswer ( resetPINBySecurityQuestionAnswerAndEmailModel ) { - if (helper.checkJson(resetPINBySecurityQuestionAnswerAndEmailModel)) { + if (checkJson(resetPINBySecurityQuestionAnswerAndEmailModel)) { return Promise.reject( - helper.getValidationMessage( - 'resetPINBySecurityQuestionAnswerAndEmailModel' - ) + getValidationMessage('resetPINBySecurityQuestionAnswerAndEmailModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/pin/reset/securityanswer/email'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPINBySecurityQuestionAnswerAndEmailModel ); - }; + } /** * This API is used to reset pin using security question answer and username. @@ -178,30 +180,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *42.5 */ - - module.resetPINByUsernameAndSecurityAnswer = function ( + resetPINByUsernameAndSecurityAnswer ( resetPINBySecurityQuestionAnswerAndUsernameModel ) { - if (helper.checkJson(resetPINBySecurityQuestionAnswerAndUsernameModel)) { + if (checkJson(resetPINBySecurityQuestionAnswerAndUsernameModel)) { return Promise.reject( - helper.getValidationMessage( - 'resetPINBySecurityQuestionAnswerAndUsernameModel' - ) + getValidationMessage('resetPINBySecurityQuestionAnswerAndUsernameModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/pin/reset/securityanswer/username'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPINBySecurityQuestionAnswerAndUsernameModel ); - }; + } /** * This API is used to reset pin using security question answer and phone. @@ -209,30 +209,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *42.6 */ - - module.resetPINByPhoneAndSecurityAnswer = function ( + resetPINByPhoneAndSecurityAnswer ( resetPINBySecurityQuestionAnswerAndPhoneModel ) { - if (helper.checkJson(resetPINBySecurityQuestionAnswerAndPhoneModel)) { + if (checkJson(resetPINBySecurityQuestionAnswerAndPhoneModel)) { return Promise.reject( - helper.getValidationMessage( - 'resetPINBySecurityQuestionAnswerAndPhoneModel' - ) + getValidationMessage('resetPINBySecurityQuestionAnswerAndPhoneModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/pin/reset/securityanswer/phone'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPINBySecurityQuestionAnswerAndPhoneModel ); - }; + } /** * This API sends the OTP to specified phone number @@ -241,32 +239,27 @@ module.exports = function (config) { * @return Response Containing Validation Data and SMS Data *42.7 */ - - module.sendForgotPINSMSByPhone = function ( - forgotPINOtpByPhoneModel, - smsTemplate - ) { - if (helper.checkJson(forgotPINOtpByPhoneModel)) { - return Promise.reject( - helper.getValidationMessage('forgotPINOtpByPhoneModel') - ); + sendForgotPINSMSByPhone (forgotPINOtpByPhoneModel, smsTemplate) { + if (checkJson(forgotPINOtpByPhoneModel)) { + return Promise.reject(getValidationMessage('forgotPINOtpByPhoneModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } var resourcePath = 'identity/v2/auth/pin/forgot/otp'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, forgotPINOtpByPhoneModel ); - }; + } /** * This API is used to change a user's PIN using access token. @@ -275,23 +268,28 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *42.8 */ - - module.changePINByAccessToken = function (accessToken, changePINModel) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + changePINByAccessToken (accessToken, changePINModel) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - if (helper.checkJson(changePINModel)) { - return Promise.reject(helper.getValidationMessage('changePINModel')); + if (checkJson(changePINModel)) { + return Promise.reject(getValidationMessage('changePINModel')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/pin/change'; - return config.request('PUT', resourcePath, queryParameters, changePINModel); - }; + return request( + this.config, + 'PUT', + resourcePath, + queryParameters, + changePINModel + ); + } /** * This API is used to reset pin using phoneId and OTP. @@ -299,26 +297,24 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *42.9 */ - - module.resetPINByPhoneAndOtp = function (resetPINByPhoneAndOTPModel) { - if (helper.checkJson(resetPINByPhoneAndOTPModel)) { - return Promise.reject( - helper.getValidationMessage('resetPINByPhoneAndOTPModel') - ); + resetPINByPhoneAndOtp (resetPINByPhoneAndOTPModel) { + if (checkJson(resetPINByPhoneAndOTPModel)) { + return Promise.reject(getValidationMessage('resetPINByPhoneAndOTPModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/pin/reset/otp/phone'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPINByPhoneAndOTPModel ); - }; + } /** * This API is used to reset pin using email and OTP. @@ -326,26 +322,24 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *42.10 */ - - module.resetPINByEmailAndOtp = function (resetPINByEmailAndOtpModel) { - if (helper.checkJson(resetPINByEmailAndOtpModel)) { - return Promise.reject( - helper.getValidationMessage('resetPINByEmailAndOtpModel') - ); + resetPINByEmailAndOtp (resetPINByEmailAndOtpModel) { + if (checkJson(resetPINByEmailAndOtpModel)) { + return Promise.reject(getValidationMessage('resetPINByEmailAndOtpModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/pin/reset/otp/email'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPINByEmailAndOtpModel ); - }; + } /** * This API is used to reset pin using username and OTP. @@ -353,26 +347,26 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *42.11 */ - - module.resetPINByUsernameAndOtp = function (resetPINByUsernameAndOtpModel) { - if (helper.checkJson(resetPINByUsernameAndOtpModel)) { + resetPINByUsernameAndOtp (resetPINByUsernameAndOtpModel) { + if (checkJson(resetPINByUsernameAndOtpModel)) { return Promise.reject( - helper.getValidationMessage('resetPINByUsernameAndOtpModel') + getValidationMessage('resetPINByUsernameAndOtpModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; var resourcePath = 'identity/v2/auth/pin/reset/otp/username'; - return config.request( + return request( + this.config, 'PUT', resourcePath, queryParameters, resetPINByUsernameAndOtpModel ); - }; + } /** * This API is used to change a user's PIN using Pin Auth token. @@ -381,28 +375,28 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *42.12 */ - - module.setPINByPinAuthToken = function (pINRequiredModel, pinAuthToken) { - if (helper.checkJson(pINRequiredModel)) { - return Promise.reject(helper.getValidationMessage('pINRequiredModel')); + setPINByPinAuthToken (pINRequiredModel, pinAuthToken) { + if (checkJson(pINRequiredModel)) { + return Promise.reject(getValidationMessage('pINRequiredModel')); } - if (helper.isNullOrWhiteSpace(pinAuthToken)) { - return Promise.reject(helper.getValidationMessage('pinAuthToken')); + if (isNullOrWhiteSpace(pinAuthToken)) { + return Promise.reject(getValidationMessage('pinAuthToken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.pinAuthToken = pinAuthToken; var resourcePath = 'identity/v2/auth/pin/set/pinauthtoken'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, pINRequiredModel ); - }; + } /** * This API is used to invalidate pin session token. @@ -410,19 +404,17 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *44.1 */ - - module.inValidatePinSessionToken = function (sessionToken) { - if (helper.isNullOrWhiteSpace(sessionToken)) { - return Promise.reject(helper.getValidationMessage('sessionToken')); + inValidatePinSessionToken (sessionToken) { + if (isNullOrWhiteSpace(sessionToken)) { + return Promise.reject(getValidationMessage('sessionToken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.session_token = sessionToken; var resourcePath = 'identity/v2/auth/session_token/invalidate'; - return config.request('GET', resourcePath, queryParameters, null); - }; - return module; -}; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } +} diff --git a/loginradius-sdk/src/api/authentication/riskBasedAuthenticationApi.ts b/loginradius-sdk/src/api/authentication/riskBasedAuthenticationApi.ts index 24ccbc1..b02455d 100644 --- a/loginradius-sdk/src/api/authentication/riskBasedAuthenticationApi.ts +++ b/loginradius-sdk/src/api/authentication/riskBasedAuthenticationApi.ts @@ -2,9 +2,17 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + checkJson, + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class RiskBasedAuthenticationApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API retrieves a copy of the user data based on the Email @@ -29,8 +37,7 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.2.4 */ - - module.rbaLoginByEmail = function ( + rbaLoginByEmail ( emailAuthenticationModel, emailTemplate, fields, @@ -50,75 +57,74 @@ module.exports = function (config) { smsTemplate, verificationUrl ) { - if (helper.checkJson(emailAuthenticationModel)) { - return Promise.reject( - helper.getValidationMessage('emailAuthenticationModel') - ); + if (checkJson(emailAuthenticationModel)) { + return Promise.reject(getValidationMessage('emailAuthenticationModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(loginUrl)) { + if (!isNullOrWhiteSpace(loginUrl)) { queryParameters.loginUrl = loginUrl; } if (passwordDelegation !== null) { queryParameters.passwordDelegation = passwordDelegation; } - if (!helper.isNullOrWhiteSpace(passwordDelegationApp)) { + if (!isNullOrWhiteSpace(passwordDelegationApp)) { queryParameters.passwordDelegationApp = passwordDelegationApp; } - if (!helper.isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { queryParameters.rbaBrowserEmailTemplate = rbaBrowserEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaBrowserSmsTemplate)) { + if (!isNullOrWhiteSpace(rbaBrowserSmsTemplate)) { queryParameters.rbaBrowserSmsTemplate = rbaBrowserSmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCityEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCityEmailTemplate)) { queryParameters.rbaCityEmailTemplate = rbaCityEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCitySmsTemplate)) { + if (!isNullOrWhiteSpace(rbaCitySmsTemplate)) { queryParameters.rbaCitySmsTemplate = rbaCitySmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCountryEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCountryEmailTemplate)) { queryParameters.rbaCountryEmailTemplate = rbaCountryEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCountrySmsTemplate)) { + if (!isNullOrWhiteSpace(rbaCountrySmsTemplate)) { queryParameters.rbaCountrySmsTemplate = rbaCountrySmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaIpEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaIpEmailTemplate)) { queryParameters.rbaIpEmailTemplate = rbaIpEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaIpSmsTemplate)) { + if (!isNullOrWhiteSpace(rbaIpSmsTemplate)) { queryParameters.rbaIpSmsTemplate = rbaIpSmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaOneclickEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaOneclickEmailTemplate)) { queryParameters.rbaOneclickEmailTemplate = rbaOneclickEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaOTPSmsTemplate)) { + if (!isNullOrWhiteSpace(rbaOTPSmsTemplate)) { queryParameters.rbaOTPSmsTemplate = rbaOTPSmsTemplate; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } var resourcePath = 'identity/v2/auth/login'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, emailAuthenticationModel ); - }; + } /** * This API retrieves a copy of the user data based on the Username @@ -143,8 +149,7 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.2.5 */ - - module.rbaLoginByUserName = function ( + rbaLoginByUserName ( userNameAuthenticationModel, emailTemplate, fields, @@ -164,75 +169,76 @@ module.exports = function (config) { smsTemplate, verificationUrl ) { - if (helper.checkJson(userNameAuthenticationModel)) { + if (checkJson(userNameAuthenticationModel)) { return Promise.reject( - helper.getValidationMessage('userNameAuthenticationModel') + getValidationMessage('userNameAuthenticationModel') ); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(loginUrl)) { + if (!isNullOrWhiteSpace(loginUrl)) { queryParameters.loginUrl = loginUrl; } if (passwordDelegation !== null) { queryParameters.passwordDelegation = passwordDelegation; } - if (!helper.isNullOrWhiteSpace(passwordDelegationApp)) { + if (!isNullOrWhiteSpace(passwordDelegationApp)) { queryParameters.passwordDelegationApp = passwordDelegationApp; } - if (!helper.isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { queryParameters.rbaBrowserEmailTemplate = rbaBrowserEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaBrowserSmsTemplate)) { + if (!isNullOrWhiteSpace(rbaBrowserSmsTemplate)) { queryParameters.rbaBrowserSmsTemplate = rbaBrowserSmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCityEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCityEmailTemplate)) { queryParameters.rbaCityEmailTemplate = rbaCityEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCitySmsTemplate)) { + if (!isNullOrWhiteSpace(rbaCitySmsTemplate)) { queryParameters.rbaCitySmsTemplate = rbaCitySmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCountryEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCountryEmailTemplate)) { queryParameters.rbaCountryEmailTemplate = rbaCountryEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCountrySmsTemplate)) { + if (!isNullOrWhiteSpace(rbaCountrySmsTemplate)) { queryParameters.rbaCountrySmsTemplate = rbaCountrySmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaIpEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaIpEmailTemplate)) { queryParameters.rbaIpEmailTemplate = rbaIpEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaIpSmsTemplate)) { + if (!isNullOrWhiteSpace(rbaIpSmsTemplate)) { queryParameters.rbaIpSmsTemplate = rbaIpSmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaOneclickEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaOneclickEmailTemplate)) { queryParameters.rbaOneclickEmailTemplate = rbaOneclickEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaOTPSmsTemplate)) { + if (!isNullOrWhiteSpace(rbaOTPSmsTemplate)) { queryParameters.rbaOTPSmsTemplate = rbaOTPSmsTemplate; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } var resourcePath = 'identity/v2/auth/login'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, userNameAuthenticationModel ); - }; + } /** * This API retrieves a copy of the user data based on the Phone @@ -257,8 +263,7 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.2.6 */ - - module.rbaLoginByPhone = function ( + rbaLoginByPhone ( phoneAuthenticationModel, emailTemplate, fields, @@ -278,74 +283,72 @@ module.exports = function (config) { smsTemplate, verificationUrl ) { - if (helper.checkJson(phoneAuthenticationModel)) { - return Promise.reject( - helper.getValidationMessage('phoneAuthenticationModel') - ); + if (checkJson(phoneAuthenticationModel)) { + return Promise.reject(getValidationMessage('phoneAuthenticationModel')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; - if (!helper.isNullOrWhiteSpace(emailTemplate)) { + queryParameters.apiKey = this.config.apiKey; + if (!isNullOrWhiteSpace(emailTemplate)) { queryParameters.emailTemplate = emailTemplate; } - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } - if (!helper.isNullOrWhiteSpace(loginUrl)) { + if (!isNullOrWhiteSpace(loginUrl)) { queryParameters.loginUrl = loginUrl; } if (passwordDelegation !== null) { queryParameters.passwordDelegation = passwordDelegation; } - if (!helper.isNullOrWhiteSpace(passwordDelegationApp)) { + if (!isNullOrWhiteSpace(passwordDelegationApp)) { queryParameters.passwordDelegationApp = passwordDelegationApp; } - if (!helper.isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaBrowserEmailTemplate)) { queryParameters.rbaBrowserEmailTemplate = rbaBrowserEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaBrowserSmsTemplate)) { + if (!isNullOrWhiteSpace(rbaBrowserSmsTemplate)) { queryParameters.rbaBrowserSmsTemplate = rbaBrowserSmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCityEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCityEmailTemplate)) { queryParameters.rbaCityEmailTemplate = rbaCityEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCitySmsTemplate)) { + if (!isNullOrWhiteSpace(rbaCitySmsTemplate)) { queryParameters.rbaCitySmsTemplate = rbaCitySmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCountryEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaCountryEmailTemplate)) { queryParameters.rbaCountryEmailTemplate = rbaCountryEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaCountrySmsTemplate)) { + if (!isNullOrWhiteSpace(rbaCountrySmsTemplate)) { queryParameters.rbaCountrySmsTemplate = rbaCountrySmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaIpEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaIpEmailTemplate)) { queryParameters.rbaIpEmailTemplate = rbaIpEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaIpSmsTemplate)) { + if (!isNullOrWhiteSpace(rbaIpSmsTemplate)) { queryParameters.rbaIpSmsTemplate = rbaIpSmsTemplate; } - if (!helper.isNullOrWhiteSpace(rbaOneclickEmailTemplate)) { + if (!isNullOrWhiteSpace(rbaOneclickEmailTemplate)) { queryParameters.rbaOneclickEmailTemplate = rbaOneclickEmailTemplate; } - if (!helper.isNullOrWhiteSpace(rbaOTPSmsTemplate)) { + if (!isNullOrWhiteSpace(rbaOTPSmsTemplate)) { queryParameters.rbaOTPSmsTemplate = rbaOTPSmsTemplate; } - if (!helper.isNullOrWhiteSpace(smsTemplate)) { + if (!isNullOrWhiteSpace(smsTemplate)) { queryParameters.smsTemplate = smsTemplate; } - if (!helper.isNullOrWhiteSpace(verificationUrl)) { + if (!isNullOrWhiteSpace(verificationUrl)) { queryParameters.verificationUrl = verificationUrl; } var resourcePath = 'identity/v2/auth/login'; - return config.request( + return request( + this.config, 'POST', resourcePath, queryParameters, phoneAuthenticationModel ); - }; - return module; -}; + } +} diff --git a/loginradius-sdk/src/api/authentication/smartLoginApi.ts b/loginradius-sdk/src/api/authentication/smartLoginApi.ts index 8d69ea3..9976f3c 100644 --- a/loginradius-sdk/src/api/authentication/smartLoginApi.ts +++ b/loginradius-sdk/src/api/authentication/smartLoginApi.ts @@ -2,9 +2,16 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class SmartLoginApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API verifies the provided token for Smart Login @@ -13,26 +20,22 @@ module.exports = function (config) { * @return Complete verified response data *8.4.1 */ - - module.smartLoginTokenVerification = function ( - verificationToken, - welcomeEmailTemplate - ) { - if (helper.isNullOrWhiteSpace(verificationToken)) { - return Promise.reject(helper.getValidationMessage('verificationToken')); + smartLoginTokenVerification (verificationToken, welcomeEmailTemplate) { + if (isNullOrWhiteSpace(verificationToken)) { + return Promise.reject(getValidationMessage('verificationToken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.verificationToken = verificationToken; - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/email/smartlogin'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API sends a Smart Login link to the user's Email Id. @@ -44,39 +47,38 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *9.17.1 */ - - module.smartLoginByEmail = function ( + smartLoginByEmail ( clientGuid, email, redirectUrl, smartLoginEmailTemplate, welcomeEmailTemplate ) { - if (helper.isNullOrWhiteSpace(clientGuid)) { - return Promise.reject(helper.getValidationMessage('clientGuid')); + if (isNullOrWhiteSpace(clientGuid)) { + return Promise.reject(getValidationMessage('clientGuid')); } - if (helper.isNullOrWhiteSpace(email)) { - return Promise.reject(helper.getValidationMessage('email')); + if (isNullOrWhiteSpace(email)) { + return Promise.reject(getValidationMessage('email')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.clientGuid = clientGuid; queryParameters.email = email; - if (!helper.isNullOrWhiteSpace(redirectUrl)) { + if (!isNullOrWhiteSpace(redirectUrl)) { queryParameters.redirectUrl = redirectUrl; } - if (!helper.isNullOrWhiteSpace(smartLoginEmailTemplate)) { + if (!isNullOrWhiteSpace(smartLoginEmailTemplate)) { queryParameters.smartLoginEmailTemplate = smartLoginEmailTemplate; } - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/login/smartlogin'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API sends a Smart Login link to the user's Email Id. @@ -88,39 +90,38 @@ module.exports = function (config) { * @return Response containing Definition of Complete Validation data *9.17.2 */ - - module.smartLoginByUserName = function ( + smartLoginByUserName ( clientGuid, username, redirectUrl, smartLoginEmailTemplate, welcomeEmailTemplate ) { - if (helper.isNullOrWhiteSpace(clientGuid)) { - return Promise.reject(helper.getValidationMessage('clientGuid')); + if (isNullOrWhiteSpace(clientGuid)) { + return Promise.reject(getValidationMessage('clientGuid')); } - if (helper.isNullOrWhiteSpace(username)) { - return Promise.reject(helper.getValidationMessage('username')); + if (isNullOrWhiteSpace(username)) { + return Promise.reject(getValidationMessage('username')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.clientGuid = clientGuid; queryParameters.username = username; - if (!helper.isNullOrWhiteSpace(redirectUrl)) { + if (!isNullOrWhiteSpace(redirectUrl)) { queryParameters.redirectUrl = redirectUrl; } - if (!helper.isNullOrWhiteSpace(smartLoginEmailTemplate)) { + if (!isNullOrWhiteSpace(smartLoginEmailTemplate)) { queryParameters.smartLoginEmailTemplate = smartLoginEmailTemplate; } - if (!helper.isNullOrWhiteSpace(welcomeEmailTemplate)) { + if (!isNullOrWhiteSpace(welcomeEmailTemplate)) { queryParameters.welcomeEmailTemplate = welcomeEmailTemplate; } var resourcePath = 'identity/v2/auth/login/smartlogin'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to check if the Smart Login link has been clicked or not @@ -129,22 +130,20 @@ module.exports = function (config) { * @return Response containing User Profile Data and access token *9.21.1 */ - - module.smartLoginPing = function (clientGuid, fields) { - if (helper.isNullOrWhiteSpace(clientGuid)) { - return Promise.reject(helper.getValidationMessage('clientGuid')); + smartLoginPing (clientGuid, fields) { + if (isNullOrWhiteSpace(clientGuid)) { + return Promise.reject(getValidationMessage('clientGuid')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.clientGuid = clientGuid; - if (!helper.isNullOrWhiteSpace(fields)) { + if (!isNullOrWhiteSpace(fields)) { queryParameters.fields = fields; } var resourcePath = 'identity/v2/auth/login/smartlogin/ping'; - return config.request('GET', resourcePath, queryParameters, null); - }; - return module; -}; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } +} diff --git a/loginradius-sdk/src/api/social/nativeSocialApi.ts b/loginradius-sdk/src/api/social/nativeSocialApi.ts index f7b8164..7bb17a5 100644 --- a/loginradius-sdk/src/api/social/nativeSocialApi.ts +++ b/loginradius-sdk/src/api/social/nativeSocialApi.ts @@ -2,9 +2,16 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class NativeSocialApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * The API is used to get LoginRadius access token by sending Facebook's access token. It will be valid for the specific duration of time specified in the response. @@ -13,26 +20,22 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.3 */ - - module.getAccessTokenByFacebookAccessToken = function ( - fbAccessToken, - socialAppName - ) { - if (helper.isNullOrWhiteSpace(fbAccessToken)) { - return Promise.reject(helper.getValidationMessage('fbAccessToken')); + getAccessTokenByFacebookAccessToken (fbAccessToken, socialAppName) { + if (isNullOrWhiteSpace(fbAccessToken)) { + return Promise.reject(getValidationMessage('fbAccessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.fb_Access_Token = fbAccessToken; - queryParameters.key = config.apiKey; - if (!helper.isNullOrWhiteSpace(socialAppName)) { + queryParameters.key = this.config.apiKey; + if (!isNullOrWhiteSpace(socialAppName)) { queryParameters.socialAppName = socialAppName; } var resourcePath = 'api/v2/access_token/facebook'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * The API is used to get LoginRadius access token by sending Twitter's access token. It will be valid for the specific duration of time specified in the response. @@ -42,31 +45,30 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.4 */ - - module.getAccessTokenByTwitterAccessToken = function ( + getAccessTokenByTwitterAccessToken ( twAccessToken, twTokenSecret, socialAppName ) { - if (helper.isNullOrWhiteSpace(twAccessToken)) { - return Promise.reject(helper.getValidationMessage('twAccessToken')); + if (isNullOrWhiteSpace(twAccessToken)) { + return Promise.reject(getValidationMessage('twAccessToken')); } - if (helper.isNullOrWhiteSpace(twTokenSecret)) { - return Promise.reject(helper.getValidationMessage('twTokenSecret')); + if (isNullOrWhiteSpace(twTokenSecret)) { + return Promise.reject(getValidationMessage('twTokenSecret')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.key = config.apiKey; + queryParameters.key = this.config.apiKey; queryParameters.tw_Access_Token = twAccessToken; queryParameters.tw_Token_Secret = twTokenSecret; - if (!helper.isNullOrWhiteSpace(socialAppName)) { + if (!isNullOrWhiteSpace(socialAppName)) { queryParameters.socialAppName = socialAppName; } var resourcePath = 'api/v2/access_token/twitter'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * The API is used to get LoginRadius access token by sending Google's access token. It will be valid for the specific duration of time specified in the response. @@ -77,34 +79,33 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.5 */ - - module.getAccessTokenByGoogleAccessToken = function ( + getAccessTokenByGoogleAccessToken ( googleAccessToken, clientId, refreshToken, socialAppName ) { - if (helper.isNullOrWhiteSpace(googleAccessToken)) { - return Promise.reject(helper.getValidationMessage('googleAccessToken')); + if (isNullOrWhiteSpace(googleAccessToken)) { + return Promise.reject(getValidationMessage('googleAccessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.google_Access_Token = googleAccessToken; - queryParameters.key = config.apiKey; - if (!helper.isNullOrWhiteSpace(clientId)) { + queryParameters.key = this.config.apiKey; + if (!isNullOrWhiteSpace(clientId)) { queryParameters.client_id = clientId; } - if (!helper.isNullOrWhiteSpace(refreshToken)) { + if (!isNullOrWhiteSpace(refreshToken)) { queryParameters.refresh_token = refreshToken; } - if (!helper.isNullOrWhiteSpace(socialAppName)) { + if (!isNullOrWhiteSpace(socialAppName)) { queryParameters.socialAppName = socialAppName; } var resourcePath = 'api/v2/access_token/google'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to Get LoginRadius Access Token using google jwt id token for google native mobile login/registration. @@ -112,20 +113,19 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.6 */ - - module.getAccessTokenByGoogleJWTAccessToken = function (idToken) { - if (helper.isNullOrWhiteSpace(idToken)) { - return Promise.reject(helper.getValidationMessage('idToken')); + getAccessTokenByGoogleJWTAccessToken (idToken) { + if (isNullOrWhiteSpace(idToken)) { + return Promise.reject(getValidationMessage('idToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.id_Token = idToken; - queryParameters.key = config.apiKey; + queryParameters.key = this.config.apiKey; var resourcePath = 'api/v2/access_token/googlejwt'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * The API is used to get LoginRadius access token by sending Linkedin's access token. It will be valid for the specific duration of time specified in the response. @@ -134,26 +134,22 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.7 */ - - module.getAccessTokenByLinkedinAccessToken = function ( - lnAccessToken, - socialAppName - ) { - if (helper.isNullOrWhiteSpace(lnAccessToken)) { - return Promise.reject(helper.getValidationMessage('lnAccessToken')); + getAccessTokenByLinkedinAccessToken (lnAccessToken, socialAppName) { + if (isNullOrWhiteSpace(lnAccessToken)) { + return Promise.reject(getValidationMessage('lnAccessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.key = config.apiKey; + queryParameters.key = this.config.apiKey; queryParameters.ln_Access_Token = lnAccessToken; - if (!helper.isNullOrWhiteSpace(socialAppName)) { + if (!isNullOrWhiteSpace(socialAppName)) { queryParameters.socialAppName = socialAppName; } var resourcePath = 'api/v2/access_token/linkedin'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * The API is used to get LoginRadius access token by sending Foursquare's access token. It will be valid for the specific duration of time specified in the response. @@ -161,20 +157,19 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.8 */ - - module.getAccessTokenByFoursquareAccessToken = function (fsAccessToken) { - if (helper.isNullOrWhiteSpace(fsAccessToken)) { - return Promise.reject(helper.getValidationMessage('fsAccessToken')); + getAccessTokenByFoursquareAccessToken (fsAccessToken) { + if (isNullOrWhiteSpace(fsAccessToken)) { + return Promise.reject(getValidationMessage('fsAccessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.fs_Access_Token = fsAccessToken; - queryParameters.key = config.apiKey; + queryParameters.key = this.config.apiKey; var resourcePath = 'api/v2/access_token/foursquare'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * The API is used to get LoginRadius access token by sending a valid Apple ID OAuth Code. It will be valid for the specific duration of time specified in the response. @@ -183,23 +178,22 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.12 */ - - module.getAccessTokenByAppleIdCode = function (code, socialAppName) { - if (helper.isNullOrWhiteSpace(code)) { - return Promise.reject(helper.getValidationMessage('code')); + getAccessTokenByAppleIdCode (code, socialAppName) { + if (isNullOrWhiteSpace(code)) { + return Promise.reject(getValidationMessage('code')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.code = code; - queryParameters.key = config.apiKey; - if (!helper.isNullOrWhiteSpace(socialAppName)) { + queryParameters.key = this.config.apiKey; + if (!isNullOrWhiteSpace(socialAppName)) { queryParameters.socialAppName = socialAppName; } var resourcePath = 'api/v2/access_token/apple'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API is used to retrieve a LoginRadius access token by passing in a valid WeChat OAuth Code. @@ -207,20 +201,19 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.13 */ - - module.getAccessTokenByWeChatCode = function (code) { - if (helper.isNullOrWhiteSpace(code)) { - return Promise.reject(helper.getValidationMessage('code')); + getAccessTokenByWeChatCode (code) { + if (isNullOrWhiteSpace(code)) { + return Promise.reject(getValidationMessage('code')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.code = code; - queryParameters.key = config.apiKey; + queryParameters.key = this.config.apiKey; var resourcePath = 'api/v2/access_token/wechat'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * The API is used to get LoginRadius access token by sending Google's AuthCode. It will be valid for the specific duration of time specified in the response. @@ -229,25 +222,20 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.16 */ - - module.getAccessTokenByGoogleAuthCode = function ( - googleAuthcode, - socialAppName - ) { - if (helper.isNullOrWhiteSpace(googleAuthcode)) { - return Promise.reject(helper.getValidationMessage('googleAuthcode')); + getAccessTokenByGoogleAuthCode (googleAuthcode, socialAppName) { + if (isNullOrWhiteSpace(googleAuthcode)) { + return Promise.reject(getValidationMessage('googleAuthcode')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.apiKey = config.apiKey; + queryParameters.apiKey = this.config.apiKey; queryParameters.google_authcode = googleAuthcode; - if (!helper.isNullOrWhiteSpace(socialAppName)) { + if (!isNullOrWhiteSpace(socialAppName)) { queryParameters.socialAppName = socialAppName; } var resourcePath = 'api/v2/access_token/google'; - return config.request('GET', resourcePath, queryParameters, null); - }; - return module; -}; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } +} diff --git a/loginradius-sdk/src/api/social/socialApi.ts b/loginradius-sdk/src/api/social/socialApi.ts index 43df014..191f67f 100644 --- a/loginradius-sdk/src/api/social/socialApi.ts +++ b/loginradius-sdk/src/api/social/socialApi.ts @@ -2,9 +2,16 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config) { - var module = {}; - var helper = require(config.HELPER_PATH)(); +import { + getValidationMessage, + isNullOrWhiteSpace, + request +} from '../../util/helper'; +import { LoginRadiusConfig } from '../../types'; + +export default class SocialApi { + // eslint-disable-next-line no-useless-constructor, no-unused-vars, no-empty-function + constructor (private config: LoginRadiusConfig) {} /** * This API Is used to translate the Request Token returned during authentication into an Access Token that can be used with other API calls. @@ -12,20 +19,19 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.1 */ - - module.exchangeAccessToken = function (token) { - if (helper.isNullOrWhiteSpace(token)) { - return Promise.reject(helper.getValidationMessage('token')); + exchangeAccessToken (token) { + if (isNullOrWhiteSpace(token)) { + return Promise.reject(getValidationMessage('token')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.secret = config.apiSecret; + queryParameters.secret = this.config.apiSecret; queryParameters.token = token; var resourcePath = 'api/v2/access_token'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * The Refresh Access Token API is used to refresh the provider access token after authentication. It will be valid for up to 60 days on LoginRadius depending on the provider. In order to use the access token in other APIs, always refresh the token using this API.

Supported Providers : Facebook,Yahoo,Google,Twitter, Linkedin.

Contact LoginRadius support team to enable this API. @@ -35,15 +41,14 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.2 */ - - module.refreshAccessToken = function (accessToken, expiresIn, isWeb) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + refreshAccessToken (accessToken, expiresIn, isWeb) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.secret = config.apiSecret; + queryParameters.secret = this.config.apiSecret; if (expiresIn !== null) { queryParameters.expiresIn = expiresIn; } @@ -53,8 +58,8 @@ module.exports = function (config) { var resourcePath = 'api/v2/access_token/refresh'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This API validates access token, if valid then returns a response with its expiry otherwise error. @@ -62,21 +67,20 @@ module.exports = function (config) { * @return Response containing Definition of Complete Token data *20.9 */ - - module.validateAccessToken = function (accessToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + validateAccessToken (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.key = config.apiKey; - queryParameters.secret = config.apiSecret; + queryParameters.key = this.config.apiKey; + queryParameters.secret = this.config.apiSecret; var resourcePath = 'api/v2/access_token/validate'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This api invalidates the active access token or expires an access token validity. @@ -84,21 +88,20 @@ module.exports = function (config) { * @return Response containing Definition for Complete Validation data *20.10 */ - - module.inValidateAccessToken = function (accessToken) { - if (helper.isNullOrWhiteSpace(accessToken)) { - return Promise.reject(helper.getValidationMessage('accessToken')); + inValidateAccessToken (accessToken) { + if (isNullOrWhiteSpace(accessToken)) { + return Promise.reject(getValidationMessage('accessToken')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.access_token = accessToken; - queryParameters.key = config.apiKey; - queryParameters.secret = config.apiSecret; + queryParameters.key = this.config.apiKey; + queryParameters.secret = this.config.apiSecret; var resourcePath = 'api/v2/access_token/invalidate'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This api is use to get all active session by Access Token. @@ -106,21 +109,20 @@ module.exports = function (config) { * @return Response containing Definition for Complete active sessions *20.11.1 */ - - module.getActiveSession = function (token) { - if (helper.isNullOrWhiteSpace(token)) { - return Promise.reject(helper.getValidationMessage('token')); + getActiveSession (token) { + if (isNullOrWhiteSpace(token)) { + return Promise.reject(getValidationMessage('token')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.key = config.apiKey; - queryParameters.secret = config.apiSecret; + queryParameters.key = this.config.apiKey; + queryParameters.secret = this.config.apiSecret; queryParameters.token = token; var resourcePath = 'api/v2/access_token/activesession'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This api is used to get all active sessions by AccountID(UID). @@ -128,21 +130,20 @@ module.exports = function (config) { * @return Response containing Definition for Complete active sessions *20.11.2 */ - - module.getActiveSessionByAccountID = function (accountId) { - if (helper.isNullOrWhiteSpace(accountId)) { - return Promise.reject(helper.getValidationMessage('accountId')); + getActiveSessionByAccountID (accountId) { + if (isNullOrWhiteSpace(accountId)) { + return Promise.reject(getValidationMessage('accountId')); } - var queryParameters = {}; + var queryParameters: any = {}; queryParameters.accountId = accountId; - queryParameters.key = config.apiKey; - queryParameters.secret = config.apiSecret; + queryParameters.key = this.config.apiKey; + queryParameters.secret = this.config.apiSecret; var resourcePath = 'api/v2/access_token/activesession'; - return config.request('GET', resourcePath, queryParameters, null); - }; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } /** * This api is used to get all active sessions by ProfileId. @@ -150,20 +151,18 @@ module.exports = function (config) { * @return Response containing Definition for Complete active sessions *20.11.3 */ - - module.getActiveSessionByProfileID = function (profileId) { - if (helper.isNullOrWhiteSpace(profileId)) { - return Promise.reject(helper.getValidationMessage('profileId')); + getActiveSessionByProfileID (profileId) { + if (isNullOrWhiteSpace(profileId)) { + return Promise.reject(getValidationMessage('profileId')); } - var queryParameters = {}; + var queryParameters: any = {}; - queryParameters.key = config.apiKey; + queryParameters.key = this.config.apiKey; queryParameters.profileId = profileId; - queryParameters.secret = config.apiSecret; + queryParameters.secret = this.config.apiSecret; var resourcePath = 'api/v2/access_token/activesession'; - return config.request('GET', resourcePath, queryParameters, null); - }; - return module; -}; + return request(this.config, 'GET', resourcePath, queryParameters, null); + } +} diff --git a/loginradius-sdk/src/types.ts b/loginradius-sdk/src/types.ts new file mode 100644 index 0000000..9e6b452 --- /dev/null +++ b/loginradius-sdk/src/types.ts @@ -0,0 +1,14 @@ +export interface LoginRadiusConfig { + apiSecret: string; + serverRegion?: string; + originIp?: string; + apiDomain?: any; + proxy: { + host: string; + port: number; + }; + fieldsParam: string; + fieldsValue?: string; + apiRequestSigning?: boolean; + apiKey: string; +} diff --git a/loginradius-sdk/src/util/helper.ts b/loginradius-sdk/src/util/helper.ts index be3d48a..aa64139 100644 --- a/loginradius-sdk/src/util/helper.ts +++ b/loginradius-sdk/src/util/helper.ts @@ -2,174 +2,294 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -module.exports = function (config = {}) { - var module = {}; - var querystring = require('querystring'); - var crypto = require('crypto'); - - /** - * Define the JSON error format - */ - var jsondata = { - Description: 'Oops something went wrong, Please try again.', - ErrorCode: 1000, - Message: 'Oops something went wrong, Please try again.', - IsProviderError: false, - ProviderErrorResponse: null - }; - /** - * Check null or undefined - * @param {string} as input - * @return input is null or not - */ - module.isNullOrWhiteSpace = function (input) { - return !(input === null || typeof input === 'undefined' ? '' : input); +import crypto from 'crypto'; +import https from 'https'; +import querystring from 'querystring'; +import sott from './sott'; + +const jsonData = { + Description: 'Oops something went wrong, Please try again.', + ErrorCode: 1000, + Message: 'Oops something went wrong, Please try again.', + IsProviderError: false, + ProviderErrorResponse: null +}; + +/** + * Check null or undefined + * @param {string} as input + * @return input is null or not + */ +export function isNullOrWhiteSpace (input) { + return !(input === null || typeof input === 'undefined' ? '' : input); +} + +/** + * Get Error response + * @param {string} status + * @param {json} input + * @return json of api response + */ +export function checkError (status, input) { + if (status === 'serverError') { + return input !== '' ? input : jsonData; + } + return input && input.ErrorCode; +} + +/** + * Check json is correct or not + * @param {string} input + * @return input is json or not + */ +export function checkJson (input) { + return !!( + input === null || + input === undefined || + Array.isArray(input) || + typeof input !== 'object' + ); +} + +/** + * Generate the sott + * @param {json} config as site config + * @param {string} startDate as start date + * @param {string} endDate as end date + * @return generated sott + */ +export async function getSott (sottconfig, startDate, endDate, timeDifference) { + try { + return await sott(sottconfig, startDate, endDate, timeDifference); + } catch (err) { + throw err; + } +} + +/** + * Get Validation Message + * @param {string} type as error string + * @return jsondata as json error object + */ +export function getValidationMessage (type) { + return { + ...jsonData, + Description: `The API Request Parameter ${type} is not Correct or WellFormated` }; +} - /** - * Get Error response - * @param {string} status - * @param {json} input - * @return json of api response - */ - module.checkError = function (status, input) { - if (status === 'serverError') { - return input !== '' ? input : jsondata; +/** + * Manage the api response + * @param {string} status as error status + * @param {json} data as response data + * @param {*} resolve as promise resolve + * @param {*} reject as promise reject + */ +export function manageRequestResponse (status, data, resolve, reject) { + if (checkError(status, data)) { + if (!data) { + data = checkError(status, data); } - return input && input.ErrorCode; - }; + reject(data); + } else { + resolve(data); + } +} + +/** + * Get Query String + * @param {object} string as json input object + * @return qauery string + */ +export function getQueryString (string) { + return querystring.stringify(string, undefined, undefined, { + encodeURIComponent + }); +} + +/** + * Generate signin header + * @param {object} options as options object + * @param {string} apiSecret + * @return header object + */ +export function generateSigningHeader (options, apiSecret) { + var SIXTY = 60; + var SIXTYTHOUSAND = 60000; + var TEN = 10; + var expiryDate = new Date(); + expiryDate = new Date(expiryDate.getTime() + SIXTY * SIXTYTHOUSAND); + var month = expiryDate.getMonth() + 1; - /** - * Check json is correct or not - * @param {string} input - * @return input is json or not - */ - module.checkJson = function (input) { - return !!( - input === null || - input === undefined || - Array.isArray(input) || - typeof input !== 'object' - ); + var expiryDateStr = + expiryDate.getFullYear() + + '-' + + (month < TEN ? '0' + month : month) + + '-' + + (expiryDate.getDate() < TEN + ? '0' + expiryDate.getDate() + : expiryDate.getDate()) + + ' ' + + (expiryDate.getHours() < TEN + ? '0' + expiryDate.getHours() + : expiryDate.getHours()) + + ':' + + (expiryDate.getMinutes() < TEN + ? '0' + expiryDate.getMinutes() + : expiryDate.getMinutes()) + + ':' + + (expiryDate.getSeconds() < TEN + ? '0' + expiryDate.getSeconds() + : expiryDate.getSeconds()); + + var encodeUrl = encodeURIComponent( + decodeURIComponent(options.uri) + ).toLowerCase(); + + var urlString; + if (options.body) { + urlString = expiryDateStr + ':' + encodeUrl + ':' + options.body; + } else { + urlString = expiryDateStr + ':' + encodeUrl; + } + var hash = crypto + .createHmac('sha256', apiSecret) + .update(urlString) + .digest('base64'); + + return { + 'X-Request-Expires': expiryDateStr, + digest: 'SHA-256=' + hash }; +} - /** - * Generate the sott - * @param {json} config as site config - * @param {string} startDate as start date - * @param {string} endDate as end date - * @return generated sott - */ - module.getSott = function (sottconfig, startDate, endDate, timeDifference) { - return new Promise(function (resolve, reject) { - var cipher = require('./sott')(config, sottconfig, - startDate, - endDate, - timeDifference - ); - cipher.then( - function (sott) { - resolve(sott); - }, - function (reason) { - reject(reason); - } - ); +export function request (config, type, resourcePath, queryParameters, formData) { + var isApiSecret; + if (queryParameters.apiSecret) { + isApiSecret = queryParameters.apiSecret; + delete queryParameters.apiSecret; + } + + if (!isNullOrWhiteSpace(config.serverRegion)) { + queryParameters.region = config.serverRegion; + } + + var headers = { 'Content-Type': 'application/json' }; + + if (queryParameters.sott) { + Object.assign(headers, { 'X-LoginRadius-Sott': queryParameters.sott }); + delete queryParameters.sott; + } + if (!isNullOrWhiteSpace(config.originIp)) { + Object.assign(headers, { 'X-Origin-IP': config.originIp }); + } + var queryString = getQueryString(queryParameters); + + if (queryParameters.access_token) { + Object.assign(headers, { + authorization: 'Bearer ' + queryParameters.access_token }); + delete queryParameters.access_token; + } + var options: any = { + method: type, + hostname: + resourcePath === 'ciam/appinfo' + ? 'config.lrcontent.com' + : config.apiDomain, + path: '/' + resourcePath + (queryString ? '?' + queryString : ''), + headers: headers }; - /** - * Get Validation Message - * @param {string} type as error string - * @return jsondata as json error object - */ - module.getValidationMessage = function (type) { - jsondata.Description = - 'The API Request Parameter ' + type + ' is not Correct or WellFormated'; - return jsondata; + if (formData !== '' && formData !== null) { + var out_text = JSON.stringify(formData); + Object.assign(headers, { 'Content-Length': out_text.length }); + } + + if (config.proxy && config.proxy.host && config.proxy.port) { + options.proxy = + (config.proxy.protocol ? config.proxy.protocol : 'http') + + '://' + + config.proxy.user + + ':' + + config.proxy.password + + '@' + + config.proxy.host + + ':' + + config.proxy.port; + } + + var customHeader = { + 'X-LoginRadius-apiKey': config.apiKey, + 'X-LoginRadius-apiSecret': config.apiSecret }; - /** - * Manage the api response - * @param {string} status as error status - * @param {json} data as response data - * @param {*} resolve as promise resolve - * @param {*} reject as promise reject - */ - module.manageRequestResponse = function (status, data, resolve, reject) { - if (this.checkError(status, data)) { - if (!data) { - data = this.checkError(status, data); - } - reject(data); + if (config.fieldsParam && config.fieldsValue) { + var fieldsList; + if (options.path.match(/\?./)) { + fieldsList = config.fieldsParam + encodeURIComponent(config.fieldsValue); } else { - resolve(data); + fieldsList = '?fields=' + encodeURIComponent(config.fieldsValue); } - }; - /** - * Get Query String - * @param {object} string as json input object - * @return qauery string - */ - module.getQueryString = function (string) { - return querystring.stringify(string, null, null, encodeURIComponent); - }; + options.path += fieldsList; + } - /** - * Generate signin header - * @param {object} options as options object - * @param {string} apiSecret - * @return header object - */ - module.generateSigningHeader = function (options, apiSecret) { - var SIXTY = 60; - var SIXTYTHOUSAND = 60000; - var TEN = 10; - var expiryDate = new Date(); - expiryDate = new Date(expiryDate.getTime() + SIXTY * SIXTYTHOUSAND); - var month = expiryDate.getMonth() + 1; - - expiryDate = - expiryDate.getFullYear() + - '-' + - (month < TEN ? '0' + month : month) + - '-' + - (expiryDate.getDate() < TEN - ? '0' + expiryDate.getDate() - : expiryDate.getDate()) + - ' ' + - (expiryDate.getHours() < TEN - ? '0' + expiryDate.getHours() - : expiryDate.getHours()) + - ':' + - (expiryDate.getMinutes() < TEN - ? '0' + expiryDate.getMinutes() - : expiryDate.getMinutes()) + - ':' + - (expiryDate.getSeconds() < TEN - ? '0' + expiryDate.getSeconds() - : expiryDate.getSeconds()); - - var encodeUrl = encodeURIComponent( - decodeURIComponent(options.uri) - ).toLowerCase(); + if (isApiSecret) { + if (config.apiRequestSigning) { + if (!options.path.match('apiKey')) { + options.path += '&apiKey=' + encodeURIComponent(config.apiKey); + } + var signingHeader = generateSigningHeader(options, config.apiSecret); - var urlString; - if (options.body) { - urlString = expiryDate + ':' + encodeUrl + ':' + options.body; + Object.assign(options.headers, signingHeader); } else { - urlString = expiryDate + ':' + encodeUrl; + Object.assign(options.headers, customHeader); } - var hash = crypto - .createHmac('sha256', apiSecret) - .update(urlString) - .digest('base64'); - - return { - 'X-Request-Expires': expiryDate, - digest: 'SHA-256=' + hash - }; - }; - return module; -} + } + return new Promise(function (resolve, reject) { + const req = https + .request(options, (resp) => { + var data = ''; + if ( + Object.prototype.hasOwnProperty.call(resp, 'statusCode') && + resp.statusCode === 429 + ) { + var tooManyRequestsData = { + Description: 'Too many request in particular time frame', + ErrorCode: 429, + Message: 'Too many request in particular time frame', + IsProviderError: false, + ProviderErrorResponse: null + }; + manageRequestResponse( + 'serverError', + tooManyRequestsData, + resolve, + reject + ); + } else { + resp.on('data', (chunk) => { + data += chunk; + }); + resp.on('end', () => { + try { + var response = JSON.parse(data); + manageRequestResponse('', response, resolve, reject); + } catch (err) { + manageRequestResponse('serverError', '', resolve, reject); + } + }); + } + }) + .on('error', (error) => { + manageRequestResponse('serverError', error, resolve, reject); + }); + + if (out_text) { + req.write(out_text); + } + + req.end(); + }); +} diff --git a/loginradius-sdk/src/util/lr.ts b/loginradius-sdk/src/util/lr.ts index c1f5f5b..f581878 100644 --- a/loginradius-sdk/src/util/lr.ts +++ b/loginradius-sdk/src/util/lr.ts @@ -2,280 +2,52 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -var https = require('https'); -var path = require('path'); - -module.exports = function (config = {}) { +import AccountApi from '../api/account/accountApi'; +import AuthenticationApi from '../api/authentication/authenticationApi'; +import ConfigurationApi from '../api/advanced/configurationApi'; +import ConsentManagementApi from '../api/advanced/consentManagementApi'; +import CustomObjectApi from '../api/advanced/customObjectApi'; +import { LoginRadiusConfig } from '../types'; +import MultiFactorAuthenticationApi from '../api/advanced/multiFactorAuthenticationApi'; +import NativeSocialApi from '../api/social/nativeSocialApi'; +import OneTouchLoginApi from '../api/authentication/oneTouchLoginApi'; +import PasswordlessLoginApi from '../api/authentication/passwordLessLoginApi'; +import PhoneAuthenticationApi from '../api/authentication/phoneAuthenticationApi'; +import PinAuthenticationApi from '../api/authentication/pinAuthenticationApi'; +import ReAuthenticationApi from '../api/advanced/reAuthenticationApi'; +import RiskBasedAuthenticationApi from '../api/authentication/riskBasedAuthenticationApi'; +import RoleApi from '../api/account/roleApi'; +import SmartLoginApi from '../api/authentication/smartLoginApi'; +import SocialApi from '../api/social/socialApi'; +import SottApi from '../api/account/sottApi'; +import WebHookApi from '../api/advanced/webHookApi'; + +export default function (config: LoginRadiusConfig) { if (config.apiKey === undefined || config.apiSecret === undefined) { console.error('Please set apiKey API & apiSecret'); return; } - - config.HELPER_PATH = path.join(__dirname, 'helper.js'); - var helper = require(config.HELPER_PATH)(config); - config.request = function (type, resourcePath, queryParameters, formData) { - var isApiSecret; - if (queryParameters.apiSecret) { - isApiSecret = queryParameters.apiSecret; - delete queryParameters.apiSecret; - } - - if (!helper.isNullOrWhiteSpace(config.serverRegion)) { - queryParameters.region = config.serverRegion; - } - - var headers = { 'Content-Type': 'application/json' }; - - if (queryParameters.sott) { - Object.assign(headers, { 'X-LoginRadius-Sott': queryParameters.sott }); - delete queryParameters.sott; - } - if (!helper.isNullOrWhiteSpace(config.originIp)) { - Object.assign(headers, { 'X-Origin-IP': config.originIp }); - } - var queryString = helper.getQueryString(queryParameters); - - if (queryParameters.access_token) { - Object.assign(headers, { - authorization: 'Bearer ' + queryParameters.access_token - }); - delete queryParameters.access_token; - } - var options = { - method: type, - hostname: - resourcePath === 'ciam/appinfo' - ? 'config.lrcontent.com' - : config.apiDomain, - path: '/' + resourcePath + (queryString ? '?' + queryString : ''), - headers: headers - }; - - if (formData !== '' && formData !== null) { - var out_text = JSON.stringify(formData); - Object.assign(headers, { 'Content-Length': out_text.length }); - } - - if (config.proxy && config.proxy.host && config.proxy.port) { - options.proxy = - (config.proxy.protocol ? config.proxy.protocol : 'http') + - '://' + - config.proxy.user + - ':' + - config.proxy.password + - '@' + - config.proxy.host + - ':' + - config.proxy.port; - } - - var customHeader = { - 'X-LoginRadius-apiKey': config.apiKey, - 'X-LoginRadius-apiSecret': config.apiSecret - }; - - if (config.fieldsParam && config.fieldsValue) { - var fieldsList; - if (options.path.match(/\?./)) { - fieldsList = - config.fieldsParam + encodeURIComponent(config.fieldsValue); - } else { - fieldsList = '?fields=' + encodeURIComponent(config.fieldsValue); - } - options.path += fieldsList; - } - - if (isApiSecret) { - if (config.apiRequestSigning) { - if (!options.path.match('apiKey')) { - options.path += '&apiKey=' + encodeURIComponent(config.apiKey); - } - var signingHeader = helper.generateSigningHeader( - options, - config.apiSecret - ); - - Object.assign(options.headers, signingHeader); - } else { - Object.assign(options.headers, customHeader); - } - } - return new Promise(function (resolve, reject) { - const req = https - .request(options, (resp) => { - var data = ''; - if ( - Object.prototype.hasOwnProperty.call(resp, 'statusCode') && - resp.statusCode === 429 - ) { - var jsondata = { - Description: 'Too many request in particular time frame', - ErrorCode: 429, - Message: 'Too many request in particular time frame', - IsProviderError: false, - ProviderErrorResponse: null - }; - helper.manageRequestResponse( - 'serverError', - jsondata, - resolve, - reject - ); - } else { - resp.on('data', (chunk) => { - data += chunk; - }); - - resp.on('end', () => { - try { - var response = JSON.parse(data); - helper.manageRequestResponse('', response, resolve, reject); - } catch (err) { - helper.manageRequestResponse( - 'serverError', - '', - resolve, - reject - ); - } - }); - } - }) - .on('error', (error) => { - helper.manageRequestResponse('serverError', error, resolve, reject); - }); - - if (out_text) { - req.write(out_text); - } - - req.end(); - }); - }; - - config.apiDomain = - config.apiDomain && config.apiDomain !== '' - ? config.apiDomain - : 'api.loginradius.com'; + if (!config.apiDomain || config.apiDomain === '') { + config.apiDomain = 'api.loginradius.com'; + } return { - helper, - accountApi: require(path.join( - __dirname, - '..', - 'api', - 'account', - 'accountApi' - ))(config), - roleApi: require(path.join(__dirname, '..', 'api', 'account', 'roleApi'))( - config - ), - sottApi: require(path.join(__dirname, '..', 'api', 'account', 'sottApi'))( - config - ), - configurationApi: require(path.join( - __dirname, - '..', - 'api', - 'advanced', - 'configurationApi' - ))(config), - customObjectApi: require(path.join( - __dirname, - '..', - 'api', - 'advanced', - 'customObjectApi' - ))(config), - multiFactorAuthenticationApi: require(path.join( - __dirname, - '..', - 'api', - 'advanced', - 'multiFactorAuthenticationApi' - ))(config), - webHookApi: require(path.join( - __dirname, - '..', - 'api', - 'advanced', - 'webHookApi' - ))(config), - consentManagementApi: require(path.join( - __dirname, - '..', - 'api', - 'advanced', - 'consentManagementApi' - ))(config), - reAuthenticationApi: require(path.join( - __dirname, - '..', - 'api', - 'advanced', - 'reAuthenticationApi' - ))(config), - authenticationApi: require(path.join( - __dirname, - '..', - 'api', - 'authentication', - 'authenticationApi' - ))(config), - oneTouchLoginApi: require(path.join( - __dirname, - '..', - 'api', - 'authentication', - 'oneTouchLoginApi' - ))(config), - passwordLessLoginApi: require(path.join( - __dirname, - '..', - 'api', - 'authentication', - 'passwordLessLoginApi' - ))(config), - phoneAuthenticationApi: require(path.join( - __dirname, - '..', - 'api', - 'authentication', - 'phoneAuthenticationApi' - ))(config), - riskBasedAuthenticationApi: require(path.join( - __dirname, - '..', - 'api', - 'authentication', - 'riskBasedAuthenticationApi' - ))(config), - pinAuthenticationApi: require(path.join( - __dirname, - '..', - 'api', - 'authentication', - 'pinAuthenticationApi' - ))(config), - smartLoginApi: require(path.join( - __dirname, - '..', - 'api', - 'authentication', - 'smartLoginApi' - ))(config), - nativeSocialApi: require(path.join( - __dirname, - '..', - 'api', - 'social', - 'nativeSocialApi' - ))(config), - socialApi: require(path.join( - __dirname, - '..', - 'api', - 'social', - 'socialApi' - ))(config) + accountApi: new AccountApi(config), + roleApi: new RoleApi(config), + sottApi: new SottApi(config), + configurationApi: new ConfigurationApi(config), + customObjectApi: new CustomObjectApi(config), + multiFactorAuthenticationApi: new MultiFactorAuthenticationApi(config), + webHookApi: new WebHookApi(config), + consentManagementApi: new ConsentManagementApi(config), + reAuthenticationApi: new ReAuthenticationApi(config), + authenticationApi: new AuthenticationApi(config), + oneTouchLoginApi: new OneTouchLoginApi(config), + passwordLessLoginApi: new PasswordlessLoginApi(config), + phoneAuthenticationApi: new PhoneAuthenticationApi(config), + riskBasedAuthenticationApi: new RiskBasedAuthenticationApi(config), + pinAuthenticationApi: new PinAuthenticationApi(config), + smartLoginApi: new SmartLoginApi(config), + nativeSocialApi: new NativeSocialApi(config), + socialApi: new SocialApi(config) }; -}; +} diff --git a/loginradius-sdk/src/util/sott.ts b/loginradius-sdk/src/util/sott.ts index c00384e..ed97cf9 100644 --- a/loginradius-sdk/src/util/sott.ts +++ b/loginradius-sdk/src/util/sott.ts @@ -1,18 +1,13 @@ -'use strict'; +import crypto from 'crypto'; -module.exports = function (config, sottconfig, startDate, endDate, timeDifference) { - var helper = require(config.HELPER_PATH)(); - - var key = !helper.isNullOrWhiteSpace(sottconfig.apiKey) ? sottconfig.apiKey : config.apiKey; - var secret = !helper.isNullOrWhiteSpace(sottconfig.apiSecret) ? sottconfig.apiSecret : config.apiSecret; - var time = !helper.isNullOrWhiteSpace(timeDifference) ? parseInt(timeDifference) : 10; +export default function (sottconfig, startDate, endDate, timeDifference) { + var key = sottconfig.apiKey; + var secret = sottconfig.apiSecret; + var time = timeDifference; - - var crypto = require('crypto'); return new Promise(function (resolve, reject) { var tempToken = ''; - if (startDate && endDate) { tempToken = startDate + '#' + key + '#' + endDate; } else { @@ -58,13 +53,12 @@ module.exports = function (config, sottconfig, startDate, endDate, timeDifferenc encrypt(tempToken, resolve, reject); }); - function encrypt(plainText, resolve, reject) { + function encrypt (plainText, resolve, reject) { var initVector = 'tu89geji340t89u2'; var keySize = 256; var iterations = 10000; var keyLenNumber = 8; var initVectorBuffer = Buffer.from(initVector, 'utf8'); - var plainTextBuffer = Buffer.from(plainText, 'utf8'); crypto.pbkdf2( secret, Buffer.from(new Array(keyLenNumber)), @@ -78,7 +72,7 @@ module.exports = function (config, sottconfig, startDate, endDate, timeDifferenc keyBytes, initVectorBuffer ); - var cryptedText = cipher.update(plainTextBuffer, 'utf8', 'base64'); + var cryptedText = cipher.update(plainText, 'utf8', 'base64'); cryptedText += cipher.final('base64'); var hash = crypto.createHash('md5'); @@ -87,4 +81,4 @@ module.exports = function (config, sottconfig, startDate, endDate, timeDifferenc } ); } -}; \ No newline at end of file +} diff --git a/loginradius-sdk/tsconfig.json b/loginradius-sdk/tsconfig.json index 75dcaea..85cb063 100644 --- a/loginradius-sdk/tsconfig.json +++ b/loginradius-sdk/tsconfig.json @@ -49,7 +49,7 @@ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - // "outDir": "./", /* Specify an output folder for all emitted files. */ + "outDir": "./lib/types", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ @@ -77,7 +77,7 @@ /* Type Checking */ "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ @@ -99,5 +99,6 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */ - } + }, + "include": [ "src/**/*"] } From 17aa5e94b99c11b14a6e72d667b66b4f133821d6 Mon Sep 17 00:00:00 2001 From: Daniel Brenot Date: Fri, 27 Jan 2023 12:29:07 -0500 Subject: [PATCH 3/5] Added types to API function parameters --- loginradius-sdk/src/api/account/accountApi.ts | 143 +++---- loginradius-sdk/src/api/account/roleApi.ts | 81 ++-- loginradius-sdk/src/api/account/sottApi.ts | 4 +- .../src/api/advanced/configurationApi.ts | 4 +- .../src/api/advanced/consentManagementApi.ts | 34 +- .../src/api/advanced/customObjectApi.ts | 100 ++--- .../advanced/multiFactorAuthenticationApi.ts | 395 +++++++++--------- .../src/api/advanced/reAuthenticationApi.ts | 70 ++-- .../src/api/advanced/webHookApi.ts | 12 +- .../api/authentication/authenticationApi.ts | 354 ++++++++-------- .../api/authentication/oneTouchLoginApi.ts | 44 +- .../authentication/passwordLessLoginApi.ts | 66 +-- .../authentication/phoneAuthenticationApi.ts | 100 ++--- .../authentication/pinAuthenticationApi.ts | 80 ++-- .../riskBasedAuthenticationApi.ts | 216 +++++----- .../src/api/authentication/smartLoginApi.ts | 50 +-- .../src/api/social/nativeSocialApi.ts | 64 +-- loginradius-sdk/src/api/social/socialApi.ts | 32 +- loginradius-sdk/src/types.ts | 5 + loginradius-sdk/src/util/helper.ts | 49 +-- loginradius-sdk/src/util/lr.ts | 3 +- loginradius-sdk/src/util/sott.ts | 3 +- 22 files changed, 954 insertions(+), 955 deletions(-) diff --git a/loginradius-sdk/src/api/account/accountApi.ts b/loginradius-sdk/src/api/account/accountApi.ts index 87777a8..eb8642e 100644 --- a/loginradius-sdk/src/api/account/accountApi.ts +++ b/loginradius-sdk/src/api/account/accountApi.ts @@ -17,11 +17,11 @@ export default class AccountApi { /** * This API is used to retrieve all of the accepted Policies by the user, associated with their UID. - * @param {uid} UID, the unified identifier for each user account + * @param uid the unified identifier for each user account * @return Complete Policy History data *15.1.1 */ - getPrivacyPolicyHistoryByUid (uid) { + getPrivacyPolicyHistoryByUid (uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -38,12 +38,12 @@ export default class AccountApi { /** * This API is used to create an account in Cloud Storage. This API bypass the normal email verification process and manually creates the user.

In order to use this API, you need to format a JSON request body with all of the mandatory fields - * @param {accountCreateModel} Model Class containing Definition of payload for Account Create API - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param accountCreateModel Model Class containing Definition of payload for Account Create API + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing Definition for Complete profile data *18.1 */ - createAccount (accountCreateModel, fields) { + createAccount (accountCreateModel: object, fields?: string) { if (checkJson(accountCreateModel)) { return Promise.reject(getValidationMessage('accountCreateModel')); } @@ -68,12 +68,12 @@ export default class AccountApi { /** * This API is used to retrieve all of the profile data, associated with the specified account by email in Cloud Storage. - * @param {email} Email of the user - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param email Email of the user + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing Definition for Complete profile data *18.2 */ - getAccountProfileByEmail (email, fields) { + getAccountProfileByEmail (email: string, fields?: string) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); } @@ -93,12 +93,12 @@ export default class AccountApi { /** * This API is used to retrieve all of the profile data associated with the specified account by user name in Cloud Storage. - * @param {userName} UserName of the user - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param userName UserName of the user + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing Definition for Complete profile data *18.3 */ - getAccountProfileByUserName (userName, fields) { + getAccountProfileByUserName (userName: string, fields?: string) { if (isNullOrWhiteSpace(userName)) { return Promise.reject(getValidationMessage('userName')); } @@ -118,13 +118,12 @@ export default class AccountApi { /** * This API is used to retrieve all of the profile data, associated with the account by phone number in Cloud Storage. - * @param {phone} The Registered Phone Number - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param phone The Registered Phone Number + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing Definition for Complete profile data *18.4 */ - - getAccountProfileByPhone (phone, fields) { + getAccountProfileByPhone (phone: string, fields?: string) { if (isNullOrWhiteSpace(phone)) { return Promise.reject(getValidationMessage('phone')); } @@ -144,13 +143,12 @@ export default class AccountApi { /** * This API is used to retrieve all of the profile data, associated with the account by uid in Cloud Storage. - * @param {uid} UID, the unified identifier for each user account - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param id The unified identifier for each user account + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing Definition for Complete profile data *18.5 */ - - getAccountProfileByUid (uid, fields) { + getAccountProfileByUid (uid: string, fields?: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -169,15 +167,14 @@ export default class AccountApi { /** * This API is used to update the information of existing accounts in your Cloud Storage. See our Advanced API Usage section Here for more capabilities. - * @param {accountUserProfileUpdateModel} Model Class containing Definition of payload for Account Update API - * @param {uid} UID, the unified identifier for each user account - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {nullSupport} Boolean, pass true if you wish to update any user profile field with a NULL value, You can get the details + * @param accountUserProfileUpdateModel Model Class containing Definition of payload for Account Update API + * @param uid The unified identifier for each user account + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param nullSupport Boolean, pass true if you wish to update any user profile field with a NULL value, You can get the details * @return Response containing Definition for Complete profile data *18.15 */ - - updateAccountByUid (accountUserProfileUpdateModel, uid, fields, nullSupport) { + updateAccountByUid (accountUserProfileUpdateModel: object, uid: string, fields: string, nullSupport: boolean) { if (checkJson(accountUserProfileUpdateModel)) { return Promise.reject( getValidationMessage('accountUserProfileUpdateModel') @@ -210,14 +207,13 @@ export default class AccountApi { /** * This API is used to update the PhoneId by using the Uid's. Admin can update the PhoneId's for both the verified and unverified profiles. It will directly replace the PhoneId and bypass the OTP verification process. - * @param {phone} Phone number - * @param {uid} UID, the unified identifier for each user account - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param phone Phone number + * @param uid The unified identifier for each user account + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing Definition for Complete profile data *18.16 */ - - updatePhoneIDByUid (phone, uid, fields) { + updatePhoneIDByUid (phone: string, uid: string, fields?: string) { if (isNullOrWhiteSpace(phone)) { return Promise.reject(getValidationMessage('phone')); } @@ -248,12 +244,12 @@ export default class AccountApi { /** * This API use to retrive the hashed password of a specified account in Cloud Storage. - * @param {uid} UID, the unified identifier for each user account + * @param uid UID, the unified identifier for each user account * @return Response containing Definition for Complete PasswordHash data *18.17 */ - getAccountPasswordHashByUid (uid) { + getAccountPasswordHashByUid (uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -269,12 +265,12 @@ export default class AccountApi { /** * This API is used to set the password of an account in Cloud Storage. - * @param {password} New password - * @param {uid} UID, the unified identifier for each user account + * @param password New password + * @param uid UID, the unified identifier for each user account * @return Response containing Definition for Complete PasswordHash data *18.18 */ - setAccountPasswordByUid (password, uid) { + setAccountPasswordByUid (password: string, uid: string) { if (isNullOrWhiteSpace(password)) { return Promise.reject(getValidationMessage('password')); } @@ -302,11 +298,11 @@ export default class AccountApi { /** * This API deletes the Users account and allows them to re-register for a new account. - * @param {uid} UID, the unified identifier for each user account + * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Delete Request *18.19 */ - deleteAccountByUid (uid) { + deleteAccountByUid (uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -322,14 +318,13 @@ export default class AccountApi { /** * This API is used to invalidate the Email Verification status on an account. - * @param {uid} UID, the unified identifier for each user account - * @param {emailTemplate} Email template name - * @param {verificationUrl} Email verification url + * @param uid The unified identifier for each user account + * @param emailTemplate Email template name + * @param verificationUrl Email verification url * @return Response containing Definition of Complete Validation data *18.20 */ - - invalidateAccountEmailVerification (uid, emailTemplate, verificationUrl) { + invalidateAccountEmailVerification (uid: string, emailTemplate?: string, verificationUrl?: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -351,14 +346,14 @@ export default class AccountApi { /** * This API Returns a Forgot Password Token it can also be used to send a Forgot Password email to the customer. Note: If you have the UserName workflow enabled, you may replace the 'email' parameter with 'username' in the body. - * @param {email} user's email - * @param {emailTemplate} Email template name - * @param {resetPasswordUrl} Url to which user should get re-directed to for resetting the password - * @param {sendEmail} If set to true, the API will also send a Forgot Password email to the customer, bypassing any Bot Protection challenges that they are faced with. + * @param email user's email + * @param emailTemplate Email template name + * @param resetPasswordUrl Url to which user should get re-directed to for resetting the password + * @param sendEmail If set to true, the API will also send a Forgot Password email to the customer, bypassing any Bot Protection challenges that they are faced with. * @return Response containing Definition of Complete Forgot Password data *18.22 */ - getForgotPasswordToken (email, emailTemplate, resetPasswordUrl, sendEmail) { + getForgotPasswordToken (email: string, emailTemplate?: string, resetPasswordUrl?: string, sendEmail?: boolean) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); } @@ -392,11 +387,11 @@ export default class AccountApi { /** * This API Returns an Email Verification token. - * @param {email} user's email + * @param email user's email * @return Response containing Definition of Complete Verification data *18.23 */ - getEmailVerificationToken (email) { + getEmailVerificationToken (email: string) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); } @@ -421,11 +416,11 @@ export default class AccountApi { /** * The API is used to get LoginRadius access token based on UID. - * @param {uid} UID, the unified identifier for each user account + * @param uid The unified identifier for each user account * @return Response containing Definition of Complete Token data *18.24 */ - getAccessTokenByUid (uid) { + getAccessTokenByUid (uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -442,12 +437,12 @@ export default class AccountApi { /** * This API Allows you to reset the phone no verification of an end user’s account. - * @param {uid} UID, the unified identifier for each user account - * @param {smsTemplate} SMS Template name + * @param uid The unified identifier for each user account + * @param smsTemplate SMS Template name * @return Response containing Definition of Complete Validation data *18.27 */ - resetPhoneIDVerificationByUid (uid, smsTemplate) { + resetPhoneIDVerificationByUid (uid: string, smsTemplate?: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -466,13 +461,13 @@ export default class AccountApi { /** * This API is used to add/upsert another emails in account profile by different-different email types. If the email type is same then it will simply update the existing email, otherwise it will add a new email in Email array. - * @param {upsertEmailModel} Model Class containing Definition of payload for UpsertEmail Property - * @param {uid} UID, the unified identifier for each user account - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param upsertEmailModel Model Class containing Definition of payload for UpsertEmail Property + * @param uid The unified identifier for each user account + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing Definition for Complete profile data *18.29 */ - upsertEmail (upsertEmailModel, uid, fields) { + upsertEmail (upsertEmailModel: object, uid: string, fields: string) { if (checkJson(upsertEmailModel)) { return Promise.reject(getValidationMessage('upsertEmailModel')); } @@ -500,13 +495,13 @@ export default class AccountApi { /** * Use this API to Remove emails from a user Account - * @param {email} user's email - * @param {uid} UID, the unified identifier for each user account - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param email user's email + * @param uid The unified identifier for each user account + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing Definition for Complete profile data *18.30 */ - removeEmail (email, uid, fields) { + removeEmail (email: string, uid: string, fields?: string) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); } @@ -537,11 +532,11 @@ export default class AccountApi { /** * This API is used to refresh an access token via it's associated refresh token. - * @param {refreshToken} LoginRadius refresh token + * @param refreshToken LoginRadius refresh token * @return Response containing Definition of Complete Token data *18.31 */ - refreshAccessTokenByRefreshToken (refreshToken) { + refreshAccessTokenByRefreshToken (refreshToken: string) { if (isNullOrWhiteSpace(refreshToken)) { return Promise.reject(getValidationMessage('refreshToken')); } @@ -558,11 +553,11 @@ export default class AccountApi { /** * The Revoke Refresh Access Token API is used to revoke a refresh token or the Provider Access Token, revoking an existing refresh token will invalidate the refresh token but the associated access token will work until the expiry. - * @param {refreshToken} LoginRadius refresh token + * @param refreshToken LoginRadius refresh token * @return Response containing Definition of Delete Request *18.32 */ - revokeRefreshToken (refreshToken) { + revokeRefreshToken (refreshToken: string) { if (isNullOrWhiteSpace(refreshToken)) { return Promise.reject(getValidationMessage('refreshToken')); } @@ -579,12 +574,12 @@ export default class AccountApi { /** * Note: This is intended for specific workflows where an email may be associated to multiple UIDs. This API is used to retrieve all of the identities (UID and Profiles), associated with a specified email in Cloud Storage. - * @param {email} Email of the user - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param email Email of the user + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Complete user Identity data *18.35 */ - getAccountIdentitiesByEmail (email, fields) { + getAccountIdentitiesByEmail (email: string, fields?: string) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); } @@ -604,11 +599,11 @@ export default class AccountApi { /** * This API is used to delete all user profiles associated with an Email. - * @param {email} Email of the user + * @param email Email of the user * @return Response containing Definition of Delete Request *18.36 */ - accountDeleteByEmail (email) { + accountDeleteByEmail (email: string) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); } @@ -625,12 +620,12 @@ export default class AccountApi { /** * This API is used to update a user's Uid. It will update all profiles, custom objects and consent management logs associated with the Uid. - * @param {updateUidModel} Payload containing Update UID - * @param {uid} UID, the unified identifier for each user account + * @param updateUidModel Payload containing Update UID + * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Complete Validation data *18.41 */ - accountUpdateUid (updateUidModel, uid) { + accountUpdateUid (updateUidModel: object, uid: string) { if (checkJson(updateUidModel)) { return Promise.reject(getValidationMessage('updateUidModel')); } diff --git a/loginradius-sdk/src/api/account/roleApi.ts b/loginradius-sdk/src/api/account/roleApi.ts index c1eb40e..f06b70f 100644 --- a/loginradius-sdk/src/api/account/roleApi.ts +++ b/loginradius-sdk/src/api/account/roleApi.ts @@ -17,11 +17,11 @@ export default class RoleApi { /** * API is used to retrieve all the assigned roles of a particular User. - * @param {uid} UID, the unified identifier for each user account + * @param uid The unified identifier for each user account * @return Response containing Definition of Complete Roles data *18.6 */ - getRolesByUid (uid) { + getRolesByUid (uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -37,12 +37,12 @@ export default class RoleApi { /** * This API is used to assign your desired roles to a given user. - * @param {accountRolesModel} Model Class containing Definition of payload for Create Role API - * @param {uid} UID, the unified identifier for each user account + * @param accountRolesModel Model Class containing Definition of payload for Create Role API + * @param uid The unified identifier for each user account * @return Response containing Definition of Complete Roles data *18.7 */ - assignRolesByUid (accountRolesModel, uid) { + assignRolesByUid (accountRolesModel: object, uid: string) { if (checkJson(accountRolesModel)) { return Promise.reject(getValidationMessage('accountRolesModel')); } @@ -67,12 +67,12 @@ export default class RoleApi { /** * This API is used to unassign roles from a user. - * @param {accountRolesModel} Model Class containing Definition of payload for Create Role API - * @param {uid} UID, the unified identifier for each user account + * @param accountRolesModel Model Class containing Definition of payload for Create Role API + * @param uid The unified identifier for each user account * @return Response containing Definition of Delete Request *18.8 */ - unassignRolesByUid (accountRolesModel, uid) { + unassignRolesByUid (accountRolesModel: object, uid: string) { if (checkJson(accountRolesModel)) { return Promise.reject(getValidationMessage('accountRolesModel')); } @@ -97,11 +97,11 @@ export default class RoleApi { /** * This API Gets the contexts that have been configured and the associated roles and permissions. - * @param {uid} UID, the unified identifier for each user account + * @param uid The unified identifier for each user account * @return Complete user RoleContext data *18.9 */ - getRoleContextByUid (uid) { + getRoleContextByUid (uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -117,11 +117,11 @@ export default class RoleApi { /** * The API is used to retrieve role context by the context name. - * @param {contextName} Name of context + * @param contextName Name of context * @return Complete user RoleContext data *18.10 */ - getRoleContextByContextName (contextName) { + getRoleContextByContextName (contextName: string) { if (isNullOrWhiteSpace(contextName)) { return Promise.reject(getValidationMessage('contextName')); } @@ -137,13 +137,12 @@ export default class RoleApi { /** * This API creates a Context with a set of Roles - * @param {accountRoleContextModel} Model Class containing Definition of RoleContext payload - * @param {uid} UID, the unified identifier for each user account + * @param accountRoleContextModel Model Class containing Definition of RoleContext payload + * @param uid The unified identifier for each user account * @return Complete user RoleContext data *18.11 */ - - updateRoleContextByUid (accountRoleContextModel, uid) { + updateRoleContextByUid (accountRoleContextModel: object, uid: string) { if (checkJson(accountRoleContextModel)) { return Promise.reject(getValidationMessage('accountRoleContextModel')); } @@ -168,12 +167,12 @@ export default class RoleApi { /** * This API Deletes the specified Role Context - * @param {contextName} Name of context - * @param {uid} UID, the unified identifier for each user account + * @param contextName Name of context + * @param uid The unified identifier for each user account * @return Response containing Definition of Delete Request *18.12 */ - deleteRoleContextByUid (contextName, uid) { + deleteRoleContextByUid (contextName: string, uid: string) { if (isNullOrWhiteSpace(contextName)) { return Promise.reject(getValidationMessage('contextName')); } @@ -193,16 +192,16 @@ export default class RoleApi { /** * This API Deletes the specified Role from a Context. - * @param {contextName} Name of context - * @param {roleContextRemoveRoleModel} Model Class containing Definition of payload for RoleContextRemoveRole API - * @param {uid} UID, the unified identifier for each user account + * @param contextName Name of context + * @param roleContextRemoveRoleModel Model Class containing Definition of payload for RoleContextRemoveRole API + * @param uid The unified identifier for each user account * @return Response containing Definition of Delete Request *18.13 */ deleteRolesFromRoleContextByUid ( - contextName, - roleContextRemoveRoleModel, - uid + contextName: string, + roleContextRemoveRoleModel: object, + uid: string ) { if (isNullOrWhiteSpace(contextName)) { return Promise.reject(getValidationMessage('contextName')); @@ -236,16 +235,16 @@ export default class RoleApi { /** * This API Deletes Additional Permissions from Context. - * @param {contextName} Name of context - * @param {roleContextAdditionalPermissionRemoveRoleModel} Model Class containing Definition of payload for RoleContextAdditionalPermissionRemoveRole API - * @param {uid} UID, the unified identifier for each user account + * @param contextName Name of context + * @param roleContextAdditionalPermissionRemoveRoleModel Model Class containing Definition of payload for RoleContextAdditionalPermissionRemoveRole API + * @param uid The unified identifier for each user account * @return Response containing Definition of Delete Request *18.14 */ deleteAdditionalPermissionFromRoleContextByUid ( - contextName, - roleContextAdditionalPermissionRemoveRoleModel, - uid + contextName: string, + roleContextAdditionalPermissionRemoveRoleModel: object, + uid: string ) { if (isNullOrWhiteSpace(contextName)) { return Promise.reject(getValidationMessage('contextName')); @@ -297,11 +296,11 @@ export default class RoleApi { /** * This API creates a role with permissions. - * @param {rolesModel} Model Class containing Definition of payload for Roles API + * @param rolesModel Model Class containing Definition of payload for Roles API * @return Complete user Roles data *41.2 */ - createRoles (rolesModel) { + createRoles (rolesModel: object) { if (checkJson(rolesModel)) { return Promise.reject(getValidationMessage('rolesModel')); } @@ -323,11 +322,11 @@ export default class RoleApi { /** * This API is used to delete the role. - * @param {role} Created RoleName + * @param role Created RoleName * @return Response containing Definition of Delete Request *41.3 */ - deleteRole (role) { + deleteRole (role: string) { if (isNullOrWhiteSpace(role)) { return Promise.reject(getValidationMessage('role')); } @@ -343,12 +342,12 @@ export default class RoleApi { /** * This API is used to add permissions to a given role. - * @param {permissionsModel} Model Class containing Definition for PermissionsModel Property - * @param {role} Created RoleName + * @param permissionsModel Model Class containing Definition for PermissionsModel Property + * @param role Created RoleName * @return Response containing Definition of Complete role data *41.4 */ - addRolePermissions (permissionsModel, role) { + addRolePermissions (permissionsModel: object, role: string) { if (checkJson(permissionsModel)) { return Promise.reject(getValidationMessage('permissionsModel')); } @@ -373,12 +372,12 @@ export default class RoleApi { /** * API is used to remove permissions from a role. - * @param {permissionsModel} Model Class containing Definition for PermissionsModel Property - * @param {role} Created RoleName + * @param permissionsModel Model Class containing Definition for PermissionsModel Property + * @param role Created RoleName * @return Response containing Definition of Complete role data *41.5 */ - removeRolePermissions (permissionsModel, role) { + removeRolePermissions (permissionsModel: object, role: string) { if (checkJson(permissionsModel)) { return Promise.reject(getValidationMessage('permissionsModel')); } diff --git a/loginradius-sdk/src/api/account/sottApi.ts b/loginradius-sdk/src/api/account/sottApi.ts index b78ecd3..1ccca42 100644 --- a/loginradius-sdk/src/api/account/sottApi.ts +++ b/loginradius-sdk/src/api/account/sottApi.ts @@ -12,11 +12,11 @@ export default class SottApi { /** * This API allows you to generate SOTT with a given expiration time. - * @param {timeDifference} The time difference you would like to pass, If you not pass difference then the default value is 10 minutes + * @param timeDifference The time difference you would like to pass, If you not pass difference then the default value is 10 minutes * @return Sott data For Registration *18.28 */ - generateSott (timeDifference) { + generateSott (timeDifference: number) { var queryParameters: any = {}; queryParameters.apiKey = this.config.apiKey; diff --git a/loginradius-sdk/src/api/advanced/configurationApi.ts b/loginradius-sdk/src/api/advanced/configurationApi.ts index edb0b7e..6b49b86 100644 --- a/loginradius-sdk/src/api/advanced/configurationApi.ts +++ b/loginradius-sdk/src/api/advanced/configurationApi.ts @@ -25,12 +25,12 @@ export default class ConfigurationApi { /** * This API allows you to query your LoginRadius account for basic server information and server time information which is useful when generating an SOTT token. - * @param {timeDifference} The time difference you would like to pass, If you not pass difference then the default value is 10 minutes + * @param timeDifference The time difference you would like to pass, If you not pass difference then the default value is 10 minutes * @return Response containing Definition of Complete service info data *3.1 */ - getServerInfo (timeDifference) { + getServerInfo (timeDifference: number) { var queryParameters: any = {}; queryParameters.apiKey = this.config.apiKey; diff --git a/loginradius-sdk/src/api/advanced/consentManagementApi.ts b/loginradius-sdk/src/api/advanced/consentManagementApi.ts index 561b2ba..489b23d 100644 --- a/loginradius-sdk/src/api/advanced/consentManagementApi.ts +++ b/loginradius-sdk/src/api/advanced/consentManagementApi.ts @@ -16,11 +16,11 @@ export default class ConsentManagementApi { /** * This API is used to get the Consent logs of the user. - * @param {uid} UID, the unified identifier for each user account + * @param uid The unified identifier for each user account * @return Response containing consent logs *18.37 */ - getConsentLogsByUid (uid) { + getConsentLogsByUid (uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -36,12 +36,12 @@ export default class ConsentManagementApi { /** * This API is to submit consent form using consent token. - * @param {consentToken} The consent token received after login error 1226 - * @param {consentSubmitModel} Model class containing list of multiple consent + * @param consentToken The consent token received after login error 1226 + * @param consentSubmitModel Model class containing list of multiple consent * @return Response containing User Profile Data and access token *43.1 */ - submitConsentByConsentToken (consentToken, consentSubmitModel) { + submitConsentByConsentToken (consentToken: string, consentSubmitModel: object) { if (isNullOrWhiteSpace(consentToken)) { return Promise.reject(getValidationMessage('consentToken')); } @@ -66,11 +66,11 @@ export default class ConsentManagementApi { /** * This API is used to fetch consent logs. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @return Response containing consent logs *43.2 */ - getConsentLogs (accessToken) { + getConsentLogs (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -86,12 +86,12 @@ export default class ConsentManagementApi { /** * API to provide a way to end user to submit a consent form for particular event type. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {consentSubmitModel} Model class containing list of multiple consent + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param consentSubmitModel Model class containing list of multiple consent * @return Response containing Definition for Complete profile data *43.3 */ - submitConsentByAccessToken (accessToken, consentSubmitModel) { + submitConsentByAccessToken (accessToken: string, consentSubmitModel: object) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -116,13 +116,13 @@ export default class ConsentManagementApi { /** * This API is used to check if consent is submitted for a particular event or not. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {event} Allowed events: Login, Register, UpdateProfile, ResetPassword, ChangePassword, emailVerification, AddEmail, RemoveEmail, BlockAccount, DeleteAccount, SetUsername, AssignRoles, UnassignRoles, SetPassword, LinkAccount, UnlinkAccount, UpdatePhoneId, VerifyPhoneNumber, CreateCustomObject, UpdateCustomobject, DeleteCustomObject - * @param {isCustom} true/false + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param event Allowed events: Login, Register, UpdateProfile, ResetPassword, ChangePassword, emailVerification, AddEmail, RemoveEmail, BlockAccount, DeleteAccount, SetUsername, AssignRoles, UnassignRoles, SetPassword, LinkAccount, UnlinkAccount, UpdatePhoneId, VerifyPhoneNumber, CreateCustomObject, UpdateCustomobject, DeleteCustomObject + * @param isCustom true/false * @return Response containing consent profile *43.4 */ - verifyConsentByAccessToken (accessToken, event, isCustom) { + verifyConsentByAccessToken (accessToken: string, event: string, isCustom: boolean) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -143,12 +143,12 @@ export default class ConsentManagementApi { /** * This API is to update consents using access token. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {consentUpdateModel} Model class containg list of multiple consent + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param consentUpdateModel Model class containg list of multiple consent * @return Response containing consent profile *43.5 */ - updateConsentProfileByAccessToken (accessToken, consentUpdateModel) { + updateConsentProfileByAccessToken (accessToken: string, consentUpdateModel: object) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } diff --git a/loginradius-sdk/src/api/advanced/customObjectApi.ts b/loginradius-sdk/src/api/advanced/customObjectApi.ts index cfb9c35..14a7a1e 100644 --- a/loginradius-sdk/src/api/advanced/customObjectApi.ts +++ b/loginradius-sdk/src/api/advanced/customObjectApi.ts @@ -16,13 +16,13 @@ export default class CustomObjectApi { /** * This API is used to write information in JSON format to the custom object for the specified account. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {objectName} LoginRadius Custom Object Name - * @param {payload} LoginRadius Custom Object Name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param objectName LoginRadius Custom Object Name + * @param payload LoginRadius Custom Object Name * @return Response containing Definition for Complete user custom object data *6.1 */ - createCustomObjectByToken (accessToken, objectName, payload) { + createCustomObjectByToken (accessToken: string, objectName: string, payload: object) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -45,20 +45,20 @@ export default class CustomObjectApi { /** * This API is used to update the specified custom object data of the specified account. If the value of updatetype is 'replace' then it will fully replace custom object with the new custom object and if the value of updatetype is 'partialreplace' then it will perform an upsert type operation - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {objectName} LoginRadius Custom Object Name - * @param {objectRecordId} Unique identifier of the user's record in Custom Object - * @param {payload} LoginRadius Custom Object Name - * @param {updateType} Possible values: replace, partialreplace. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param objectName LoginRadius Custom Object Name + * @param objectRecordId Unique identifier of the user's record in Custom Object + * @param payload LoginRadius Custom Object Name + * @param updateType Possible values: replace, partialreplace. * @return Response containing Definition for Complete user custom object data *6.2 */ updateCustomObjectByToken ( - accessToken, - objectName, - objectRecordId, - payload, - updateType + accessToken: string, + objectName: string, + objectRecordId: string, + payload: object, + updateType: string ) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); @@ -88,12 +88,12 @@ export default class CustomObjectApi { /** * This API is used to retrieve the specified Custom Object data for the specified account. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {objectName} LoginRadius Custom Object Name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param objectName LoginRadius Custom Object Name * @return Complete user CustomObject data *6.3 */ - getCustomObjectByToken (accessToken, objectName) { + getCustomObjectByToken (accessToken: string, objectName: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -113,13 +113,13 @@ export default class CustomObjectApi { /** * This API is used to retrieve the Custom Object data for the specified account. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {objectName} LoginRadius Custom Object Name - * @param {objectRecordId} Unique identifier of the user's record in Custom Object + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param objectName LoginRadius Custom Object Name + * @param objectRecordId Unique identifier of the user's record in Custom Object * @return Response containing Definition for Complete user custom object data *6.4 */ - getCustomObjectByRecordIDAndToken (accessToken, objectName, objectRecordId) { + getCustomObjectByRecordIDAndToken (accessToken: string, objectName: string, objectRecordId: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -142,13 +142,13 @@ export default class CustomObjectApi { /** * This API is used to remove the specified Custom Object data using ObjectRecordId of a specified account. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {objectName} LoginRadius Custom Object Name - * @param {objectRecordId} Unique identifier of the user's record in Custom Object + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param objectName LoginRadius Custom Object Name + * @param objectRecordId Unique identifier of the user's record in Custom Object * @return Response containing Definition of Delete Request *6.5 */ - deleteCustomObjectByToken (accessToken, objectName, objectRecordId) { + deleteCustomObjectByToken (accessToken: string, objectName: string, objectRecordId: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -171,13 +171,13 @@ export default class CustomObjectApi { /** * This API is used to write information in JSON format to the custom object for the specified account. - * @param {objectName} LoginRadius Custom Object Name - * @param {payload} LoginRadius Custom Object Name - * @param {uid} UID, the unified identifier for each user account + * @param objectName LoginRadius Custom Object Name + * @param payload LoginRadius Custom Object Name + * @param uid The unified identifier for each user account * @return Response containing Definition for Complete user custom object data *19.1 */ - createCustomObjectByUid (objectName, payload, uid) { + createCustomObjectByUid (objectName: string, payload: object, uid: string) { if (isNullOrWhiteSpace(objectName)) { return Promise.reject(getValidationMessage('objectName')); } @@ -200,20 +200,20 @@ export default class CustomObjectApi { /** * This API is used to update the specified custom object data of a specified account. If the value of updatetype is 'replace' then it will fully replace custom object with new custom object and if the value of updatetype is partialreplace then it will perform an upsert type operation. - * @param {objectName} LoginRadius Custom Object Name - * @param {objectRecordId} Unique identifier of the user's record in Custom Object - * @param {payload} LoginRadius Custom Object Name - * @param {uid} UID, the unified identifier for each user account - * @param {updateType} Possible values: replace, partialreplace. + * @param objectName LoginRadius Custom Object Name + * @param objectRecordId Unique identifier of the user's record in Custom Object + * @param payload LoginRadius Custom Object Name + * @param uid UID, the unified identifier for each user account + * @param updateType Possible values: replace, partialreplace. * @return Response containing Definition for Complete user custom object data *19.2 */ updateCustomObjectByUid ( - objectName, - objectRecordId, - payload, - uid, - updateType + objectName: string, + objectRecordId: string, + payload: object, + uid: string, + updateType: string ) { if (isNullOrWhiteSpace(objectName)) { return Promise.reject(getValidationMessage('objectName')); @@ -244,12 +244,12 @@ export default class CustomObjectApi { /** * This API is used to retrieve all the custom objects by UID from cloud storage. - * @param {objectName} LoginRadius Custom Object Name - * @param {uid} UID, the unified identifier for each user account + * @param objectName LoginRadius Custom Object Name + * @param uid The unified identifier for each user account * @return Complete user CustomObject data *19.3 */ - getCustomObjectByUid (objectName, uid) { + getCustomObjectByUid (objectName: string, uid: string) { if (isNullOrWhiteSpace(objectName)) { return Promise.reject(getValidationMessage('objectName')); } @@ -269,13 +269,13 @@ export default class CustomObjectApi { /** * This API is used to retrieve the Custom Object data for the specified account. - * @param {objectName} LoginRadius Custom Object Name - * @param {objectRecordId} Unique identifier of the user's record in Custom Object - * @param {uid} UID, the unified identifier for each user account + * @param objectName LoginRadius Custom Object Name + * @param objectRecordId Unique identifier of the user's record in Custom Object + * @param uid The unified identifier for each user account * @return Response containing Definition for Complete user custom object data *19.4 */ - getCustomObjectByRecordID (objectName, objectRecordId, uid) { + getCustomObjectByRecordID (objectName: string, objectRecordId: string, uid: string) { if (isNullOrWhiteSpace(objectName)) { return Promise.reject(getValidationMessage('objectName')); } @@ -299,13 +299,13 @@ export default class CustomObjectApi { /** * This API is used to remove the specified Custom Object data using ObjectRecordId of specified account. - * @param {objectName} LoginRadius Custom Object Name - * @param {objectRecordId} Unique identifier of the user's record in Custom Object - * @param {uid} UID, the unified identifier for each user account + * @param objectName LoginRadius Custom Object Name + * @param objectRecordId Unique identifier of the user's record in Custom Object + * @param uid The unified identifier for each user account * @return Response containing Definition of Delete Request *19.5 */ - deleteCustomObjectByRecordID (objectName, objectRecordId, uid) { + deleteCustomObjectByRecordID (objectName: string, objectRecordId: string, uid: string) { if (isNullOrWhiteSpace(objectName)) { return Promise.reject(getValidationMessage('objectName')); } diff --git a/loginradius-sdk/src/api/advanced/multiFactorAuthenticationApi.ts b/loginradius-sdk/src/api/advanced/multiFactorAuthenticationApi.ts index 4e9e827..c37b535 100644 --- a/loginradius-sdk/src/api/advanced/multiFactorAuthenticationApi.ts +++ b/loginradius-sdk/src/api/advanced/multiFactorAuthenticationApi.ts @@ -16,12 +16,12 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to configure the Multi-factor authentication after login by using the access token when MFA is set as optional on the LoginRadius site. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {smsTemplate2FA} SMS Template Name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param smsTemplate2FA SMS Template Name * @return Response containing Definition of Complete Multi-Factor Authentication Settings data *5.7 */ - mfaConfigureByAccessToken (accessToken, smsTemplate2FA) { + mfaConfigureByAccessToken (accessToken: string, smsTemplate2FA?: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -40,13 +40,13 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to trigger the Multi-factor authentication settings after login for secure actions - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {multiFactorAuthModelWithLockout} Model Class containing Definition of payload for MultiFactorAuthModel With Lockout API - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param multiFactorAuthModelWithLockout Model Class containing Definition of payload for MultiFactorAuthModel With Lockout API + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing Definition for Complete profile data *5.9 */ - mfaUpdateSetting (accessToken, multiFactorAuthModelWithLockout, fields) { + mfaUpdateSetting (accessToken: string, multiFactorAuthModelWithLockout: object, fields: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -76,18 +76,18 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to Enable Multi-factor authentication by access token on user login - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {multiFactorAuthModelByGoogleAuthenticatorCode} Model Class containing Definition of payload for MultiFactorAuthModel By GoogleAuthenticator Code API - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {smsTemplate} SMS Template name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param multiFactorAuthModelByGoogleAuthenticatorCode Model Class containing Definition of payload for MultiFactorAuthModel By GoogleAuthenticator Code API + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param smsTemplate SMS Template name * @return Response containing Definition for Complete profile data *5.10 */ mfaUpdateByAccessToken ( - accessToken, - multiFactorAuthModelByGoogleAuthenticatorCode, - fields, - smsTemplate + accessToken: string, + multiFactorAuthModelByGoogleAuthenticatorCode: object, + fields?: string, + smsTemplate?: string ) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); @@ -122,13 +122,13 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to update the Multi-factor authentication phone number by sending the verification OTP to the provided phone number - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {phoneNo2FA} Phone Number For 2FA - * @param {smsTemplate2FA} SMS Template Name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param phoneNo2FA Phone Number For 2FA + * @param smsTemplate2FA SMS Template Name * @return Response containing Definition for Complete SMS data *5.11 */ - mfaUpdatePhoneNumberByToken (accessToken, phoneNo2FA, smsTemplate2FA) { + mfaUpdatePhoneNumberByToken (accessToken: string, phoneNo2FA: string, smsTemplate2FA?: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -159,12 +159,12 @@ export default class MultiFactorAuthenticationApi { /** * This API Resets the Google Authenticator configurations on a given account via the access token - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {googleauthenticator} boolean type value,Enable google Authenticator Code. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param googleauthenticator boolean type value,Enable google Authenticator Code. * @return Response containing Definition of Delete Request *5.12.1 */ - mfaResetGoogleAuthByToken (accessToken, googleauthenticator) { + mfaResetGoogleAuthByToken (accessToken: string, googleauthenticator?: boolean) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -189,12 +189,12 @@ export default class MultiFactorAuthenticationApi { /** * This API resets the SMS Authenticator configurations on a given account via the access token. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {otpauthenticator} Pass 'otpauthenticator' to remove SMS Authenticator + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param otpauthenticator Pass 'otpauthenticator' to remove SMS Authenticator * @return Response containing Definition of Delete Request *5.12.2 */ - mfaResetSMSAuthByToken (accessToken, otpauthenticator) { + mfaResetSMSAuthByToken (accessToken: string, otpauthenticator?: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -219,11 +219,11 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to get a set of backup codes via access token to allow the user login on a site that has Multi-factor Authentication enabled in the event that the user does not have a secondary factor available. We generate 10 codes, each code can only be consumed once. If any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @return Response containing Definition of Complete Backup Code data *5.13 */ - mfaBackupCodeByAccessToken (accessToken) { + mfaBackupCodeByAccessToken (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -239,11 +239,11 @@ export default class MultiFactorAuthenticationApi { /** * API is used to reset the backup codes on a given account via the access token. This API call will generate 10 new codes, each code can only be consumed once - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @return Response containing Definition of Complete Backup Code data *5.14 */ - mfaResetBackupCodeByAccessToken (accessToken) { + mfaResetBackupCodeByAccessToken (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -259,13 +259,13 @@ export default class MultiFactorAuthenticationApi { /** * This API is created to send the OTP to the email if email OTP authenticator is enabled in app's MFA configuration. - * @param {accessToken} access_token - * @param {emailId} EmailId - * @param {emailTemplate2FA} EmailTemplate2FA + * @param accessToken access_token + * @param emailId EmailId + * @param emailTemplate2FA EmailTemplate2FA * @return Response containing Definition of Complete Validation data *5.17 */ - mfaEmailOtpByAccessToken (accessToken, emailId, emailTemplate2FA) { + mfaEmailOtpByAccessToken (accessToken: string, emailId: string, emailTemplate2FA?: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -288,14 +288,14 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to set up MFA Email OTP authenticator on profile after login. - * @param {accessToken} access_token - * @param {multiFactorAuthModelByEmailOtpWithLockout} payload + * @param accessToken access_token + * @param multiFactorAuthModelByEmailOtpWithLockout payload * @return Response containing Definition for Complete profile data *5.18 */ mfaValidateEmailOtpByAccessToken ( - accessToken, - multiFactorAuthModelByEmailOtpWithLockout + accessToken: string, + multiFactorAuthModelByEmailOtpWithLockout: any ) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); @@ -323,11 +323,11 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to reset the Email OTP Authenticator settings for an MFA-enabled user - * @param {accessToken} access_token + * @param accessToken access_token * @return Response containing Definition of Delete Request *5.19 */ - mfaResetEmailOtpAuthenticatorByAccessToken (accessToken) { + mfaResetEmailOtpAuthenticatorByAccessToken (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -343,14 +343,14 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to set up MFA Security Question authenticator on profile after login. - * @param {accessToken} access_token - * @param {securityQuestionAnswerModelByAccessToken} payload + * @param accessToken access_token + * @param securityQuestionAnswerModelByAccessToken payload * @return Response containing Definition of Complete Validation data *5.20 */ mfaSecurityQuestionAnswerByAccessToken ( - accessToken, - securityQuestionAnswerModelByAccessToken + accessToken: string, + securityQuestionAnswerModelByAccessToken: any ) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); @@ -378,11 +378,11 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to Reset MFA Security Question Authenticator By Access Token - * @param {accessToken} access_token + * @param accessToken access_token * @return Response containing Definition of Delete Request *5.21 */ - mfaResetSecurityQuestionAuthenticatorByAccessToken (accessToken) { + mfaResetSecurityQuestionAuthenticatorByAccessToken (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -399,29 +399,28 @@ export default class MultiFactorAuthenticationApi { /** * This API can be used to login by emailid on a Multi-factor authentication enabled LoginRadius site. - * @param {email} user's email - * @param {password} Password for the email - * @param {emailTemplate} Email template name - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {loginUrl} Url where the user is logging from - * @param {smsTemplate} SMS Template name - * @param {smsTemplate2FA} SMS Template Name - * @param {verificationUrl} Email verification url - * @param {emailTemplate2FA} 2FA Email Template name + * @param email user's email + * @param password Password for the email + * @param emailTemplate Email template name + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param loginUrl Url where the user is logging from + * @param smsTemplate SMS Template name + * @param smsTemplate2FA SMS Template Name + * @param verificationUrl Email verification url + * @param emailTemplate2FA 2FA Email Template name * @return Complete user UserProfile data - *9.8.1 */ mfaLoginByEmail ( - email, - password, - emailTemplate, - fields, - loginUrl, - smsTemplate, - smsTemplate2FA, - verificationUrl, - emailTemplate2FA + email: string, + password: string, + emailTemplate: string, + fields: string, + loginUrl: string, + smsTemplate: string, + smsTemplate2FA: string, + verificationUrl: string, + emailTemplate2FA: string ) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); @@ -471,28 +470,28 @@ export default class MultiFactorAuthenticationApi { /** * This API can be used to login by username on a Multi-factor authentication enabled LoginRadius site. - * @param {password} Password for the email - * @param {username} Username of the user - * @param {emailTemplate} Email template name - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {loginUrl} Url where the user is logging from - * @param {smsTemplate} SMS Template name - * @param {smsTemplate2FA} SMS Template Name - * @param {verificationUrl} Email verification url - * @param {emailTemplate2FA} 2FA Email Template name + * @param password Password for the email + * @param username Username of the user + * @param emailTemplate Email template name + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param loginUrl Url where the user is logging from + * @param smsTemplate SMS Template name + * @param smsTemplate2FA SMS Template Name + * @param verificationUrl Email verification url + * @param emailTemplate2FA 2FA Email Template name * @return Complete user UserProfile data *9.8.2 */ mfaLoginByUserName ( - password, - username, - emailTemplate, - fields, - loginUrl, - smsTemplate, - smsTemplate2FA, - verificationUrl, - emailTemplate2FA + password: string, + username: string, + emailTemplate?: string, + fields?: string, + loginUrl?: string, + smsTemplate?: string, + smsTemplate2FA?: string, + verificationUrl?: string, + emailTemplate2FA?: string ) { if (isNullOrWhiteSpace(password)) { return Promise.reject(getValidationMessage('password')); @@ -542,28 +541,28 @@ export default class MultiFactorAuthenticationApi { /** * This API can be used to login by Phone on a Multi-factor authentication enabled LoginRadius site. - * @param {password} Password for the email - * @param {phone} New Phone Number - * @param {emailTemplate} Email template name - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {loginUrl} Url where the user is logging from - * @param {smsTemplate} SMS Template name - * @param {smsTemplate2FA} SMS Template Name - * @param {verificationUrl} Email verification url - * @param {emailTemplate2FA} 2FA Email Template name + * @param password Password for the email + * @param phone New Phone Number + * @param emailTemplate Email template name + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param loginUrl Url where the user is logging from + * @param smsTemplate SMS Template name + * @param smsTemplate2FA SMS Template Name + * @param verificationUrl Email verification url + * @param emailTemplate2FA 2FA Email Template name * @return Complete user UserProfile data *9.8.3 */ mfaLoginByPhone ( - password, - phone, - emailTemplate, - fields, - loginUrl, - smsTemplate, - smsTemplate2FA, - verificationUrl, - emailTemplate2FA + password: string, + phone: string, + emailTemplate?: string, + fields?: string, + loginUrl?: string, + smsTemplate?: string, + smsTemplate2FA?: string, + verificationUrl?: string, + emailTemplate2FA?: string ) { if (isNullOrWhiteSpace(password)) { return Promise.reject(getValidationMessage('password')); @@ -612,26 +611,26 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to login via Multi-factor authentication by passing the One Time Password received via SMS - * @param {multiFactorAuthModelWithLockout} Model Class containing Definition of payload for MultiFactorAuthModel With Lockout API - * @param {secondFactorAuthenticationToken} A Uniquely generated MFA identifier token after successful authentication - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {smsTemplate2FA} SMS Template Name - * @param {rbaBrowserEmailTemplate} - * @param {rbaCityEmailTemplate} - * @param {rbaCountryEmailTemplate} - * @param {rbaIpEmailTemplate} + * @param multiFactorAuthModelWithLockout Model Class containing Definition of payload for MultiFactorAuthModel With Lockout API + * @param secondFactorAuthenticationToken A Uniquely generated MFA identifier token after successful authentication + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param smsTemplate2FA SMS Template Name + * @param rbaBrowserEmailTemplate + * @param rbaCityEmailTemplate + * @param rbaCountryEmailTemplate + * @param rbaIpEmailTemplate * @return Complete user UserProfile data *9.12 */ mfaValidateOTPByPhone ( - multiFactorAuthModelWithLockout, - secondFactorAuthenticationToken, - fields, - smsTemplate2FA, - rbaBrowserEmailTemplate, - rbaCityEmailTemplate, - rbaCountryEmailTemplate, - rbaIpEmailTemplate + multiFactorAuthModelWithLockout: object, + secondFactorAuthenticationToken: string, + fields?: string, + smsTemplate2FA?: string, + rbaBrowserEmailTemplate?: string, + rbaCityEmailTemplate?: string, + rbaCountryEmailTemplate?: string, + rbaIpEmailTemplate?: string ) { if (checkJson(multiFactorAuthModelWithLockout)) { return Promise.reject( @@ -680,24 +679,24 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to login via Multi-factor-authentication by passing the google authenticator code. - * @param {googleAuthenticatorCode} The code generated by google authenticator app after scanning QR code - * @param {secondFactorAuthenticationToken} SecondFactorAuthenticationToken - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {rbaBrowserEmailTemplate} RbaBrowserEmailTemplate - * @param {rbaCityEmailTemplate} RbaCityEmailTemplate - * @param {rbaCountryEmailTemplate} RbaCountryEmailTemplate - * @param {rbaIpEmailTemplate} RbaIpEmailTemplate + * @param googleAuthenticatorCode The code generated by google authenticator app after scanning QR code + * @param secondFactorAuthenticationToken SecondFactorAuthenticationToken + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param rbaBrowserEmailTemplate RbaBrowserEmailTemplate + * @param rbaCityEmailTemplate RbaCityEmailTemplate + * @param rbaCountryEmailTemplate RbaCountryEmailTemplate + * @param rbaIpEmailTemplate RbaIpEmailTemplate * @return Complete user UserProfile data *9.13 */ mfaValidateGoogleAuthCode ( - googleAuthenticatorCode, - secondFactorAuthenticationToken, - fields, - rbaBrowserEmailTemplate, - rbaCityEmailTemplate, - rbaCountryEmailTemplate, - rbaIpEmailTemplate + googleAuthenticatorCode: string, + secondFactorAuthenticationToken: string, + fields?: string, + rbaBrowserEmailTemplate?: string, + rbaCityEmailTemplate?: string, + rbaCountryEmailTemplate?: string, + rbaIpEmailTemplate?: string ) { if (isNullOrWhiteSpace(googleAuthenticatorCode)) { return Promise.reject(getValidationMessage('googleAuthenticatorCode')); @@ -745,24 +744,24 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to validate the backup code provided by the user and if valid, we return an access token allowing the user to login incases where Multi-factor authentication (MFA) is enabled and the secondary factor is unavailable. When a user initially downloads the Backup codes, We generate 10 codes, each code can only be consumed once. if any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically - * @param {multiFactorAuthModelByBackupCode} Model Class containing Definition of payload for MultiFactorAuth By BackupCode API - * @param {secondFactorAuthenticationToken} A Uniquely generated MFA identifier token after successful authentication - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {rbaBrowserEmailTemplate} - * @param {rbaCityEmailTemplate} - * @param {rbaCountryEmailTemplate} - * @param {rbaIpEmailTemplate} + * @param multiFactorAuthModelByBackupCode Model Class containing Definition of payload for MultiFactorAuth By BackupCode API + * @param secondFactorAuthenticationToken A Uniquely generated MFA identifier token after successful authentication + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param rbaBrowserEmailTemplate + * @param rbaCityEmailTemplate + * @param rbaCountryEmailTemplate + * @param rbaIpEmailTemplate * @return Complete user UserProfile data *9.14 */ mfaValidateBackupCode ( - multiFactorAuthModelByBackupCode, - secondFactorAuthenticationToken, - fields, - rbaBrowserEmailTemplate, - rbaCityEmailTemplate, - rbaCountryEmailTemplate, - rbaIpEmailTemplate + multiFactorAuthModelByBackupCode: object, + secondFactorAuthenticationToken: string, + fields?: string, + rbaBrowserEmailTemplate?: string, + rbaCityEmailTemplate?: string, + rbaCountryEmailTemplate?: string, + rbaIpEmailTemplate?: string ) { if (checkJson(multiFactorAuthModelByBackupCode)) { return Promise.reject( @@ -808,16 +807,16 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to update (if configured) the phone number used for Multi-factor authentication by sending the verification OTP to the provided phone number - * @param {phoneNo2FA} Phone Number For 2FA - * @param {secondFactorAuthenticationToken} A Uniquely generated MFA identifier token after successful authentication - * @param {smsTemplate2FA} SMS Template Name + * @param phoneNo2FA Phone Number For 2FA + * @param secondFactorAuthenticationToken A Uniquely generated MFA identifier token after successful authentication + * @param smsTemplate2FA SMS Template Name * @return Response containing Definition for Complete SMS data *9.16 */ mfaUpdatePhoneNumber ( - phoneNo2FA, - secondFactorAuthenticationToken, - smsTemplate2FA + phoneNo2FA: string, + secondFactorAuthenticationToken: string, + smsTemplate2FA?: string ) { if (isNullOrWhiteSpace(phoneNo2FA)) { return Promise.reject(getValidationMessage('phoneNo2FA')); @@ -852,8 +851,8 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to resending the verification OTP to the provided phone number - * @param {secondFactorAuthenticationToken} A Uniquely generated MFA identifier token after successful authentication - * @param {smsTemplate2FA} SMS Template Name + * @param secondFactorAuthenticationToken A Uniquely generated MFA identifier token after successful authentication + * @param smsTemplate2FA SMS Template Name * @return Response containing Definition for Complete SMS data *9.17 */ @@ -879,13 +878,13 @@ export default class MultiFactorAuthenticationApi { /** * An API designed to send the MFA Email OTP to the email. - * @param {emailIdModel} payload - * @param {secondFactorAuthenticationToken} SecondFactorAuthenticationToken - * @param {emailTemplate2FA} EmailTemplate2FA + * @param emailIdModel payload + * @param secondFactorAuthenticationToken SecondFactorAuthenticationToken + * @param emailTemplate2FA EmailTemplate2FA * @return Response containing Definition of Complete Validation data *9.18 */ - mfaEmailOTP (emailIdModel, secondFactorAuthenticationToken, emailTemplate2FA) { + mfaEmailOTP (emailIdModel: object, secondFactorAuthenticationToken: string, emailTemplate2FA?: string) { if (checkJson(emailIdModel)) { return Promise.reject(getValidationMessage('emailIdModel')); } @@ -916,22 +915,22 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to Verify MFA Email OTP by MFA Token - * @param {multiFactorAuthModelByEmailOtp} payload - * @param {secondFactorAuthenticationToken} SecondFactorAuthenticationToken - * @param {rbaBrowserEmailTemplate} RbaBrowserEmailTemplate - * @param {rbaCityEmailTemplate} RbaCityEmailTemplate - * @param {rbaCountryEmailTemplate} RbaCountryEmailTemplate - * @param {rbaIpEmailTemplate} RbaIpEmailTemplate + * @param multiFactorAuthModelByEmailOtp payload + * @param secondFactorAuthenticationToken SecondFactorAuthenticationToken + * @param rbaBrowserEmailTemplate RbaBrowserEmailTemplate + * @param rbaCityEmailTemplate RbaCityEmailTemplate + * @param rbaCountryEmailTemplate RbaCountryEmailTemplate + * @param rbaIpEmailTemplate RbaIpEmailTemplate * @return Response Containing Access Token and Complete Profile Data *9.25 */ mfaValidateEmailOtp ( - multiFactorAuthModelByEmailOtp, - secondFactorAuthenticationToken, - rbaBrowserEmailTemplate, - rbaCityEmailTemplate, - rbaCountryEmailTemplate, - rbaIpEmailTemplate + multiFactorAuthModelByEmailOtp: object, + secondFactorAuthenticationToken: string, + rbaBrowserEmailTemplate?: string, + rbaCityEmailTemplate?: string, + rbaCountryEmailTemplate?: string, + rbaIpEmailTemplate?: string ) { if (checkJson(multiFactorAuthModelByEmailOtp)) { return Promise.reject( @@ -974,14 +973,14 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to set the security questions on the profile with the MFA token when MFA flow is required. - * @param {securityQuestionAnswerUpdateModel} payload - * @param {secondFactorAuthenticationToken} SecondFactorAuthenticationToken + * @param securityQuestionAnswerUpdateModel payload + * @param secondFactorAuthenticationToken SecondFactorAuthenticationToken * @return Response Containing Access Token and Complete Profile Data *9.26 */ mfaSecurityQuestionAnswer ( - securityQuestionAnswerUpdateModel, - secondFactorAuthenticationToken + securityQuestionAnswerUpdateModel: object, + secondFactorAuthenticationToken: string ) { if (checkJson(securityQuestionAnswerUpdateModel)) { return Promise.reject( @@ -1012,22 +1011,22 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to resending the verification OTP to the provided phone number - * @param {securityQuestionAnswerUpdateModel} payload - * @param {secondFactorAuthenticationToken} SecondFactorAuthenticationToken - * @param {rbaBrowserEmailTemplate} RbaBrowserEmailTemplate - * @param {rbaCityEmailTemplate} RbaCityEmailTemplate - * @param {rbaCountryEmailTemplate} RbaCountryEmailTemplate - * @param {rbaIpEmailTemplate} RbaIpEmailTemplate + * @param securityQuestionAnswerUpdateModel payload + * @param secondFactorAuthenticationToken SecondFactorAuthenticationToken + * @param rbaBrowserEmailTemplate RbaBrowserEmailTemplate + * @param rbaCityEmailTemplate RbaCityEmailTemplate + * @param rbaCountryEmailTemplate RbaCountryEmailTemplate + * @param rbaIpEmailTemplate RbaIpEmailTemplate * @return Response Containing Access Token and Complete Profile Data *9.27 */ mfaSecurityQuestionAnswerVerification ( - securityQuestionAnswerUpdateModel, - secondFactorAuthenticationToken, - rbaBrowserEmailTemplate, - rbaCityEmailTemplate, - rbaCountryEmailTemplate, - rbaIpEmailTemplate + securityQuestionAnswerUpdateModel: object, + secondFactorAuthenticationToken: string, + rbaBrowserEmailTemplate?: string, + rbaCityEmailTemplate?: string, + rbaCountryEmailTemplate?: string, + rbaIpEmailTemplate?: string ) { if (checkJson(securityQuestionAnswerUpdateModel)) { return Promise.reject( @@ -1071,12 +1070,12 @@ export default class MultiFactorAuthenticationApi { /** * This API resets the SMS Authenticator configurations on a given account via the UID. - * @param {otpauthenticator} Pass 'otpauthenticator' to remove SMS Authenticator - * @param {uid} UID, the unified identifier for each user account + * @param otpauthenticator Pass 'otpauthenticator' to remove SMS Authenticator + * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Delete Request *18.21.1 */ - mfaResetSMSAuthenticatorByUid (otpauthenticator, uid) { + mfaResetSMSAuthenticatorByUid (otpauthenticator: string, uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -1102,12 +1101,12 @@ export default class MultiFactorAuthenticationApi { /** * This API resets the Google Authenticator configurations on a given account via the UID. - * @param {googleauthenticator} boolean type value,Enable google Authenticator Code. - * @param {uid} UID, the unified identifier for each user account + * @param googleauthenticator boolean type value,Enable google Authenticator Code. + * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Delete Request *18.21.2 */ - mfaResetGoogleAuthenticatorByUid (googleauthenticator, uid) { + mfaResetGoogleAuthenticatorByUid (googleauthenticator: boolean, uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -1133,11 +1132,11 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to reset the backup codes on a given account via the UID. This API call will generate 10 new codes, each code can only be consumed once. - * @param {uid} UID, the unified identifier for each user account + * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Complete Backup Code data *18.25 */ - mfaBackupCodeByUid (uid) { + mfaBackupCodeByUid (uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -1154,11 +1153,11 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to reset the backup codes on a given account via the UID. This API call will generate 10 new codes, each code can only be consumed once. - * @param {uid} UID, the unified identifier for each user account + * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Complete Backup Code data *18.26 */ - mfaResetBackupCodeByUid (uid) { + mfaResetBackupCodeByUid (uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -1175,11 +1174,11 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to reset the Email OTP Authenticator settings for an MFA-enabled user. - * @param {uid} UID, the unified identifier for each user account + * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Delete Request *18.42 */ - mfaResetEmailOtpAuthenticatorByUid (uid) { + mfaResetEmailOtpAuthenticatorByUid (uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } @@ -1196,11 +1195,11 @@ export default class MultiFactorAuthenticationApi { /** * This API is used to reset the Security Question Authenticator settings for an MFA-enabled user. - * @param {uid} UID, the unified identifier for each user account + * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Delete Request *18.43 */ - mfaResetSecurityQuestionAuthenticatorByUid (uid) { + mfaResetSecurityQuestionAuthenticatorByUid (uid: string) { if (isNullOrWhiteSpace(uid)) { return Promise.reject(getValidationMessage('uid')); } diff --git a/loginradius-sdk/src/api/advanced/reAuthenticationApi.ts b/loginradius-sdk/src/api/advanced/reAuthenticationApi.ts index 562b910..2d8a046 100644 --- a/loginradius-sdk/src/api/advanced/reAuthenticationApi.ts +++ b/loginradius-sdk/src/api/advanced/reAuthenticationApi.ts @@ -16,12 +16,12 @@ export default class ReAuthenticationApi { /** * This API is used to trigger the Multi-Factor Autentication workflow for the provided access token - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {smsTemplate2FA} SMS Template Name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param smsTemplate2FA SMS Template Name * @return Response containing Definition of Complete Multi-Factor Authentication Settings data *14.3 */ - mfaReAuthenticate (accessToken, smsTemplate2FA) { + mfaReAuthenticate (accessToken: string, smsTemplate2FA?: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -40,12 +40,12 @@ export default class ReAuthenticationApi { /** * This API is used to re-authenticate via Multi-factor authentication by passing the One Time Password received via SMS - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {reauthByOtpModel} Model Class containing Definition for MFA Reauthentication by OTP + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param reauthByOtpModel Model Class containing Definition for MFA Reauthentication by OTP * @return Complete user Multi-Factor Authentication Token data *14.4 */ - mfaReAuthenticateByOTP (accessToken, reauthByOtpModel) { + mfaReAuthenticateByOTP (accessToken: string, reauthByOtpModel: object) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -70,12 +70,12 @@ export default class ReAuthenticationApi { /** * This API is used to re-authenticate by set of backup codes via access token on the site that has Multi-factor authentication enabled in re-authentication for the user that does not have the device - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {reauthByBackupCodeModel} Model Class containing Definition for MFA Reauthentication by Backup code + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param reauthByBackupCodeModel Model Class containing Definition for MFA Reauthentication by Backup code * @return Complete user Multi-Factor Authentication Token data *14.5 */ - mfaReAuthenticateByBackupCode (accessToken, reauthByBackupCodeModel) { + mfaReAuthenticateByBackupCode (accessToken: string, reauthByBackupCodeModel: object) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -100,14 +100,14 @@ export default class ReAuthenticationApi { /** * This API is used to re-authenticate via Multi-factor-authentication by passing the google authenticator code - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {reauthByGoogleAuthenticatorCodeModel} Model Class containing Definition for MFA Reauthentication by Google Authenticator + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param reauthByGoogleAuthenticatorCodeModel Model Class containing Definition for MFA Reauthentication by Google Authenticator * @return Complete user Multi-Factor Authentication Token data *14.6 */ mfaReAuthenticateByGoogleAuth ( - accessToken, - reauthByGoogleAuthenticatorCodeModel + accessToken: string, + reauthByGoogleAuthenticatorCodeModel: object ) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); @@ -136,16 +136,16 @@ export default class ReAuthenticationApi { /** * This API is used to re-authenticate via Multi-factor-authentication by passing the password - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {passwordEventBasedAuthModelWithLockout} Model Class containing Definition of payload for PasswordEventBasedAuthModel with Lockout API - * @param {smsTemplate2FA} SMS Template Name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param passwordEventBasedAuthModelWithLockout Model Class containing Definition of payload for PasswordEventBasedAuthModel with Lockout API + * @param smsTemplate2FA SMS Template Name * @return Complete user Multi-Factor Authentication Token data *14.7 */ mfaReAuthenticateByPassword ( - accessToken, - passwordEventBasedAuthModelWithLockout, - smsTemplate2FA + accessToken: string, + passwordEventBasedAuthModelWithLockout: object, + smsTemplate2FA?: string ) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); @@ -176,8 +176,8 @@ export default class ReAuthenticationApi { /** * This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by OTP. - * @param {eventBasedMultiFactorToken} Model Class containing Definition for SecondFactorValidationToken - * @param {uid} UID, the unified identifier for each user account + * @param eventBasedMultiFactorToken Model Class containing Definition for SecondFactorValidationToken + * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Complete Validation data *18.38 */ @@ -206,8 +206,8 @@ export default class ReAuthenticationApi { /** * This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by password. - * @param {eventBasedMultiFactorToken} Model Class containing Definition for SecondFactorValidationToken - * @param {uid} UID, the unified identifier for each user account + * @param eventBasedMultiFactorToken Model Class containing Definition for SecondFactorValidationToken + * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Complete Validation data *18.39 */ @@ -236,8 +236,8 @@ export default class ReAuthenticationApi { /** * This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by PIN. - * @param {eventBasedMultiFactorToken} Model Class containing Definition for SecondFactorValidationToken - * @param {uid} UID, the unified identifier for each user account + * @param eventBasedMultiFactorToken Model Class containing Definition for SecondFactorValidationToken + * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Complete Validation data *18.40 */ @@ -266,9 +266,9 @@ export default class ReAuthenticationApi { /** * This API is used to validate the triggered MFA authentication flow with a password. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {pINAuthEventBasedAuthModelWithLockout} Model Class containing Definition of payload for PIN - * @param {smsTemplate2FA} SMS Template Name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param pINAuthEventBasedAuthModelWithLockout Model Class containing Definition of payload for PIN + * @param smsTemplate2FA SMS Template Name * @return Response containing Definition response of MFA reauthentication *42.13 */ @@ -306,8 +306,8 @@ export default class ReAuthenticationApi { /** * This API is used to validate the triggered MFA authentication flow with an Email OTP. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {reauthByEmailOtpModel} payload + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param reauthByEmailOtpModel payload * @return Response containing Definition response of MFA reauthentication *42.14 */ @@ -336,9 +336,9 @@ export default class ReAuthenticationApi { /** * This API is used to send the MFA Email OTP to the email for Re-authentication - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {emailId} EmailId - * @param {emailTemplate2FA} EmailTemplate2FA + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param emailId EmailId + * @param emailTemplate2FA EmailTemplate2FA * @return Response containing Definition of Complete Validation data *42.15 */ @@ -365,8 +365,8 @@ export default class ReAuthenticationApi { /** * This API is used to validate the triggered MFA re-authentication flow with security questions answers. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {securityQuestionAnswerUpdateModel} payload + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param securityQuestionAnswerUpdateModel payload * @return Response containing Definition response of MFA reauthentication *42.16 */ diff --git a/loginradius-sdk/src/api/advanced/webHookApi.ts b/loginradius-sdk/src/api/advanced/webHookApi.ts index 3356c2b..8263e97 100644 --- a/loginradius-sdk/src/api/advanced/webHookApi.ts +++ b/loginradius-sdk/src/api/advanced/webHookApi.ts @@ -16,11 +16,11 @@ export default class WebHookApi { /** * This API is used to fatch all the subscribed URLs, for particular event - * @param {event} Allowed events: Login, Register, UpdateProfile, ResetPassword, ChangePassword, emailVerification, AddEmail, RemoveEmail, BlockAccount, DeleteAccount, SetUsername, AssignRoles, UnassignRoles, SetPassword, LinkAccount, UnlinkAccount, UpdatePhoneId, VerifyPhoneNumber, CreateCustomObject, UpdateCustomobject, DeleteCustomObject + * @param event Allowed events: Login, Register, UpdateProfile, ResetPassword, ChangePassword, emailVerification, AddEmail, RemoveEmail, BlockAccount, DeleteAccount, SetUsername, AssignRoles, UnassignRoles, SetPassword, LinkAccount, UnlinkAccount, UpdatePhoneId, VerifyPhoneNumber, CreateCustomObject, UpdateCustomobject, DeleteCustomObject * @return Response Containing List of Webhhook Data *40.1 */ - getWebHookSubscribedURLs (event) { + getWebHookSubscribedURLs (event: string) { if (isNullOrWhiteSpace(event)) { return Promise.reject(getValidationMessage('event')); } @@ -37,11 +37,11 @@ export default class WebHookApi { /** * API can be used to configure a WebHook on your LoginRadius site. Webhooks also work on subscribe and notification model, subscribe your hook and get a notification. Equivalent to RESThook but these provide security on basis of signature and RESThook work on unique URL. Following are the events that are allowed by LoginRadius to trigger a WebHook service call. - * @param {webHookSubscribeModel} Model Class containing Definition of payload for Webhook Subscribe API + * @param webHookSubscribeModel Model Class containing Definition of payload for Webhook Subscribe API * @return Response containing Definition of Complete Validation data *40.2 */ - webHookSubscribe (webHookSubscribeModel) { + webHookSubscribe (webHookSubscribeModel: object) { if (checkJson(webHookSubscribeModel)) { return Promise.reject(getValidationMessage('webHookSubscribeModel')); } @@ -79,11 +79,11 @@ export default class WebHookApi { /** * API can be used to unsubscribe a WebHook configured on your LoginRadius site. - * @param {webHookSubscribeModel} Model Class containing Definition of payload for Webhook Subscribe API + * @param webHookSubscribeModel Model Class containing Definition of payload for Webhook Subscribe API * @return Response containing Definition of Delete Request *40.4 */ - webHookUnsubscribe (webHookSubscribeModel) { + webHookUnsubscribe (webHookSubscribeModel: object) { if (checkJson(webHookSubscribeModel)) { return Promise.reject(getValidationMessage('webHookSubscribeModel')); } diff --git a/loginradius-sdk/src/api/authentication/authenticationApi.ts b/loginradius-sdk/src/api/authentication/authenticationApi.ts index af59d7e..8e5e538 100644 --- a/loginradius-sdk/src/api/authentication/authenticationApi.ts +++ b/loginradius-sdk/src/api/authentication/authenticationApi.ts @@ -16,11 +16,11 @@ export default class AuthenticationApi { /** * This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. - * @param {email} Email of the user + * @param email Email of the user * @return Response containing Definition for Complete SecurityQuestions data *2.1 */ - getSecurityQuestionsByEmail (email) { + getSecurityQuestionsByEmail (email: string) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); } @@ -36,11 +36,11 @@ export default class AuthenticationApi { /** * This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. - * @param {userName} UserName of the user + * @param userName UserName of the user * @return Response containing Definition for Complete SecurityQuestions data *2.2 */ - getSecurityQuestionsByUserName (userName) { + getSecurityQuestionsByUserName (userName: string) { if (isNullOrWhiteSpace(userName)) { return Promise.reject(getValidationMessage('userName')); } @@ -56,11 +56,11 @@ export default class AuthenticationApi { /** * This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. - * @param {phone} The Registered Phone Number + * @param phone The Registered Phone Number * @return Response containing Definition for Complete SecurityQuestions data *2.3 */ - getSecurityQuestionsByPhone (phone) { + getSecurityQuestionsByPhone (phone: string) { if (isNullOrWhiteSpace(phone)) { return Promise.reject(getValidationMessage('phone')); } @@ -76,11 +76,11 @@ export default class AuthenticationApi { /** * This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @return Response containing Definition for Complete SecurityQuestions data *2.4 */ - getSecurityQuestionsByAccessToken (accessToken) { + getSecurityQuestionsByAccessToken (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -96,11 +96,11 @@ export default class AuthenticationApi { /** * This api validates access token, if valid then returns a response with its expiry otherwise error. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @return Response containing Definition of Complete Token data *4.1 */ - authValidateAccessToken (accessToken) { + authValidateAccessToken (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -116,12 +116,12 @@ export default class AuthenticationApi { /** * This api call invalidates the active access token or expires an access token's validity. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {preventRefresh} Boolean value that when set as true, in addition of the access token being invalidated, it will no longer have the capability of being refreshed. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param preventRefresh Boolean value that when set as true, in addition of the access token being invalidated, it will no longer have the capability of being refreshed. * @return Response containing Definition of Complete Validation data *4.2 this.config.this.config.*/ - authInValidateAccessToken (accessToken, preventRefresh) { + authInValidateAccessToken (accessToken: string, preventRefresh: boolean) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -140,11 +140,11 @@ export default class AuthenticationApi { /** * This api call provide the active access token Information - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @return Response containing Definition of Token Information *4.3 */ - getAccessTokenInfo (accessToken) { + getAccessTokenInfo (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -160,20 +160,20 @@ export default class AuthenticationApi { /** * This API retrieves a copy of the user data based on the access token. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {emailTemplate} - * @param {verificationUrl} - * @param {welcomeEmailTemplate} + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param emailTemplate + * @param verificationUrl + * @param welcomeEmailTemplate * @return Response containing Definition for Complete profile data *5.2 */ getProfileByAccessToken ( - accessToken, - fields, - emailTemplate, - verificationUrl, - welcomeEmailTemplate + accessToken: string, + fields?: string, + emailTemplate?: string, + verificationUrl?: string, + welcomeEmailTemplate?: string ) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); @@ -202,12 +202,12 @@ export default class AuthenticationApi { /** * This API sends a welcome email - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {welcomeEmailTemplate} Name of the welcome email template + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param welcomeEmailTemplate Name of the welcome email template * @return Response containing Definition of Complete Validation data *5.3 */ - sendWelcomeEmail (accessToken, welcomeEmailTemplate) { + sendWelcomeEmail (accessToken: string, welcomeEmailTemplate?: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -226,24 +226,24 @@ export default class AuthenticationApi { /** * This API is used to update the user's profile by passing the access token. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {userProfileUpdateModel} Model Class containing Definition of payload for User Profile update API - * @param {emailTemplate} Email template name - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {nullSupport} Boolean, pass true if you wish to update any user profile field with a NULL value, You can get the details - * @param {smsTemplate} SMS Template name - * @param {verificationUrl} Email verification url + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param userProfileUpdateModel Model Class containing Definition of payload for User Profile update API + * @param emailTemplate Email template name + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param nullSupport Boolean, pass true if you wish to update any user profile field with a NULL value, You can get the details + * @param smsTemplate SMS Template name + * @param verificationUrl Email verification url * @return Response containing Definition of Complete Validation and UserProfile data *5.4 */ updateProfileByAccessToken ( - accessToken, - userProfileUpdateModel, - emailTemplate, - fields, - nullSupport, - smsTemplate, - verificationUrl + accessToken: string, + userProfileUpdateModel: object, + emailTemplate?: string, + fields?: string, + nullSupport?: boolean, + smsTemplate?: string, + verificationUrl?: string ) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); @@ -284,13 +284,13 @@ export default class AuthenticationApi { /** * This API will send a confirmation email for account deletion to the customer's email when passed the customer's access token - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {deleteUrl} Url of the site - * @param {emailTemplate} Email template name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param deleteUrl Url of the site + * @param emailTemplate Email template name * @return Response containing Definition of Delete Request *5.5 */ - deleteAccountWithEmailConfirmation (accessToken, deleteUrl, emailTemplate) { + deleteAccountWithEmailConfirmation (accessToken: string, deleteUrl?: string, emailTemplate?: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -312,11 +312,11 @@ export default class AuthenticationApi { /** * This API is used to delete an account by passing it a delete token. - * @param {deletetoken} Delete token received in the email + * @param deletetoken Delete token received in the email * @return Response containing Definition of Complete Validation data *5.6 */ - deleteAccountByDeleteToken (deletetoken) { + deleteAccountByDeleteToken (deletetoken: string) { if (isNullOrWhiteSpace(deletetoken)) { return Promise.reject(getValidationMessage('deletetoken')); } @@ -332,12 +332,12 @@ export default class AuthenticationApi { /** * This API is used to allow a customer with a valid access token to unlock their account provided that they successfully pass the prompted Bot Protection challenges. The Block or Suspend block types are not applicable for this API. For additional details see our Auth Security Configuration documentation.You are only required to pass the Post Parameters that correspond to the prompted challenges. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {unlockProfileModel} Payload containing Unlock Profile API + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param unlockProfileModel Payload containing Unlock Profile API * @return Response containing Definition of Complete Validation data *5.15 */ - unlockAccountByToken (accessToken, unlockProfileModel) { + unlockAccountByToken (accessToken: string, unlockProfileModel: object) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -362,20 +362,20 @@ export default class AuthenticationApi { /** * This API is used to get a user's profile using the clientGuid parameter if no callback feature enabled - * @param {clientGuid} ClientGuid - * @param {emailTemplate} EmailTemplate - * @param {fields} Fields - * @param {verificationUrl} VerificationUrl - * @param {welcomeEmailTemplate} WelcomeEmailTemplate + * @param clientGuid ClientGuid + * @param emailTemplate EmailTemplate + * @param fields Fields + * @param verificationUrl VerificationUrl + * @param welcomeEmailTemplate WelcomeEmailTemplate * @return Response containing User Profile Data and access token *5.16 */ getProfileByPing ( - clientGuid, - emailTemplate, - fields, - verificationUrl, - welcomeEmailTemplate + clientGuid: string, + emailTemplate?: string, + fields?: string, + verificationUrl?: string, + welcomeEmailTemplate?: string ) { if (isNullOrWhiteSpace(clientGuid)) { return Promise.reject(getValidationMessage('clientGuid')); @@ -404,11 +404,11 @@ export default class AuthenticationApi { /** * This API is used to check the email exists or not on your site. - * @param {email} Email of the user + * @param email Email of the user * @return Response containing Definition Complete ExistResponse data *8.1 */ - checkEmailAvailability (email) { + checkEmailAvailability (email: string) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); } @@ -424,14 +424,14 @@ export default class AuthenticationApi { /** * This API is used to verify the email of user. Note: This API will only return the full profile if you have 'Enable auto login after email verification' set in your LoginRadius Admin Console's Email Workflow settings under 'Verification Email'. - * @param {verificationToken} Verification token received in the email - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {url} Mention URL to log the main URL(Domain name) in Database. - * @param {welcomeEmailTemplate} Name of the welcome email template + * @param verificationToken Verification token received in the email + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param url Mention URL to log the main URL(Domain name) in Database. + * @param welcomeEmailTemplate Name of the welcome email template * @return Response containing Definition of Complete Validation, UserProfile data and Access Token *8.2 */ - verifyEmail (verificationToken, fields, url, welcomeEmailTemplate) { + verifyEmail (verificationToken: string, fields?: string, url?: string, welcomeEmailTemplate?: string) { if (isNullOrWhiteSpace(verificationToken)) { return Promise.reject(getValidationMessage('verificationToken')); } @@ -456,18 +456,18 @@ export default class AuthenticationApi { /** * This API is used to verify the email of user when the OTP Email verification flow is enabled, please note that you must contact LoginRadius to have this feature enabled. - * @param {emailVerificationByOtpModel} Model Class containing Definition for EmailVerificationByOtpModel API - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {url} Mention URL to log the main URL(Domain name) in Database. - * @param {welcomeEmailTemplate} Name of the welcome email template + * @param emailVerificationByOtpModel Model Class containing Definition for EmailVerificationByOtpModel API + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param url Mention URL to log the main URL(Domain name) in Database. + * @param welcomeEmailTemplate Name of the welcome email template * @return Response containing Definition of Complete Validation, UserProfile data and Access Token *8.3 */ verifyEmailByOTP ( - emailVerificationByOtpModel, - fields, - url, - welcomeEmailTemplate + emailVerificationByOtpModel: object, + fields?: string, + url?: string, + welcomeEmailTemplate?: string ) { if (checkJson(emailVerificationByOtpModel)) { return Promise.reject( @@ -500,15 +500,15 @@ export default class AuthenticationApi { /** * This API is used to add additional emails to a user's account. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {email} user's email - * @param {type} String to identify the type of parameter - * @param {emailTemplate} Email template name - * @param {verificationUrl} Email verification url + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param email user's email + * @param type String to identify the type of parameter + * @param emailTemplate Email template name + * @param verificationUrl Email verification url * @return Response containing Definition of Complete Validation data *8.5 */ - addEmail (accessToken, email, type, emailTemplate, verificationUrl) { + addEmail (accessToken: string, email: string, type: string, emailTemplate: string, verificationUrl: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -546,12 +546,12 @@ export default class AuthenticationApi { /** * This API is used to remove additional emails from a user's account. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {email} user's email + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param email user's email * @return Response containing Definition of Delete Request *8.6 */ - removeEmail (accessToken, email) { + removeEmail (accessToken: string, email: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -579,20 +579,20 @@ export default class AuthenticationApi { /** * This API retrieves a copy of the user data based on the Email - * @param {emailAuthenticationModel} Model Class containing Definition of payload for Email Authentication API - * @param {emailTemplate} Email template name - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {loginUrl} Url where the user is logging from - * @param {verificationUrl} Email verification url + * @param emailAuthenticationModel Model Class containing Definition of payload for Email Authentication API + * @param emailTemplate Email template name + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param loginUrl Url where the user is logging from + * @param verificationUrl Email verification url * @return Response containing User Profile Data and access token *9.2.1 */ loginByEmail ( - emailAuthenticationModel, - emailTemplate, - fields, - loginUrl, - verificationUrl + emailAuthenticationModel: object, + emailTemplate?: string, + fields?: string, + loginUrl?: string, + verificationUrl?: string ) { if (checkJson(emailAuthenticationModel)) { return Promise.reject(getValidationMessage('emailAuthenticationModel')); @@ -626,20 +626,20 @@ export default class AuthenticationApi { /** * This API retrieves a copy of the user data based on the Username - * @param {userNameAuthenticationModel} Model Class containing Definition of payload for Username Authentication API - * @param {emailTemplate} Email template name - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {loginUrl} Url where the user is logging from - * @param {verificationUrl} Email verification url + * @param userNameAuthenticationModel Model Class containing Definition of payload for Username Authentication API + * @param emailTemplate Email template name + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param loginUrl Url where the user is logging from + * @param verificationUrl Email verification url * @return Response containing User Profile Data and access token *9.2.2 */ loginByUserName ( - userNameAuthenticationModel, - emailTemplate, - fields, - loginUrl, - verificationUrl + userNameAuthenticationModel: object, + emailTemplate?: string, + fields?: string, + loginUrl?: string, + verificationUrl?: string ) { if (checkJson(userNameAuthenticationModel)) { return Promise.reject( @@ -675,13 +675,13 @@ export default class AuthenticationApi { /** * This API is used to send the reset password url to a specified account. Note: If you have the UserName workflow enabled, you may replace the 'email' parameter with 'username' - * @param {email} user's email - * @param {resetPasswordUrl} Url to which user should get re-directed to for resetting the password - * @param {emailTemplate} Email template name + * @param email user's email + * @param resetPasswordUrl Url to which user should get re-directed to for resetting the password + * @param emailTemplate Email template name * @return Response containing Definition of Complete Validation data *10.1 */ - forgotPassword (email, resetPasswordUrl, emailTemplate) { + forgotPassword (email: string, resetPasswordUrl: string, emailTemplate?: string) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); } @@ -712,12 +712,12 @@ export default class AuthenticationApi { /** * This API is used to reset password for the specified account by security question - * @param {resetPasswordBySecurityAnswerAndEmailModel} Model Class containing Definition of payload for ResetPasswordBySecurityAnswerAndEmail API + * @param resetPasswordBySecurityAnswerAndEmailModel Model Class containing Definition of payload for ResetPasswordBySecurityAnswerAndEmail API * @return Response containing Definition of Validation data and access token *10.3.1 */ resetPasswordBySecurityAnswerAndEmail ( - resetPasswordBySecurityAnswerAndEmailModel + resetPasswordBySecurityAnswerAndEmailModel: object ) { if (checkJson(resetPasswordBySecurityAnswerAndEmailModel)) { return Promise.reject( @@ -741,12 +741,12 @@ export default class AuthenticationApi { /** * This API is used to reset password for the specified account by security question - * @param {resetPasswordBySecurityAnswerAndPhoneModel} Model Class containing Definition of payload for ResetPasswordBySecurityAnswerAndPhone API + * @param resetPasswordBySecurityAnswerAndPhoneModel Model Class containing Definition of payload for ResetPasswordBySecurityAnswerAndPhone API * @return Response containing Definition of Validation data and access token *10.3.2 */ resetPasswordBySecurityAnswerAndPhone ( - resetPasswordBySecurityAnswerAndPhoneModel + resetPasswordBySecurityAnswerAndPhoneModel: object ) { if (checkJson(resetPasswordBySecurityAnswerAndPhoneModel)) { return Promise.reject( @@ -770,12 +770,12 @@ export default class AuthenticationApi { /** * This API is used to reset password for the specified account by security question - * @param {resetPasswordBySecurityAnswerAndUserNameModel} Model Class containing Definition of payload for ResetPasswordBySecurityAnswerAndUserName API + * @param resetPasswordBySecurityAnswerAndUserNameModel Model Class containing Definition of payload for ResetPasswordBySecurityAnswerAndUserName API * @return Response containing Definition of Validation data and access token *10.3.3 */ resetPasswordBySecurityAnswerAndUserName ( - resetPasswordBySecurityAnswerAndUserNameModel + resetPasswordBySecurityAnswerAndUserNameModel: object ) { if (checkJson(resetPasswordBySecurityAnswerAndUserNameModel)) { return Promise.reject( @@ -799,11 +799,11 @@ export default class AuthenticationApi { /** * This API is used to set a new password for the specified account. - * @param {resetPasswordByResetTokenModel} Model Class containing Definition of payload for ResetToken API + * @param resetPasswordByResetTokenModel Model Class containing Definition of payload for ResetToken API * @return Response containing Definition of Validation data and access token *10.7.1 */ - resetPasswordByResetToken (resetPasswordByResetTokenModel) { + resetPasswordByResetToken (resetPasswordByResetTokenModel: object) { if (checkJson(resetPasswordByResetTokenModel)) { return Promise.reject( getValidationMessage('resetPasswordByResetTokenModel') @@ -826,11 +826,11 @@ export default class AuthenticationApi { /** * This API is used to set a new password for the specified account. - * @param {resetPasswordByEmailAndOtpModel} Model Class containing Definition of payload for ResetPasswordByEmailAndOtp API + * @param resetPasswordByEmailAndOtpModel Model Class containing Definition of payload for ResetPasswordByEmailAndOtp API * @return Response containing Definition of Validation data and access token *10.7.2 */ - resetPasswordByEmailOTP (resetPasswordByEmailAndOtpModel) { + resetPasswordByEmailOTP (resetPasswordByEmailAndOtpModel: object) { if (checkJson(resetPasswordByEmailAndOtpModel)) { return Promise.reject( getValidationMessage('resetPasswordByEmailAndOtpModel') @@ -853,11 +853,11 @@ export default class AuthenticationApi { /** * This API is used to set a new password for the specified account if you are using the username as the unique identifier in your workflow - * @param {resetPasswordByUserNameModel} Model Class containing Definition of payload for ResetPasswordByUserName API + * @param resetPasswordByUserNameModel Model Class containing Definition of payload for ResetPasswordByUserName API * @return Response containing Definition of Validation data and access token *10.7.3 */ - resetPasswordByOTPAndUserName (resetPasswordByUserNameModel) { + resetPasswordByOTPAndUserName (resetPasswordByUserNameModel: object) { if (checkJson(resetPasswordByUserNameModel)) { return Promise.reject( getValidationMessage('resetPasswordByUserNameModel') @@ -880,13 +880,13 @@ export default class AuthenticationApi { /** * This API is used to change the accounts password based on the previous password - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {newPassword} New password - * @param {oldPassword} User's current password + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param newPassword New password + * @param oldPassword User's current password * @return Response containing Definition of Complete Validation data *10.8 */ - changePassword (accessToken, newPassword, oldPassword) { + changePassword (accessToken: string, newPassword: string, oldPassword: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -918,13 +918,13 @@ export default class AuthenticationApi { /** * This API is used to unlink up a social provider account with the specified account based on the access token and the social providers user access token. The unlinked account will automatically get removed from your database. - * @param {accessToken} Access_Token - * @param {provider} Name of the provider - * @param {providerId} Unique ID of the linked account + * @param accessToken Access_Token + * @param provider Name of the provider + * @param providerId Unique ID of the linked account * @return Response containing Definition of Delete Request *12.2 */ - unlinkSocialIdentities (accessToken, provider, providerId) { + unlinkSocialIdentities (accessToken: string, provider: string, providerId: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -956,12 +956,12 @@ export default class AuthenticationApi { /** * This API is used to link up a social provider account with an existing LoginRadius account on the basis of access token and the social providers user access token. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {candidateToken} Access token of the account to be linked + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param candidateToken Access token of the account to be linked * @return Response containing Definition of Complete Validation data *12.4 */ - linkSocialIdentities (accessToken, candidateToken) { + linkSocialIdentities (accessToken: string, candidateToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -989,12 +989,12 @@ export default class AuthenticationApi { /** * This API is used to link up a social provider account with an existing LoginRadius account on the basis of ping and the social providers user access token. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {clientGuid} Unique ID generated by client + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param clientGuid Unique ID generated by client * @return Response containing Definition of Complete Validation data *12.5 */ - linkSocialIdentitiesByPing (accessToken, clientGuid) { + linkSocialIdentitiesByPing (accessToken: string, clientGuid: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -1022,12 +1022,12 @@ export default class AuthenticationApi { /** * This API is used to set or change UserName by access token. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {username} Username of the user + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param username Username of the user * @return Response containing Definition of Complete Validation data *13.1 */ - setOrChangeUserName (accessToken, username) { + setOrChangeUserName (accessToken: string, username: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -1055,11 +1055,11 @@ export default class AuthenticationApi { /** * This API is used to check the UserName exists or not on your site. - * @param {username} UserName of the user + * @param username UserName of the user * @return Response containing Definition Complete ExistResponse data *13.2 */ - checkUserNameAvailability (username) { + checkUserNameAvailability (username: string) { if (isNullOrWhiteSpace(username)) { return Promise.reject(getValidationMessage('username')); } @@ -1075,12 +1075,12 @@ export default class AuthenticationApi { /** * This API is used to update the privacy policy stored in the user's profile by providing the access token of the user accepting the privacy policy - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing Definition for Complete profile data *15.1 */ - acceptPrivacyPolicy (accessToken, fields) { + acceptPrivacyPolicy (accessToken: string, fields?: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -1099,11 +1099,11 @@ export default class AuthenticationApi { /** * This API will return all the accepted privacy policies for the user by providing the access token of that user. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @return Complete Policy History data *15.2 */ - getPrivacyPolicyHistoryByAccessToken (accessToken) { + getPrivacyPolicyHistoryByAccessToken (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -1119,24 +1119,24 @@ export default class AuthenticationApi { /** * This API creates a user in the database as well as sends a verification email to the user. - * @param {authUserRegistrationModel} Model Class containing Definition of payload for Auth User Registration API - * @param {sott} LoginRadius Secured One Time Token - * @param {emailTemplate} Email template name - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {options} PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) - * @param {verificationUrl} Email verification url - * @param {welcomeEmailTemplate} Name of the welcome email template + * @param authUserRegistrationModel Model Class containing Definition of payload for Auth User Registration API + * @param sott LoginRadius Secured One Time Token + * @param emailTemplate Email template name + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param options PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) + * @param verificationUrl Email verification url + * @param welcomeEmailTemplate Name of the welcome email template * @return Response containing Definition of Complete Validation, UserProfile data and Access Token *17.1.1 */ userRegistrationByEmail ( - authUserRegistrationModel, - sott, - emailTemplate, - fields, - options, - verificationUrl, - welcomeEmailTemplate + authUserRegistrationModel: object, + sott: string, + emailTemplate?: string, + fields?: string, + options?: string, + verificationUrl?: string, + welcomeEmailTemplate?: string ) { if (checkJson(authUserRegistrationModel)) { return Promise.reject(getValidationMessage('authUserRegistrationModel')); @@ -1177,24 +1177,24 @@ export default class AuthenticationApi { /** * This API creates a user in the database as well as sends a verification email to the user. - * @param {authUserRegistrationModelWithCaptcha} Model Class containing Definition of payload for Auth User Registration by Recaptcha API - * @param {emailTemplate} Email template name - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {options} PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) - * @param {smsTemplate} SMS Template name - * @param {verificationUrl} Email verification url - * @param {welcomeEmailTemplate} Name of the welcome email template + * @param authUserRegistrationModelWithCaptcha Model Class containing Definition of payload for Auth User Registration by Recaptcha API + * @param emailTemplate Email template name + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param options PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) + * @param smsTemplate SMS Template name + * @param verificationUrl Email verification url + * @param welcomeEmailTemplate Name of the welcome email template * @return Response containing Definition of Complete Validation, UserProfile data and Access Token *17.2 */ userRegistrationByCaptcha ( - authUserRegistrationModelWithCaptcha, - emailTemplate, - fields, - options, - smsTemplate, - verificationUrl, - welcomeEmailTemplate + authUserRegistrationModelWithCaptcha: object, + emailTemplate?: string, + fields?: string, + options?: string, + smsTemplate?: string, + verificationUrl?: string, + welcomeEmailTemplate?: string ) { if (checkJson(authUserRegistrationModelWithCaptcha)) { return Promise.reject( @@ -1236,13 +1236,13 @@ export default class AuthenticationApi { /** * This API resends the verification email to the user. - * @param {email} user's email - * @param {emailTemplate} Email template name - * @param {verificationUrl} Email verification url + * @param email user's email + * @param emailTemplate Email template name + * @param verificationUrl Email verification url * @return Response containing Definition of Complete Validation data *17.3 */ - authResendEmailVerification (email, emailTemplate, verificationUrl) { + authResendEmailVerification (email: string, emailTemplate?: string, verificationUrl?: string) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); } diff --git a/loginradius-sdk/src/api/authentication/oneTouchLoginApi.ts b/loginradius-sdk/src/api/authentication/oneTouchLoginApi.ts index 61245ca..bfcb33e 100644 --- a/loginradius-sdk/src/api/authentication/oneTouchLoginApi.ts +++ b/loginradius-sdk/src/api/authentication/oneTouchLoginApi.ts @@ -16,18 +16,18 @@ export default class OneTouchLoginApi { /** * This API is used to send a link to a specified email for a frictionless login/registration - * @param {oneTouchLoginByEmailModel} Model Class containing Definition of payload for OneTouchLogin By EmailModel API - * @param {oneTouchLoginEmailTemplate} Name of the One Touch Login Email Template - * @param {redirecturl} Url where the user will redirect after success authentication - * @param {welcomeemailtemplate} Name of the welcome email template + * @param oneTouchLoginByEmailModel Model Class containing Definition of payload for OneTouchLogin By EmailModel API + * @param oneTouchLoginEmailTemplate Name of the One Touch Login Email Template + * @param redirecturl Url where the user will redirect after success authentication + * @param welcomeemailtemplate Name of the welcome email template * @return Response containing Definition of Complete Validation data *1.2 */ oneTouchLoginByEmail ( - oneTouchLoginByEmailModel, - oneTouchLoginEmailTemplate, - redirecturl, - welcomeemailtemplate + oneTouchLoginByEmailModel: object, + oneTouchLoginEmailTemplate?: string, + redirecturl?: string, + welcomeemailtemplate?: string ) { if (checkJson(oneTouchLoginByEmailModel)) { return Promise.reject(getValidationMessage('oneTouchLoginByEmailModel')); @@ -58,12 +58,12 @@ export default class OneTouchLoginApi { /** * This API is used to send one time password to a given phone number for a frictionless login/registration. - * @param {oneTouchLoginByPhoneModel} Model Class containing Definition of payload for OneTouchLogin By PhoneModel API - * @param {smsTemplate} SMS Template name + * @param oneTouchLoginByPhoneModel Model Class containing Definition of payload for OneTouchLogin By PhoneModel API + * @param smsTemplate SMS Template name * @return Response containing Definition of Complete Validation data *1.4 */ - oneTouchLoginByPhone (oneTouchLoginByPhoneModel, smsTemplate) { + oneTouchLoginByPhone (oneTouchLoginByPhoneModel: object, smsTemplate?: string) { if (checkJson(oneTouchLoginByPhoneModel)) { return Promise.reject(getValidationMessage('oneTouchLoginByPhoneModel')); } @@ -87,14 +87,14 @@ export default class OneTouchLoginApi { /** * This API is used to verify the otp for One Touch Login. - * @param {otp} The Verification Code - * @param {phone} New Phone Number - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {smsTemplate} SMS Template name + * @param otp The Verification Code + * @param phone New Phone Number + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param smsTemplate SMS Template name * @return Response Containing Access Token and Complete Profile Data *1.5 */ - oneTouchLoginOTPVerification (otp, phone, fields, smsTemplate) { + oneTouchLoginOTPVerification (otp: string, phone: string, fields?: string, smsTemplate?: string) { if (isNullOrWhiteSpace(otp)) { return Promise.reject(getValidationMessage('otp')); } @@ -128,12 +128,12 @@ export default class OneTouchLoginApi { /** * This API verifies the provided token for One Touch Login - * @param {verificationToken} Verification token received in the email - * @param {welcomeEmailTemplate} Name of the welcome email template + * @param verificationToken Verification token received in the email + * @param welcomeEmailTemplate Name of the welcome email template * @return Complete verified response data *8.4.2 */ - oneTouchEmailVerification (verificationToken, welcomeEmailTemplate) { + oneTouchEmailVerification (verificationToken: string, welcomeEmailTemplate?: string) { if (isNullOrWhiteSpace(verificationToken)) { return Promise.reject(getValidationMessage('verificationToken')); } @@ -152,12 +152,12 @@ export default class OneTouchLoginApi { /** * This API is used to check if the One Touch Login link has been clicked or not. - * @param {clientGuid} Unique string used in the Smart Login request - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param clientGuid Unique string used in the Smart Login request + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing User Profile Data and access token *9.21.2 */ - oneTouchLoginPing (clientGuid, fields) { + oneTouchLoginPing (clientGuid: string, fields?: string) { if (isNullOrWhiteSpace(clientGuid)) { return Promise.reject(getValidationMessage('clientGuid')); } diff --git a/loginradius-sdk/src/api/authentication/passwordLessLoginApi.ts b/loginradius-sdk/src/api/authentication/passwordLessLoginApi.ts index 93c285b..42c19ba 100644 --- a/loginradius-sdk/src/api/authentication/passwordLessLoginApi.ts +++ b/loginradius-sdk/src/api/authentication/passwordLessLoginApi.ts @@ -16,16 +16,16 @@ export default class PasswordlessLoginApi { /** * This API verifies an account by OTP and allows the customer to login. - * @param {passwordLessLoginOtpModel} Model Class containing Definition of payload for PasswordLessLoginOtpModel API - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {smsTemplate} SMS Template name + * @param passwordLessLoginOtpModel Model Class containing Definition of payload for PasswordLessLoginOtpModel API + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param smsTemplate SMS Template name * @return Response containing User Profile Data and access token *9.6 */ passwordlessLoginPhoneVerification ( - passwordLessLoginOtpModel, - fields, - smsTemplate + passwordLessLoginOtpModel: object, + fields?: string, + smsTemplate?: string ) { if (checkJson(passwordLessLoginOtpModel)) { return Promise.reject(getValidationMessage('passwordLessLoginOtpModel')); @@ -53,12 +53,12 @@ export default class PasswordlessLoginApi { /** * API can be used to send a One-time Passcode (OTP) provided that the account has a verified PhoneID - * @param {phone} The Registered Phone Number - * @param {smsTemplate} SMS Template name + * @param phone The Registered Phone Number + * @param smsTemplate SMS Template name * @return Response Containing Definition of SMS Data *9.15 */ - passwordlessLoginByPhone (phone, smsTemplate) { + passwordlessLoginByPhone (phone: string, smsTemplate?: string) { if (isNullOrWhiteSpace(phone)) { return Promise.reject(getValidationMessage('phone')); } @@ -77,13 +77,13 @@ export default class PasswordlessLoginApi { /** * This API is used to send a Passwordless Login verification link to the provided Email ID - * @param {email} Email of the user - * @param {passwordLessLoginTemplate} Passwordless Login Template Name - * @param {verificationUrl} Email verification url + * @param email Email of the user + * @param passwordLessLoginTemplate Passwordless Login Template Name + * @param verificationUrl Email verification url * @return Response containing Definition of Complete Validation data *9.18.1 */ - passwordlessLoginByEmail (email, passwordLessLoginTemplate, verificationUrl) { + passwordlessLoginByEmail (email: string, passwordLessLoginTemplate?: string, verificationUrl?: string) { if (isNullOrWhiteSpace(email)) { return Promise.reject(getValidationMessage('email')); } @@ -105,16 +105,16 @@ export default class PasswordlessLoginApi { /** * This API is used to send a Passwordless Login Verification Link to a customer by providing their UserName - * @param {username} UserName of the user - * @param {passwordLessLoginTemplate} Passwordless Login Template Name - * @param {verificationUrl} Email verification url + * @param username UserName of the user + * @param passwordLessLoginTemplate Passwordless Login Template Name + * @param verificationUrl Email verification url * @return Response containing Definition of Complete Validation data *9.18.2 */ passwordlessLoginByUserName ( - username, - passwordLessLoginTemplate, - verificationUrl + username: string, + passwordLessLoginTemplate: string, + verificationUrl: string ) { if (isNullOrWhiteSpace(username)) { return Promise.reject(getValidationMessage('username')); @@ -137,16 +137,16 @@ export default class PasswordlessLoginApi { /** * This API is used to verify the Passwordless Login verification link. Note: If you are using Passwordless Login by Phone you will need to use the Passwordless Login Phone Verification API - * @param {verificationToken} Verification token received in the email - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {welcomeEmailTemplate} Name of the welcome email template + * @param verificationToken Verification token received in the email + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param welcomeEmailTemplate Name of the welcome email template * @return Response containing User Profile Data and access token *9.19 */ passwordlessLoginVerification ( - verificationToken, - fields, - welcomeEmailTemplate + verificationToken: string, + fields?: string, + welcomeEmailTemplate?: string ) { if (isNullOrWhiteSpace(verificationToken)) { return Promise.reject(getValidationMessage('verificationToken')); @@ -169,14 +169,14 @@ export default class PasswordlessLoginApi { /** * This API is used to verify the otp sent to the email when doing a passwordless login. - * @param {passwordLessLoginByEmailAndOtpModel} payload - * @param {fields} Fields + * @param passwordLessLoginByEmailAndOtpModel payload + * @param fields Fields * @return Response containing User Profile Data and access token *9.23 */ passwordlessLoginVerificationByEmailAndOTP ( - passwordLessLoginByEmailAndOtpModel, - fields + passwordLessLoginByEmailAndOtpModel: object, + fields?: string ) { if (checkJson(passwordLessLoginByEmailAndOtpModel)) { return Promise.reject( @@ -204,14 +204,14 @@ export default class PasswordlessLoginApi { /** * This API is used to verify the otp sent to the email when doing a passwordless login. - * @param {passwordLessLoginByUserNameAndOtpModel} payload - * @param {fields} Fields + * @param passwordLessLoginByUserNameAndOtpModel payload + * @param fields Fields * @return Response containing User Profile Data and access token *9.24 */ passwordlessLoginVerificationByUserNameAndOTP ( - passwordLessLoginByUserNameAndOtpModel, - fields + passwordLessLoginByUserNameAndOtpModel: object, + fields: string ) { if (checkJson(passwordLessLoginByUserNameAndOtpModel)) { return Promise.reject( diff --git a/loginradius-sdk/src/api/authentication/phoneAuthenticationApi.ts b/loginradius-sdk/src/api/authentication/phoneAuthenticationApi.ts index 7fbfc72..ef393f3 100644 --- a/loginradius-sdk/src/api/authentication/phoneAuthenticationApi.ts +++ b/loginradius-sdk/src/api/authentication/phoneAuthenticationApi.ts @@ -16,14 +16,14 @@ export default class PhoneAuthenticationApi { /** * This API retrieves a copy of the user data based on the Phone - * @param {phoneAuthenticationModel} Model Class containing Definition of payload for PhoneAuthenticationModel API - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {loginUrl} Url where the user is logging from - * @param {smsTemplate} SMS Template name + * @param phoneAuthenticationModel Model Class containing Definition of payload for PhoneAuthenticationModel API + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param loginUrl Url where the user is logging from + * @param smsTemplate SMS Template name * @return Response containing User Profile Data and access token *9.2.3 */ - loginByPhone (phoneAuthenticationModel, fields, loginUrl, smsTemplate) { + loginByPhone (phoneAuthenticationModel: object, fields?: string, loginUrl?: string, smsTemplate?: string) { if (checkJson(phoneAuthenticationModel)) { return Promise.reject(getValidationMessage('phoneAuthenticationModel')); } @@ -53,12 +53,12 @@ export default class PhoneAuthenticationApi { /** * This API is used to send the OTP to reset the account password. - * @param {phone} New Phone Number - * @param {smsTemplate} SMS Template name + * @param phone New Phone Number + * @param smsTemplate SMS Template name * @return Response Containing Validation Data and SMS Data *10.4 */ - forgotPasswordByPhoneOTP (phone, smsTemplate) { + forgotPasswordByPhoneOTP (phone: string, smsTemplate?: string) { if (isNullOrWhiteSpace(phone)) { return Promise.reject(getValidationMessage('phone')); } @@ -85,11 +85,11 @@ export default class PhoneAuthenticationApi { /** * This API is used to reset the password - * @param {resetPasswordByOTPModel} Model Class containing Definition of payload for ResetPasswordByOTP API + * @param resetPasswordByOTPModel Model Class containing Definition of payload for ResetPasswordByOTP API * @return Response containing Definition of Complete Validation data *10.5 */ - resetPasswordByPhoneOTP (resetPasswordByOTPModel) { + resetPasswordByPhoneOTP (resetPasswordByOTPModel: object) { if (checkJson(resetPasswordByOTPModel)) { return Promise.reject(getValidationMessage('resetPasswordByOTPModel')); } @@ -110,14 +110,14 @@ export default class PhoneAuthenticationApi { /** * This API is used to validate the verification code sent to verify a user's phone number - * @param {otp} The Verification Code - * @param {phone} New Phone Number - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {smsTemplate} SMS Template name + * @param otp The Verification Code + * @param phone New Phone Number + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param smsTemplate SMS Template name * @return Response containing User Profile Data and access token *11.1.1 */ - phoneVerificationByOTP (otp, phone, fields, smsTemplate) { + phoneVerificationByOTP (otp: string, phone: string, fields?: string, smsTemplate?: string) { if (isNullOrWhiteSpace(otp)) { return Promise.reject(getValidationMessage('otp')); } @@ -151,13 +151,13 @@ export default class PhoneAuthenticationApi { /** * This API is used to consume the verification code sent to verify a user's phone number. Use this call for front-end purposes in cases where the user is already logged in by passing the user's access token. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {otp} The Verification Code - * @param {smsTemplate} SMS Template name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param otp The Verification Code + * @param smsTemplate SMS Template name * @return Response containing Definition of Complete Validation data *11.1.2 */ - phoneVerificationOTPByAccessToken (accessToken, otp, smsTemplate) { + phoneVerificationOTPByAccessToken (accessToken: string, otp: string, smsTemplate?: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -180,12 +180,12 @@ export default class PhoneAuthenticationApi { /** * This API is used to resend a verification OTP to verify a user's Phone Number. The user will receive a verification code that they will need to input - * @param {phone} New Phone Number - * @param {smsTemplate} SMS Template name + * @param phone New Phone Number + * @param smsTemplate SMS Template name * @return Response Containing Validation Data and SMS Data *11.2.1 */ - phoneResendVerificationOTP (phone, smsTemplate) { + phoneResendVerificationOTP (phone: string, smsTemplate?: string) { if (isNullOrWhiteSpace(phone)) { return Promise.reject(getValidationMessage('phone')); } @@ -212,13 +212,13 @@ export default class PhoneAuthenticationApi { /** * This API is used to resend a verification OTP to verify a user's Phone Number in cases in which an active token already exists - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {phone} New Phone Number - * @param {smsTemplate} SMS Template name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param phone New Phone Number + * @param smsTemplate SMS Template name * @return Response Containing Validation Data and SMS Data *11.2.2 */ - phoneResendVerificationOTPByToken (accessToken, phone, smsTemplate) { + phoneResendVerificationOTPByToken (accessToken: string, phone: string, smsTemplate?: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -249,13 +249,13 @@ export default class PhoneAuthenticationApi { /** * This API is used to update the login Phone Number of users - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {phone} New Phone Number - * @param {smsTemplate} SMS Template name + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param phone New Phone Number + * @param smsTemplate SMS Template name * @return Response Containing Validation Data and SMS Data *11.5 */ - updatePhoneNumber (accessToken, phone, smsTemplate) { + updatePhoneNumber (accessToken: string, phone: string, smsTemplate?: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -286,11 +286,11 @@ export default class PhoneAuthenticationApi { /** * This API is used to check the Phone Number exists or not on your site. - * @param {phone} The Registered Phone Number + * @param phone The Registered Phone Number * @return Response containing Definition Complete ExistResponse data *11.6 */ - checkPhoneNumberAvailability (phone) { + checkPhoneNumberAvailability (phone: string) { if (isNullOrWhiteSpace(phone)) { return Promise.reject(getValidationMessage('phone')); } @@ -306,11 +306,11 @@ export default class PhoneAuthenticationApi { /** * This API is used to delete the Phone ID on a user's account via the access token - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @return Response containing Definition of Delete Request *11.7 */ - removePhoneIDByAccessToken (accessToken) { + removePhoneIDByAccessToken (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -326,26 +326,26 @@ export default class PhoneAuthenticationApi { /** * This API registers the new users into your Cloud Storage and triggers the phone verification process. - * @param {authUserRegistrationModel} Model Class containing Definition of payload for Auth User Registration API - * @param {sott} LoginRadius Secured One Time Token - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {options} PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) - * @param {smsTemplate} SMS Template name - * @param {verificationUrl} Email verification url - * @param {welcomeEmailTemplate} Name of the welcome email template + * @param authUserRegistrationModel Model Class containing Definition of payload for Auth User Registration API + * @param sott LoginRadius Secured One Time Token + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param options PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) + * @param smsTemplate SMS Template name + * @param verificationUrl Email verification url + * @param welcomeEmailTemplate Name of the welcome email template * @return Response containing Definition of Complete Validation, UserProfile data and Access Token - * @param {emailTemplate} Email Template Name + * @param emailTemplate Email Template Name *17.1.2 */ userRegistrationByPhone ( - authUserRegistrationModel, - sott, - fields, - options, - smsTemplate, - verificationUrl, - welcomeEmailTemplate, - emailTemplate + authUserRegistrationModel: object, + sott: string, + fields?: string, + options?: string, + smsTemplate?: string, + verificationUrl?: string, + welcomeEmailTemplate?: string, + emailTemplate?: string ) { if (checkJson(authUserRegistrationModel)) { return Promise.reject(getValidationMessage('authUserRegistrationModel')); diff --git a/loginradius-sdk/src/api/authentication/pinAuthenticationApi.ts b/loginradius-sdk/src/api/authentication/pinAuthenticationApi.ts index 02ea42b..9c8aafc 100644 --- a/loginradius-sdk/src/api/authentication/pinAuthenticationApi.ts +++ b/loginradius-sdk/src/api/authentication/pinAuthenticationApi.ts @@ -16,12 +16,12 @@ export default class PinAuthenticationApi { /** * This API is used to login a user by pin and session token. - * @param {loginByPINModel} Model Class containing Definition of payload for LoginByPin API - * @param {sessionToken} Session Token of user + * @param loginByPINModel Model Class containing Definition of payload for LoginByPin API + * @param sessionToken Session Token of user * @return Response containing User Profile Data and access token *9.22 */ - pinLogin (loginByPINModel, sessionToken) { + pinLogin (loginByPINModel: object, sessionToken: string) { if (checkJson(loginByPINModel)) { return Promise.reject(getValidationMessage('loginByPINModel')); } @@ -46,16 +46,16 @@ export default class PinAuthenticationApi { /** * This API sends the reset pin email to specified email address. - * @param {forgotPINLinkByEmailModel} Model Class containing Definition for Forgot Pin Link By Email API - * @param {emailTemplate} Email template name - * @param {resetPINUrl} Reset PIN Url + * @param forgotPINLinkByEmailModel Model Class containing Definition for Forgot Pin Link By Email API + * @param emailTemplate Email template name + * @param resetPINUrl Reset PIN Url * @return Response containing Definition of Complete Validation data *42.1 */ sendForgotPINEmailByEmail ( - forgotPINLinkByEmailModel, - emailTemplate, - resetPINUrl + forgotPINLinkByEmailModel: object, + emailTemplate?: string, + resetPINUrl?: string ) { if (checkJson(forgotPINLinkByEmailModel)) { return Promise.reject(getValidationMessage('forgotPINLinkByEmailModel')); @@ -83,16 +83,16 @@ export default class PinAuthenticationApi { /** * This API sends the reset pin email using username. - * @param {forgotPINLinkByUserNameModel} Model Class containing Definition for Forgot Pin Link By UserName API - * @param {emailTemplate} Email template name - * @param {resetPINUrl} Reset PIN Url + * @param forgotPINLinkByUserNameModel Model Class containing Definition for Forgot Pin Link By UserName API + * @param emailTemplate Email template name + * @param resetPINUrl Reset PIN Url * @return Response containing Definition of Complete Validation data *42.2 */ sendForgotPINEmailByUsername ( - forgotPINLinkByUserNameModel, - emailTemplate, - resetPINUrl + forgotPINLinkByUserNameModel: object, + emailTemplate?: string, + resetPINUrl?: string ) { if (checkJson(forgotPINLinkByUserNameModel)) { return Promise.reject( @@ -122,11 +122,11 @@ export default class PinAuthenticationApi { /** * This API is used to reset pin using reset token. - * @param {resetPINByResetToken} Model Class containing Definition of payload for Reset Pin By Reset Token API + * @param resetPINByResetToken Model Class containing Definition of payload for Reset Pin By Reset Token API * @return Response containing Definition of Complete Validation data *42.3 */ - resetPINByResetToken (resetPINByResetToken) { + resetPINByResetToken (resetPINByResetToken: object) { if (checkJson(resetPINByResetToken)) { return Promise.reject(getValidationMessage('resetPINByResetToken')); } @@ -147,12 +147,12 @@ export default class PinAuthenticationApi { /** * This API is used to reset pin using security question answer and email. - * @param {resetPINBySecurityQuestionAnswerAndEmailModel} Model Class containing Definition of payload for Reset Pin By Security Question and Email API + * @param resetPINBySecurityQuestionAnswerAndEmailModel Model Class containing Definition of payload for Reset Pin By Security Question and Email API * @return Response containing Definition of Complete Validation data *42.4 */ resetPINByEmailAndSecurityAnswer ( - resetPINBySecurityQuestionAnswerAndEmailModel + resetPINBySecurityQuestionAnswerAndEmailModel: object ) { if (checkJson(resetPINBySecurityQuestionAnswerAndEmailModel)) { return Promise.reject( @@ -176,12 +176,12 @@ export default class PinAuthenticationApi { /** * This API is used to reset pin using security question answer and username. - * @param {resetPINBySecurityQuestionAnswerAndUsernameModel} Model Class containing Definition of payload for Reset Pin By Security Question and UserName API + * @param resetPINBySecurityQuestionAnswerAndUsernameModel Model Class containing Definition of payload for Reset Pin By Security Question and UserName API * @return Response containing Definition of Complete Validation data *42.5 */ resetPINByUsernameAndSecurityAnswer ( - resetPINBySecurityQuestionAnswerAndUsernameModel + resetPINBySecurityQuestionAnswerAndUsernameModel: object ) { if (checkJson(resetPINBySecurityQuestionAnswerAndUsernameModel)) { return Promise.reject( @@ -205,12 +205,12 @@ export default class PinAuthenticationApi { /** * This API is used to reset pin using security question answer and phone. - * @param {resetPINBySecurityQuestionAnswerAndPhoneModel} Model Class containing Definition of payload for Reset Pin By Security Question and Phone API + * @param resetPINBySecurityQuestionAnswerAndPhoneModel Model Class containing Definition of payload for Reset Pin By Security Question and Phone API * @return Response containing Definition of Complete Validation data *42.6 */ resetPINByPhoneAndSecurityAnswer ( - resetPINBySecurityQuestionAnswerAndPhoneModel + resetPINBySecurityQuestionAnswerAndPhoneModel: object ) { if (checkJson(resetPINBySecurityQuestionAnswerAndPhoneModel)) { return Promise.reject( @@ -234,12 +234,12 @@ export default class PinAuthenticationApi { /** * This API sends the OTP to specified phone number - * @param {forgotPINOtpByPhoneModel} Model Class containing Definition for Forgot Pin Otp By Phone API - * @param {smsTemplate} + * @param forgotPINOtpByPhoneModel Model Class containing Definition for Forgot Pin Otp By Phone API + * @param smsTemplate * @return Response Containing Validation Data and SMS Data *42.7 */ - sendForgotPINSMSByPhone (forgotPINOtpByPhoneModel, smsTemplate) { + sendForgotPINSMSByPhone (forgotPINOtpByPhoneModel: object, smsTemplate?: string) { if (checkJson(forgotPINOtpByPhoneModel)) { return Promise.reject(getValidationMessage('forgotPINOtpByPhoneModel')); } @@ -263,12 +263,12 @@ export default class PinAuthenticationApi { /** * This API is used to change a user's PIN using access token. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {changePINModel} Model Class containing Definition for change PIN Property + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param changePINModel Model Class containing Definition for change PIN Property * @return Response containing Definition of Complete Validation data *42.8 */ - changePINByAccessToken (accessToken, changePINModel) { + changePINByAccessToken (accessToken: string, changePINModel: object) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -293,11 +293,11 @@ export default class PinAuthenticationApi { /** * This API is used to reset pin using phoneId and OTP. - * @param {resetPINByPhoneAndOTPModel} Model Class containing Definition of payload for Reset Pin By Phone and Otp API + * @param resetPINByPhoneAndOTPModel Model Class containing Definition of payload for Reset Pin By Phone and Otp API * @return Response containing Definition of Complete Validation data *42.9 */ - resetPINByPhoneAndOtp (resetPINByPhoneAndOTPModel) { + resetPINByPhoneAndOtp (resetPINByPhoneAndOTPModel: object) { if (checkJson(resetPINByPhoneAndOTPModel)) { return Promise.reject(getValidationMessage('resetPINByPhoneAndOTPModel')); } @@ -318,11 +318,11 @@ export default class PinAuthenticationApi { /** * This API is used to reset pin using email and OTP. - * @param {resetPINByEmailAndOtpModel} Model Class containing Definition of payload for Reset Pin By Email and Otp API + * @param resetPINByEmailAndOtpModel Model Class containing Definition of payload for Reset Pin By Email and Otp API * @return Response containing Definition of Complete Validation data *42.10 */ - resetPINByEmailAndOtp (resetPINByEmailAndOtpModel) { + resetPINByEmailAndOtp (resetPINByEmailAndOtpModel: object) { if (checkJson(resetPINByEmailAndOtpModel)) { return Promise.reject(getValidationMessage('resetPINByEmailAndOtpModel')); } @@ -343,11 +343,11 @@ export default class PinAuthenticationApi { /** * This API is used to reset pin using username and OTP. - * @param {resetPINByUsernameAndOtpModel} Model Class containing Definition of payload for Reset Pin By Username and Otp API + * @param resetPINByUsernameAndOtpModel Model Class containing Definition of payload for Reset Pin By Username and Otp API * @return Response containing Definition of Complete Validation data *42.11 */ - resetPINByUsernameAndOtp (resetPINByUsernameAndOtpModel) { + resetPINByUsernameAndOtp (resetPINByUsernameAndOtpModel: object) { if (checkJson(resetPINByUsernameAndOtpModel)) { return Promise.reject( getValidationMessage('resetPINByUsernameAndOtpModel') @@ -370,12 +370,12 @@ export default class PinAuthenticationApi { /** * This API is used to change a user's PIN using Pin Auth token. - * @param {pINRequiredModel} Model Class containing Definition for PIN - * @param {pinAuthToken} Pin Auth Token + * @param pINRequiredModel Model Class containing Definition for PIN + * @param pinAuthToken Pin Auth Token * @return Response containing User Profile Data and access token *42.12 */ - setPINByPinAuthToken (pINRequiredModel, pinAuthToken) { + setPINByPinAuthToken (pINRequiredModel: object, pinAuthToken: string) { if (checkJson(pINRequiredModel)) { return Promise.reject(getValidationMessage('pINRequiredModel')); } @@ -400,11 +400,11 @@ export default class PinAuthenticationApi { /** * This API is used to invalidate pin session token. - * @param {sessionToken} Session Token of user + * @param sessionToken Session Token of user * @return Response containing Definition of Complete Validation data *44.1 */ - inValidatePinSessionToken (sessionToken) { + inValidatePinSessionToken (sessionToken: string) { if (isNullOrWhiteSpace(sessionToken)) { return Promise.reject(getValidationMessage('sessionToken')); } diff --git a/loginradius-sdk/src/api/authentication/riskBasedAuthenticationApi.ts b/loginradius-sdk/src/api/authentication/riskBasedAuthenticationApi.ts index b02455d..301d217 100644 --- a/loginradius-sdk/src/api/authentication/riskBasedAuthenticationApi.ts +++ b/loginradius-sdk/src/api/authentication/riskBasedAuthenticationApi.ts @@ -16,46 +16,46 @@ export default class RiskBasedAuthenticationApi { /** * This API retrieves a copy of the user data based on the Email - * @param {emailAuthenticationModel} Model Class containing Definition of payload for Email Authentication API - * @param {emailTemplate} Email template name - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {loginUrl} Url where the user is logging from - * @param {passwordDelegation} Password Delegation Allows you to use a third-party service to store your passwords rather than LoginRadius Cloud storage. - * @param {passwordDelegationApp} RiskBased Authentication Password Delegation App - * @param {rbaBrowserEmailTemplate} Risk Based Authentication Browser EmailTemplate - * @param {rbaBrowserSmsTemplate} Risk Based Authentication Browser Sms Template - * @param {rbaCityEmailTemplate} Risk Based Authentication City Email Template - * @param {rbaCitySmsTemplate} Risk Based Authentication City SmsTemplate - * @param {rbaCountryEmailTemplate} Risk Based Authentication Country EmailTemplate - * @param {rbaCountrySmsTemplate} Risk Based Authentication Country SmsTemplate - * @param {rbaIpEmailTemplate} Risk Based Authentication Ip EmailTemplate - * @param {rbaIpSmsTemplate} Risk Based Authentication Ip SmsTemplate - * @param {rbaOneclickEmailTemplate} Risk Based Authentication Oneclick EmailTemplate - * @param {rbaOTPSmsTemplate} Risk Based Authentication Oneclick EmailTemplate - * @param {smsTemplate} SMS Template name - * @param {verificationUrl} Email verification url + * @param emailAuthenticationModel Model Class containing Definition of payload for Email Authentication API + * @param emailTemplate Email template name + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param loginUrl Url where the user is logging from + * @param passwordDelegation Password Delegation Allows you to use a third-party service to store your passwords rather than LoginRadius Cloud storage. + * @param passwordDelegationApp RiskBased Authentication Password Delegation App + * @param rbaBrowserEmailTemplate Risk Based Authentication Browser EmailTemplate + * @param rbaBrowserSmsTemplate Risk Based Authentication Browser Sms Template + * @param rbaCityEmailTemplate Risk Based Authentication City Email Template + * @param rbaCitySmsTemplate Risk Based Authentication City SmsTemplate + * @param rbaCountryEmailTemplate Risk Based Authentication Country EmailTemplate + * @param rbaCountrySmsTemplate Risk Based Authentication Country SmsTemplate + * @param rbaIpEmailTemplate Risk Based Authentication Ip EmailTemplate + * @param rbaIpSmsTemplate Risk Based Authentication Ip SmsTemplate + * @param rbaOneclickEmailTemplate Risk Based Authentication Oneclick EmailTemplate + * @param rbaOTPSmsTemplate Risk Based Authentication Oneclick EmailTemplate + * @param smsTemplate SMS Template name + * @param verificationUrl Email verification url * @return Response containing User Profile Data and access token *9.2.4 */ rbaLoginByEmail ( - emailAuthenticationModel, - emailTemplate, - fields, - loginUrl, - passwordDelegation, - passwordDelegationApp, - rbaBrowserEmailTemplate, - rbaBrowserSmsTemplate, - rbaCityEmailTemplate, - rbaCitySmsTemplate, - rbaCountryEmailTemplate, - rbaCountrySmsTemplate, - rbaIpEmailTemplate, - rbaIpSmsTemplate, - rbaOneclickEmailTemplate, - rbaOTPSmsTemplate, - smsTemplate, - verificationUrl + emailAuthenticationModel: object, + emailTemplate?: string, + fields?: string, + loginUrl?: string, + passwordDelegation?: string, + passwordDelegationApp?: string, + rbaBrowserEmailTemplate?: string, + rbaBrowserSmsTemplate?: string, + rbaCityEmailTemplate?: string, + rbaCitySmsTemplate?: string, + rbaCountryEmailTemplate?: string, + rbaCountrySmsTemplate?: string, + rbaIpEmailTemplate?: string, + rbaIpSmsTemplate?: string, + rbaOneclickEmailTemplate?: string, + rbaOTPSmsTemplate?: string, + smsTemplate?: string, + verificationUrl?: string ) { if (checkJson(emailAuthenticationModel)) { return Promise.reject(getValidationMessage('emailAuthenticationModel')); @@ -128,46 +128,46 @@ export default class RiskBasedAuthenticationApi { /** * This API retrieves a copy of the user data based on the Username - * @param {userNameAuthenticationModel} Model Class containing Definition of payload for Username Authentication API - * @param {emailTemplate} Email template name - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {loginUrl} Url where the user is logging from - * @param {passwordDelegation} Password Delegation Allows you to use a third-party service to store your passwords rather than LoginRadius Cloud storage. - * @param {passwordDelegationApp} RiskBased Authentication Password Delegation App - * @param {rbaBrowserEmailTemplate} Risk Based Authentication Browser EmailTemplate - * @param {rbaBrowserSmsTemplate} Risk Based Authentication Browser Sms Template - * @param {rbaCityEmailTemplate} Risk Based Authentication City Email Template - * @param {rbaCitySmsTemplate} Risk Based Authentication City SmsTemplate - * @param {rbaCountryEmailTemplate} Risk Based Authentication Country EmailTemplate - * @param {rbaCountrySmsTemplate} Risk Based Authentication Country SmsTemplate - * @param {rbaIpEmailTemplate} Risk Based Authentication Ip EmailTemplate - * @param {rbaIpSmsTemplate} Risk Based Authentication Ip SmsTemplate - * @param {rbaOneclickEmailTemplate} Risk Based Authentication Oneclick EmailTemplate - * @param {rbaOTPSmsTemplate} Risk Based Authentication OTPSmsTemplate - * @param {smsTemplate} SMS Template name - * @param {verificationUrl} Email verification url + * @param userNameAuthenticationModel Model Class containing Definition of payload for Username Authentication API + * @param emailTemplate Email template name + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param loginUrl Url where the user is logging from + * @param passwordDelegation Password Delegation Allows you to use a third-party service to store your passwords rather than LoginRadius Cloud storage. + * @param passwordDelegationApp RiskBased Authentication Password Delegation App + * @param rbaBrowserEmailTemplate Risk Based Authentication Browser EmailTemplate + * @param rbaBrowserSmsTemplate Risk Based Authentication Browser Sms Template + * @param rbaCityEmailTemplate Risk Based Authentication City Email Template + * @param rbaCitySmsTemplate Risk Based Authentication City SmsTemplate + * @param rbaCountryEmailTemplate Risk Based Authentication Country EmailTemplate + * @param rbaCountrySmsTemplate Risk Based Authentication Country SmsTemplate + * @param rbaIpEmailTemplate Risk Based Authentication Ip EmailTemplate + * @param rbaIpSmsTemplate Risk Based Authentication Ip SmsTemplate + * @param rbaOneclickEmailTemplate Risk Based Authentication Oneclick EmailTemplate + * @param rbaOTPSmsTemplate Risk Based Authentication OTPSmsTemplate + * @param smsTemplate SMS Template name + * @param verificationUrl Email verification url * @return Response containing User Profile Data and access token *9.2.5 */ rbaLoginByUserName ( - userNameAuthenticationModel, - emailTemplate, - fields, - loginUrl, - passwordDelegation, - passwordDelegationApp, - rbaBrowserEmailTemplate, - rbaBrowserSmsTemplate, - rbaCityEmailTemplate, - rbaCitySmsTemplate, - rbaCountryEmailTemplate, - rbaCountrySmsTemplate, - rbaIpEmailTemplate, - rbaIpSmsTemplate, - rbaOneclickEmailTemplate, - rbaOTPSmsTemplate, - smsTemplate, - verificationUrl + userNameAuthenticationModel: object, + emailTemplate?: string, + fields?: string, + loginUrl?: string, + passwordDelegation?: string, + passwordDelegationApp?: string, + rbaBrowserEmailTemplate?: string, + rbaBrowserSmsTemplate?: string, + rbaCityEmailTemplate?: string, + rbaCitySmsTemplate?: string, + rbaCountryEmailTemplate?: string, + rbaCountrySmsTemplate?: string, + rbaIpEmailTemplate?: string, + rbaIpSmsTemplate?: string, + rbaOneclickEmailTemplate?: string, + rbaOTPSmsTemplate?: string, + smsTemplate?: string, + verificationUrl?: string ) { if (checkJson(userNameAuthenticationModel)) { return Promise.reject( @@ -242,46 +242,46 @@ export default class RiskBasedAuthenticationApi { /** * This API retrieves a copy of the user data based on the Phone - * @param {phoneAuthenticationModel} Model Class containing Definition of payload for PhoneAuthenticationModel API - * @param {emailTemplate} Email template name - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields - * @param {loginUrl} Url where the user is logging from - * @param {passwordDelegation} Password Delegation Allows you to use a third-party service to store your passwords rather than LoginRadius Cloud storage. - * @param {passwordDelegationApp} RiskBased Authentication Password Delegation App - * @param {rbaBrowserEmailTemplate} Risk Based Authentication Browser EmailTemplate - * @param {rbaBrowserSmsTemplate} Risk Based Authentication Browser Sms Template - * @param {rbaCityEmailTemplate} Risk Based Authentication City Email Template - * @param {rbaCitySmsTemplate} Risk Based Authentication City SmsTemplate - * @param {rbaCountryEmailTemplate} Risk Based Authentication Country EmailTemplate - * @param {rbaCountrySmsTemplate} Risk Based Authentication Country SmsTemplate - * @param {rbaIpEmailTemplate} Risk Based Authentication Ip EmailTemplate - * @param {rbaIpSmsTemplate} Risk Based Authentication Ip SmsTemplate - * @param {rbaOneclickEmailTemplate} Risk Based Authentication Oneclick EmailTemplate - * @param {rbaOTPSmsTemplate} Risk Based Authentication OTPSmsTemplate - * @param {smsTemplate} SMS Template name - * @param {verificationUrl} Email verification url + * @param phoneAuthenticationModel Model Class containing Definition of payload for PhoneAuthenticationModel API + * @param emailTemplate Email template name + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @param loginUrl Url where the user is logging from + * @param passwordDelegation Password Delegation Allows you to use a third-party service to store your passwords rather than LoginRadius Cloud storage. + * @param passwordDelegationApp RiskBased Authentication Password Delegation App + * @param rbaBrowserEmailTemplate Risk Based Authentication Browser EmailTemplate + * @param rbaBrowserSmsTemplate Risk Based Authentication Browser Sms Template + * @param rbaCityEmailTemplate Risk Based Authentication City Email Template + * @param rbaCitySmsTemplate Risk Based Authentication City SmsTemplate + * @param rbaCountryEmailTemplate Risk Based Authentication Country EmailTemplate + * @param rbaCountrySmsTemplate Risk Based Authentication Country SmsTemplate + * @param rbaIpEmailTemplate Risk Based Authentication Ip EmailTemplate + * @param rbaIpSmsTemplate Risk Based Authentication Ip SmsTemplate + * @param rbaOneclickEmailTemplate Risk Based Authentication Oneclick EmailTemplate + * @param rbaOTPSmsTemplate Risk Based Authentication OTPSmsTemplate + * @param smsTemplate SMS Template name + * @param verificationUrl Email verification url * @return Response containing User Profile Data and access token *9.2.6 */ rbaLoginByPhone ( - phoneAuthenticationModel, - emailTemplate, - fields, - loginUrl, - passwordDelegation, - passwordDelegationApp, - rbaBrowserEmailTemplate, - rbaBrowserSmsTemplate, - rbaCityEmailTemplate, - rbaCitySmsTemplate, - rbaCountryEmailTemplate, - rbaCountrySmsTemplate, - rbaIpEmailTemplate, - rbaIpSmsTemplate, - rbaOneclickEmailTemplate, - rbaOTPSmsTemplate, - smsTemplate, - verificationUrl + phoneAuthenticationModel: object, + emailTemplate?: string, + fields?: string, + loginUrl?: string, + passwordDelegation?: string, + passwordDelegationApp?: string, + rbaBrowserEmailTemplate?: string, + rbaBrowserSmsTemplate?: string, + rbaCityEmailTemplate?: string, + rbaCitySmsTemplate?: string, + rbaCountryEmailTemplate?: string, + rbaCountrySmsTemplate?: string, + rbaIpEmailTemplate?: string, + rbaIpSmsTemplate?: string, + rbaOneclickEmailTemplate?: string, + rbaOTPSmsTemplate?: string, + smsTemplate?: string, + verificationUrl?: string ) { if (checkJson(phoneAuthenticationModel)) { return Promise.reject(getValidationMessage('phoneAuthenticationModel')); diff --git a/loginradius-sdk/src/api/authentication/smartLoginApi.ts b/loginradius-sdk/src/api/authentication/smartLoginApi.ts index 9976f3c..0c456a9 100644 --- a/loginradius-sdk/src/api/authentication/smartLoginApi.ts +++ b/loginradius-sdk/src/api/authentication/smartLoginApi.ts @@ -15,12 +15,12 @@ export default class SmartLoginApi { /** * This API verifies the provided token for Smart Login - * @param {verificationToken} Verification token received in the email - * @param {welcomeEmailTemplate} Name of the welcome email template + * @param verificationToken Verification token received in the email + * @param welcomeEmailTemplate Name of the welcome email template * @return Complete verified response data *8.4.1 */ - smartLoginTokenVerification (verificationToken, welcomeEmailTemplate) { + smartLoginTokenVerification (verificationToken: string, welcomeEmailTemplate?: string) { if (isNullOrWhiteSpace(verificationToken)) { return Promise.reject(getValidationMessage('verificationToken')); } @@ -39,20 +39,20 @@ export default class SmartLoginApi { /** * This API sends a Smart Login link to the user's Email Id. - * @param {clientGuid} Unique string used in the Smart Login request - * @param {email} Email of the user - * @param {redirectUrl} Url where the user will redirect after success authentication - * @param {smartLoginEmailTemplate} Email template for Smart Login link - * @param {welcomeEmailTemplate} Name of the welcome email template + * @param clientGuid Unique string used in the Smart Login request + * @param email Email of the user + * @param redirectUrl Url where the user will redirect after success authentication + * @param smartLoginEmailTemplate Email template for Smart Login link + * @param welcomeEmailTemplate Name of the welcome email template * @return Response containing Definition of Complete Validation data *9.17.1 */ smartLoginByEmail ( - clientGuid, - email, - redirectUrl, - smartLoginEmailTemplate, - welcomeEmailTemplate + clientGuid: string, + email: string, + redirectUrl?: string, + smartLoginEmailTemplate?: string, + welcomeEmailTemplate?: string ) { if (isNullOrWhiteSpace(clientGuid)) { return Promise.reject(getValidationMessage('clientGuid')); @@ -82,20 +82,20 @@ export default class SmartLoginApi { /** * This API sends a Smart Login link to the user's Email Id. - * @param {clientGuid} Unique string used in the Smart Login request - * @param {username} UserName of the user - * @param {redirectUrl} Url where the user will redirect after success authentication - * @param {smartLoginEmailTemplate} Email template for Smart Login link - * @param {welcomeEmailTemplate} Name of the welcome email template + * @param clientGuid Unique string used in the Smart Login request + * @param username UserName of the user + * @param redirectUrl Url where the user will redirect after success authentication + * @param smartLoginEmailTemplate Email template for Smart Login link + * @param welcomeEmailTemplate Name of the welcome email template * @return Response containing Definition of Complete Validation data *9.17.2 */ smartLoginByUserName ( - clientGuid, - username, - redirectUrl, - smartLoginEmailTemplate, - welcomeEmailTemplate + clientGuid: string, + username: string, + redirectUrl?: string, + smartLoginEmailTemplate?: string, + welcomeEmailTemplate?: string ) { if (isNullOrWhiteSpace(clientGuid)) { return Promise.reject(getValidationMessage('clientGuid')); @@ -125,8 +125,8 @@ export default class SmartLoginApi { /** * This API is used to check if the Smart Login link has been clicked or not - * @param {clientGuid} Unique string used in the Smart Login request - * @param {fields} The fields parameter filters the API response so that the response only includes a specific set of fields + * @param clientGuid Unique string used in the Smart Login request + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @return Response containing User Profile Data and access token *9.21.1 */ diff --git a/loginradius-sdk/src/api/social/nativeSocialApi.ts b/loginradius-sdk/src/api/social/nativeSocialApi.ts index 7bb17a5..b085311 100644 --- a/loginradius-sdk/src/api/social/nativeSocialApi.ts +++ b/loginradius-sdk/src/api/social/nativeSocialApi.ts @@ -15,12 +15,12 @@ export default class NativeSocialApi { /** * The API is used to get LoginRadius access token by sending Facebook's access token. It will be valid for the specific duration of time specified in the response. - * @param {fbAccessToken} Facebook Access Token - * @param {socialAppName} Name of Social provider APP + * @param fbAccessToken Facebook Access Token + * @param socialAppName Name of Social provider APP * @return Response containing Definition of Complete Token data *20.3 */ - getAccessTokenByFacebookAccessToken (fbAccessToken, socialAppName) { + getAccessTokenByFacebookAccessToken (fbAccessToken: string, socialAppName?: string) { if (isNullOrWhiteSpace(fbAccessToken)) { return Promise.reject(getValidationMessage('fbAccessToken')); } @@ -39,16 +39,16 @@ export default class NativeSocialApi { /** * The API is used to get LoginRadius access token by sending Twitter's access token. It will be valid for the specific duration of time specified in the response. - * @param {twAccessToken} Twitter Access Token - * @param {twTokenSecret} Twitter Token Secret - * @param {socialAppName} Name of Social provider APP + * @param twAccessToken Twitter Access Token + * @param twTokenSecret Twitter Token Secret + * @param socialAppName Name of Social provider APP * @return Response containing Definition of Complete Token data *20.4 */ getAccessTokenByTwitterAccessToken ( - twAccessToken, - twTokenSecret, - socialAppName + twAccessToken: string, + twTokenSecret: string, + socialAppName?: string ) { if (isNullOrWhiteSpace(twAccessToken)) { return Promise.reject(getValidationMessage('twAccessToken')); @@ -72,18 +72,18 @@ export default class NativeSocialApi { /** * The API is used to get LoginRadius access token by sending Google's access token. It will be valid for the specific duration of time specified in the response. - * @param {googleAccessToken} Google Access Token - * @param {clientId} Google Client ID - * @param {refreshToken} LoginRadius refresh token - * @param {socialAppName} Name of Social provider APP + * @param googleAccessToken Google Access Token + * @param clientId Google Client ID + * @param refreshToken LoginRadius refresh token + * @param socialAppName Name of Social provider APP * @return Response containing Definition of Complete Token data *20.5 */ getAccessTokenByGoogleAccessToken ( - googleAccessToken, - clientId, - refreshToken, - socialAppName + googleAccessToken: string, + clientId?: string, + refreshToken?: string, + socialAppName?: string ) { if (isNullOrWhiteSpace(googleAccessToken)) { return Promise.reject(getValidationMessage('googleAccessToken')); @@ -109,11 +109,11 @@ export default class NativeSocialApi { /** * This API is used to Get LoginRadius Access Token using google jwt id token for google native mobile login/registration. - * @param {idToken} Google JWT id_token + * @param idToken Google JWT id_token * @return Response containing Definition of Complete Token data *20.6 */ - getAccessTokenByGoogleJWTAccessToken (idToken) { + getAccessTokenByGoogleJWTAccessToken (idToken: string) { if (isNullOrWhiteSpace(idToken)) { return Promise.reject(getValidationMessage('idToken')); } @@ -129,12 +129,12 @@ export default class NativeSocialApi { /** * The API is used to get LoginRadius access token by sending Linkedin's access token. It will be valid for the specific duration of time specified in the response. - * @param {lnAccessToken} Linkedin Access Token - * @param {socialAppName} Name of Social provider APP + * @param lnAccessToken Linkedin Access Token + * @param socialAppName Name of Social provider APP * @return Response containing Definition of Complete Token data *20.7 */ - getAccessTokenByLinkedinAccessToken (lnAccessToken, socialAppName) { + getAccessTokenByLinkedinAccessToken (lnAccessToken: string, socialAppName?: string) { if (isNullOrWhiteSpace(lnAccessToken)) { return Promise.reject(getValidationMessage('lnAccessToken')); } @@ -153,11 +153,11 @@ export default class NativeSocialApi { /** * The API is used to get LoginRadius access token by sending Foursquare's access token. It will be valid for the specific duration of time specified in the response. - * @param {fsAccessToken} Foursquare Access Token + * @param fsAccessToken Foursquare Access Token * @return Response containing Definition of Complete Token data *20.8 */ - getAccessTokenByFoursquareAccessToken (fsAccessToken) { + getAccessTokenByFoursquareAccessToken (fsAccessToken: string) { if (isNullOrWhiteSpace(fsAccessToken)) { return Promise.reject(getValidationMessage('fsAccessToken')); } @@ -173,12 +173,12 @@ export default class NativeSocialApi { /** * The API is used to get LoginRadius access token by sending a valid Apple ID OAuth Code. It will be valid for the specific duration of time specified in the response. - * @param {code} Apple Code - * @param {socialAppName} Name of Social provider APP + * @param code Apple Code + * @param socialAppName Name of Social provider APP * @return Response containing Definition of Complete Token data *20.12 */ - getAccessTokenByAppleIdCode (code, socialAppName) { + getAccessTokenByAppleIdCode (code: string, socialAppName: string) { if (isNullOrWhiteSpace(code)) { return Promise.reject(getValidationMessage('code')); } @@ -197,11 +197,11 @@ export default class NativeSocialApi { /** * This API is used to retrieve a LoginRadius access token by passing in a valid WeChat OAuth Code. - * @param {code} WeChat Code + * @param code WeChat Code * @return Response containing Definition of Complete Token data *20.13 */ - getAccessTokenByWeChatCode (code) { + getAccessTokenByWeChatCode (code: string) { if (isNullOrWhiteSpace(code)) { return Promise.reject(getValidationMessage('code')); } @@ -217,12 +217,12 @@ export default class NativeSocialApi { /** * The API is used to get LoginRadius access token by sending Google's AuthCode. It will be valid for the specific duration of time specified in the response. - * @param {googleAuthcode} Google AuthCode - * @param {socialAppName} Name of Social provider APP + * @param googleAuthcode Google AuthCode + * @param socialAppName Name of Social provider APP * @return Response containing Definition of Complete Token data *20.16 */ - getAccessTokenByGoogleAuthCode (googleAuthcode, socialAppName) { + getAccessTokenByGoogleAuthCode (googleAuthcode: string, socialAppName?: string) { if (isNullOrWhiteSpace(googleAuthcode)) { return Promise.reject(getValidationMessage('googleAuthcode')); } diff --git a/loginradius-sdk/src/api/social/socialApi.ts b/loginradius-sdk/src/api/social/socialApi.ts index 191f67f..1094365 100644 --- a/loginradius-sdk/src/api/social/socialApi.ts +++ b/loginradius-sdk/src/api/social/socialApi.ts @@ -15,11 +15,11 @@ export default class SocialApi { /** * This API Is used to translate the Request Token returned during authentication into an Access Token that can be used with other API calls. - * @param {token} Token generated from a successful oauth from social platform + * @param token Token generated from a successful oauth from social platform * @return Response containing Definition of Complete Token data *20.1 */ - exchangeAccessToken (token) { + exchangeAccessToken (token: string) { if (isNullOrWhiteSpace(token)) { return Promise.reject(getValidationMessage('token')); } @@ -35,13 +35,13 @@ export default class SocialApi { /** * The Refresh Access Token API is used to refresh the provider access token after authentication. It will be valid for up to 60 days on LoginRadius depending on the provider. In order to use the access token in other APIs, always refresh the token using this API.

Supported Providers : Facebook,Yahoo,Google,Twitter, Linkedin.

Contact LoginRadius support team to enable this API. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param {expiresIn} Allows you to specify a desired expiration time in minutes for the newly issued access token. - * @param {isWeb} Is web or not. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param expiresIn Allows you to specify a desired expiration time in minutes for the newly issued access token. + * @param isWeb Is web or not. * @return Response containing Definition of Complete Token data *20.2 */ - refreshAccessToken (accessToken, expiresIn, isWeb) { + refreshAccessToken (accessToken: string, expiresIn: number, isWeb: boolean) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -63,11 +63,11 @@ export default class SocialApi { /** * This API validates access token, if valid then returns a response with its expiry otherwise error. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @return Response containing Definition of Complete Token data *20.9 */ - validateAccessToken (accessToken) { + validateAccessToken (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -84,11 +84,11 @@ export default class SocialApi { /** * This api invalidates the active access token or expires an access token validity. - * @param {accessToken} Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @return Response containing Definition for Complete Validation data *20.10 */ - inValidateAccessToken (accessToken) { + inValidateAccessToken (accessToken: string) { if (isNullOrWhiteSpace(accessToken)) { return Promise.reject(getValidationMessage('accessToken')); } @@ -105,11 +105,11 @@ export default class SocialApi { /** * This api is use to get all active session by Access Token. - * @param {token} Token generated from a successful oauth from social platform + * @param token Token generated from a successful oauth from social platform * @return Response containing Definition for Complete active sessions *20.11.1 */ - getActiveSession (token) { + getActiveSession (token: string) { if (isNullOrWhiteSpace(token)) { return Promise.reject(getValidationMessage('token')); } @@ -126,11 +126,11 @@ export default class SocialApi { /** * This api is used to get all active sessions by AccountID(UID). - * @param {accountId} UID, the unified identifier for each user account + * @param accountId UID, the unified identifier for each user account * @return Response containing Definition for Complete active sessions *20.11.2 */ - getActiveSessionByAccountID (accountId) { + getActiveSessionByAccountID (accountId: string) { if (isNullOrWhiteSpace(accountId)) { return Promise.reject(getValidationMessage('accountId')); } @@ -147,11 +147,11 @@ export default class SocialApi { /** * This api is used to get all active sessions by ProfileId. - * @param {profileId} Social Provider Id + * @param profileId Social Provider Id * @return Response containing Definition for Complete active sessions *20.11.3 */ - getActiveSessionByProfileID (profileId) { + getActiveSessionByProfileID (profileId: string) { if (isNullOrWhiteSpace(profileId)) { return Promise.reject(getValidationMessage('profileId')); } diff --git a/loginradius-sdk/src/types.ts b/loginradius-sdk/src/types.ts index 9e6b452..6f60e9c 100644 --- a/loginradius-sdk/src/types.ts +++ b/loginradius-sdk/src/types.ts @@ -12,3 +12,8 @@ export interface LoginRadiusConfig { apiRequestSigning?: boolean; apiKey: string; } + +export interface SottConfig { + apiKey: string, + apiSecret: string +} diff --git a/loginradius-sdk/src/util/helper.ts b/loginradius-sdk/src/util/helper.ts index aa64139..1c8b57c 100644 --- a/loginradius-sdk/src/util/helper.ts +++ b/loginradius-sdk/src/util/helper.ts @@ -2,6 +2,7 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ +import { SottConfig } from '../types'; import crypto from 'crypto'; import https from 'https'; import querystring from 'querystring'; @@ -17,20 +18,20 @@ const jsonData = { /** * Check null or undefined - * @param {string} as input + * @param input as input * @return input is null or not */ -export function isNullOrWhiteSpace (input) { +export function isNullOrWhiteSpace (input?: string) { return !(input === null || typeof input === 'undefined' ? '' : input); } /** * Get Error response - * @param {string} status - * @param {json} input + * @param status + * @param input * @return json of api response */ -export function checkError (status, input) { +export function checkError (status: string, input: any) { if (status === 'serverError') { return input !== '' ? input : jsonData; } @@ -39,10 +40,10 @@ export function checkError (status, input) { /** * Check json is correct or not - * @param {string} input - * @return input is json or not + * @param input + * @return true if input is invalid */ -export function checkJson (input) { +export function checkJson (input: object) { return !!( input === null || input === undefined || @@ -53,12 +54,12 @@ export function checkJson (input) { /** * Generate the sott - * @param {json} config as site config - * @param {string} startDate as start date - * @param {string} endDate as end date + * @param sottconfig site config + * @param startDate start date + * @param endDate end date * @return generated sott */ -export async function getSott (sottconfig, startDate, endDate, timeDifference) { +export async function getSott (sottconfig: SottConfig, startDate: string, endDate: string, timeDifference: number) { try { return await sott(sottconfig, startDate, endDate, timeDifference); } catch (err) { @@ -68,10 +69,10 @@ export async function getSott (sottconfig, startDate, endDate, timeDifference) { /** * Get Validation Message - * @param {string} type as error string + * @param type error string * @return jsondata as json error object */ -export function getValidationMessage (type) { +export function getValidationMessage (type: string) { return { ...jsonData, Description: `The API Request Parameter ${type} is not Correct or WellFormated` @@ -80,12 +81,12 @@ export function getValidationMessage (type) { /** * Manage the api response - * @param {string} status as error status - * @param {json} data as response data - * @param {*} resolve as promise resolve - * @param {*} reject as promise reject + * @param status error status + * @param data response data + * @param resolve as promise resolve + * @param reject as promise reject */ -export function manageRequestResponse (status, data, resolve, reject) { +export function manageRequestResponse (status: string, data: any, resolve, reject) { if (checkError(status, data)) { if (!data) { data = checkError(status, data); @@ -98,8 +99,8 @@ export function manageRequestResponse (status, data, resolve, reject) { /** * Get Query String - * @param {object} string as json input object - * @return qauery string + * @param string json input object + * @return query string */ export function getQueryString (string) { return querystring.stringify(string, undefined, undefined, { @@ -109,11 +110,11 @@ export function getQueryString (string) { /** * Generate signin header - * @param {object} options as options object - * @param {string} apiSecret + * @param options as options object + * @param apiSecret * @return header object */ -export function generateSigningHeader (options, apiSecret) { +export function generateSigningHeader (options: any, apiSecret: string) { var SIXTY = 60; var SIXTYTHOUSAND = 60000; var TEN = 10; diff --git a/loginradius-sdk/src/util/lr.ts b/loginradius-sdk/src/util/lr.ts index f581878..8a58199 100644 --- a/loginradius-sdk/src/util/lr.ts +++ b/loginradius-sdk/src/util/lr.ts @@ -24,8 +24,7 @@ import WebHookApi from '../api/advanced/webHookApi'; export default function (config: LoginRadiusConfig) { if (config.apiKey === undefined || config.apiSecret === undefined) { - console.error('Please set apiKey API & apiSecret'); - return; + throw new Error('Please set apiKey API & apiSecret'); } if (!config.apiDomain || config.apiDomain === '') { config.apiDomain = 'api.loginradius.com'; diff --git a/loginradius-sdk/src/util/sott.ts b/loginradius-sdk/src/util/sott.ts index ed97cf9..0090f8b 100644 --- a/loginradius-sdk/src/util/sott.ts +++ b/loginradius-sdk/src/util/sott.ts @@ -1,6 +1,7 @@ +import { SottConfig } from '../types'; import crypto from 'crypto'; -export default function (sottconfig, startDate, endDate, timeDifference) { +export default function (sottconfig: SottConfig, startDate: string, endDate: string, timeDifference: number) { var key = sottconfig.apiKey; var secret = sottconfig.apiSecret; var time = timeDifference; From c5442982a11030682a053fa7418c095ea97b96f1 Mon Sep 17 00:00:00 2001 From: Daniel Brenot Date: Fri, 27 Jan 2023 13:34:10 -0500 Subject: [PATCH 4/5] Updated README to show new usage of API --- README.md | 2 +- loginradius-sdk/.eslintrc | 2 +- loginradius-sdk/package.json | 8 +-- loginradius-sdk/src/util/helper.ts | 17 ----- loginradius-sdk/src/util/lr.ts | 101 +++++++++++++++++++++-------- 5 files changed, 78 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index a31180e..72d2fb0 100644 --- a/README.md +++ b/README.md @@ -5520,7 +5520,7 @@ var startDate="2022-05-17 07:10:42"; // (Optional) Valid Start Date with Date an var endDate="2022-05-17 07:20:42"; // (Optional) Valid End Date with Date and time -lrv2.helper.getSott(sottConfig,startDate, endDate,timeDifference).then(function (sott) { +lrv2.getSott(sottConfig, startDate, endDate, timeDifference).then(function (sott) { console.log(sott) }); diff --git a/loginradius-sdk/.eslintrc b/loginradius-sdk/.eslintrc index eb8c57e..8128a25 100644 --- a/loginradius-sdk/.eslintrc +++ b/loginradius-sdk/.eslintrc @@ -121,7 +121,7 @@ ], "lines-around-comment": "off", "lines-around-directive": "error", - "lines-between-class-members": "error", + "lines-between-class-members": "off", "max-classes-per-file": "error", "max-depth": "error", "max-len": "off", diff --git a/loginradius-sdk/package.json b/loginradius-sdk/package.json index 180e749..d53b2ea 100644 --- a/loginradius-sdk/package.json +++ b/loginradius-sdk/package.json @@ -39,15 +39,13 @@ "files": [ "lib" ], - "dependencies": { - "eslint": "^8.29.0", - "prettier": "^2.8.1" - }, "devDependencies": { "@types/node": "^18.11.18", "@typescript-eslint/eslint-plugin": "^5.49.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-prettier": "^4.2.1", - "typescript": "^4.9.4" + "typescript": "^4.9.4", + "eslint": "^8.29.0", + "prettier": "^2.8.1" } } diff --git a/loginradius-sdk/src/util/helper.ts b/loginradius-sdk/src/util/helper.ts index 1c8b57c..08e4ebc 100644 --- a/loginradius-sdk/src/util/helper.ts +++ b/loginradius-sdk/src/util/helper.ts @@ -2,11 +2,9 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ -import { SottConfig } from '../types'; import crypto from 'crypto'; import https from 'https'; import querystring from 'querystring'; -import sott from './sott'; const jsonData = { Description: 'Oops something went wrong, Please try again.', @@ -52,21 +50,6 @@ export function checkJson (input: object) { ); } -/** - * Generate the sott - * @param sottconfig site config - * @param startDate start date - * @param endDate end date - * @return generated sott - */ -export async function getSott (sottconfig: SottConfig, startDate: string, endDate: string, timeDifference: number) { - try { - return await sott(sottconfig, startDate, endDate, timeDifference); - } catch (err) { - throw err; - } -} - /** * Get Validation Message * @param type error string diff --git a/loginradius-sdk/src/util/lr.ts b/loginradius-sdk/src/util/lr.ts index 8a58199..c07035a 100644 --- a/loginradius-sdk/src/util/lr.ts +++ b/loginradius-sdk/src/util/lr.ts @@ -2,12 +2,12 @@ * Created by LoginRadius Development Team Copyright 2019 LoginRadius Inc. All rights reserved. */ +import { LoginRadiusConfig, SottConfig } from '../types'; import AccountApi from '../api/account/accountApi'; import AuthenticationApi from '../api/authentication/authenticationApi'; import ConfigurationApi from '../api/advanced/configurationApi'; import ConsentManagementApi from '../api/advanced/consentManagementApi'; import CustomObjectApi from '../api/advanced/customObjectApi'; -import { LoginRadiusConfig } from '../types'; import MultiFactorAuthenticationApi from '../api/advanced/multiFactorAuthenticationApi'; import NativeSocialApi from '../api/social/nativeSocialApi'; import OneTouchLoginApi from '../api/authentication/oneTouchLoginApi'; @@ -21,32 +21,77 @@ import SmartLoginApi from '../api/authentication/smartLoginApi'; import SocialApi from '../api/social/socialApi'; import SottApi from '../api/account/sottApi'; import WebHookApi from '../api/advanced/webHookApi'; +import sott from './sott'; -export default function (config: LoginRadiusConfig) { - if (config.apiKey === undefined || config.apiSecret === undefined) { - throw new Error('Please set apiKey API & apiSecret'); - } - if (!config.apiDomain || config.apiDomain === '') { - config.apiDomain = 'api.loginradius.com'; - } - return { - accountApi: new AccountApi(config), - roleApi: new RoleApi(config), - sottApi: new SottApi(config), - configurationApi: new ConfigurationApi(config), - customObjectApi: new CustomObjectApi(config), - multiFactorAuthenticationApi: new MultiFactorAuthenticationApi(config), - webHookApi: new WebHookApi(config), - consentManagementApi: new ConsentManagementApi(config), - reAuthenticationApi: new ReAuthenticationApi(config), - authenticationApi: new AuthenticationApi(config), - oneTouchLoginApi: new OneTouchLoginApi(config), - passwordLessLoginApi: new PasswordlessLoginApi(config), - phoneAuthenticationApi: new PhoneAuthenticationApi(config), - riskBasedAuthenticationApi: new RiskBasedAuthenticationApi(config), - pinAuthenticationApi: new PinAuthenticationApi(config), - smartLoginApi: new SmartLoginApi(config), - nativeSocialApi: new NativeSocialApi(config), - socialApi: new SocialApi(config) - }; +export default class LoginRadiusApi { + + accountApi: AccountApi; + roleApi: RoleApi; + sottApi: SottApi; + configurationApi: ConfigurationApi; + customObjectApi: CustomObjectApi; + multiFactorAuthenticationApi: MultiFactorAuthenticationApi; + webHookApi: WebHookApi; + consentManagementApi: ConsentManagementApi; + reAuthenticationApi: ReAuthenticationApi; + authenticationApi: AuthenticationApi; + oneTouchLoginApi: OneTouchLoginApi; + passwordLessLoginApi: PasswordlessLoginApi; + phoneAuthenticationApi: PhoneAuthenticationApi; + riskBasedAuthenticationApi: RiskBasedAuthenticationApi; + pinAuthenticationApi: PinAuthenticationApi; + smartLoginApi: SmartLoginApi; + nativeSocialApi: NativeSocialApi; + socialApi: SocialApi; + + constructor (private config: LoginRadiusConfig) { + if (config.apiKey === undefined || config.apiSecret === undefined) { + throw new Error('Please set apiKey API & apiSecret'); + } + if (!config.apiDomain || config.apiDomain === '') { + config.apiDomain = 'api.loginradius.com'; + } + this.accountApi = new AccountApi(config); + this.roleApi = new RoleApi(config); + this.sottApi = new SottApi(config); + this.configurationApi = new ConfigurationApi(config); + this.customObjectApi = new CustomObjectApi(config); + this.multiFactorAuthenticationApi = new MultiFactorAuthenticationApi(config); + this.webHookApi = new WebHookApi(config); + this.consentManagementApi = new ConsentManagementApi(config); + this.reAuthenticationApi = new ReAuthenticationApi(config); + this.authenticationApi = new AuthenticationApi(config); + this.oneTouchLoginApi = new OneTouchLoginApi(config); + this.passwordLessLoginApi = new PasswordlessLoginApi(config); + this.phoneAuthenticationApi = new PhoneAuthenticationApi(config); + this.riskBasedAuthenticationApi = new RiskBasedAuthenticationApi(config); + this.pinAuthenticationApi = new PinAuthenticationApi(config); + this.smartLoginApi = new SmartLoginApi(config); + this.nativeSocialApi = new NativeSocialApi(config); + this.socialApi = new SocialApi(config); + } + + /** + * Generate the sott + * @param sottconfig site config + * @param startDate start date + * @param endDate end date + * @return generated sott + */ + async getSott (sottconfig: Partial, startDate: string, endDate: string, timeDifference: number) { + try { + return await sott( + { + apiKey: this.config.apiKey, + apiSecret: this.config.apiSecret, + ...sottconfig + }, + startDate, + endDate, + timeDifference + ); + } catch (err) { + throw err; + } + } } From 10868f2766ce75509f497495c4fbef19b2c9e521 Mon Sep 17 00:00:00 2001 From: Daniel Brenot Date: Fri, 27 Jan 2023 14:06:50 -0500 Subject: [PATCH 5/5] Updated demo to use new syntax for loginradius api --- README.md | 2 +- demo/package.json | 4 ++-- demo/server.js | 4 ++-- loginradius-sdk/src/types.ts | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 72d2fb0..1e4cdf2 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ The originIp will be added in `var config` Require the loginradius-sdk package and pass the config object. ```js - var lrv2 = require('loginradius-sdk')(config); + var lrv2 = new require('loginradius-sdk')(config); ``` The below APIs will be used to implement the loginradius functionalities. diff --git a/demo/package.json b/demo/package.json index 4e2eafb..8b4a2be 100644 --- a/demo/package.json +++ b/demo/package.json @@ -1,6 +1,6 @@ { "name": "nodeJsDemo", - "version": "11.5.0-demo", + "version": "12.0.0-demo", "keywords": [ "util", "functional", @@ -13,6 +13,6 @@ "dependencies": { "body-parser": "^1.18.3", "express": "^4.16.3", - "loginradius-sdk": "11.5.0" + "loginradius-sdk": "12.0.0" } } diff --git a/demo/server.js b/demo/server.js index 63db9fa..ea86d3b 100644 --- a/demo/server.js +++ b/demo/server.js @@ -17,7 +17,7 @@ var config = { // Module dependencies. var express = require('express'); -var lrv2 = require('loginradius-sdk')(config); +var lrv2 = new require('loginradius-sdk')(config); var bodyParser = require('body-parser'); var path = require('path'); var app = express(); @@ -100,7 +100,7 @@ app.post('/ajax_handler/login', function (req, res) { var fields = ''; var options = ''; - lrv2.helper.getSott(config).then(function (sott) { + lrv2.getSott(config).then(function (sott) { lrv2.authenticationApi.userRegistrationByEmail(userprofileModel, sott, emailTemplate, fields, options, verificationUrl, welcomeEmailTemplate).then(function (response) { if ((response.EmailVerified)) { output.data = response; diff --git a/loginradius-sdk/src/types.ts b/loginradius-sdk/src/types.ts index 6f60e9c..d65232a 100644 --- a/loginradius-sdk/src/types.ts +++ b/loginradius-sdk/src/types.ts @@ -3,11 +3,13 @@ export interface LoginRadiusConfig { serverRegion?: string; originIp?: string; apiDomain?: any; - proxy: { + proxy?: { host: string; port: number; + user?: string; + password?: string; }; - fieldsParam: string; + fieldsParam?: string; fieldsValue?: string; apiRequestSigning?: boolean; apiKey: string;