@frontegg/rest-api 2.10.90 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/ContextHolder.d.ts → ContextHolder.d.ts} +0 -0
- package/ContextHolder.js +114 -0
- package/{dist/account-settings → account-settings}/index.d.ts +0 -0
- package/account-settings/index.js +47 -0
- package/{dist/account-settings → account-settings}/interfaces.d.ts +0 -0
- package/account-settings/interfaces.js +1 -0
- package/account-settings/package.json +6 -0
- package/{dist/audits → audits}/index.d.ts +0 -0
- package/audits/index.js +74 -0
- package/{dist/audits → audits}/interfaces.d.ts +0 -0
- package/audits/interfaces.js +1 -0
- package/audits/package.json +6 -0
- package/{dist/auth → auth}/enums.d.ts +0 -0
- package/auth/enums.js +18 -0
- package/{dist/auth → auth}/index.d.ts +0 -0
- package/auth/index.js +2102 -0
- package/{dist/auth → auth}/interfaces.d.ts +0 -0
- package/auth/interfaces.js +16 -0
- package/auth/package.json +6 -0
- package/{dist/auth → auth}/secutiry-poilicy/index.d.ts +0 -0
- package/auth/secutiry-poilicy/index.js +257 -0
- package/{dist/auth → auth}/secutiry-poilicy/interfaces.d.ts +0 -0
- package/auth/secutiry-poilicy/interfaces.js +1 -0
- package/{dist/connectivity → connectivity}/index.d.ts +0 -0
- package/connectivity/index.js +114 -0
- package/{dist/connectivity → connectivity}/interfaces.d.ts +0 -0
- package/connectivity/interfaces.js +1 -0
- package/connectivity/package.json +6 -0
- package/{dist/constants.d.ts → constants.d.ts} +0 -0
- package/{src/constants.ts → constants.js} +13 -13
- package/{dist/error.d.ts → error.d.ts} +0 -0
- package/error.js +36 -0
- package/fetch.d.ts +19 -0
- package/fetch.js +557 -0
- package/{dist/es2015/index.d.ts → index.d.ts} +0 -0
- package/{dist/es2015/index.js → index.js} +32 -28
- package/{dist/es2015/interfaces.d.ts → interfaces.d.ts} +0 -0
- package/interfaces.js +1 -0
- package/{dist/es2015/jwt.d.ts → jwt.d.ts} +0 -0
- package/jwt.js +105 -0
- package/{dist/es2015/metadata → metadata}/index.d.ts +0 -0
- package/metadata/index.js +166 -0
- package/{dist/es2015/metadata → metadata}/interfaces.d.ts +0 -0
- package/metadata/interfaces.js +1 -0
- package/metadata/package.json +6 -0
- package/node/ContextHolder.js +126 -0
- package/node/account-settings/index.js +61 -0
- package/node/account-settings/interfaces.js +5 -0
- package/node/audits/index.js +90 -0
- package/node/audits/interfaces.js +5 -0
- package/node/auth/enums.js +26 -0
- package/node/auth/index.js +2327 -0
- package/node/auth/interfaces.js +39 -0
- package/node/auth/secutiry-poilicy/index.js +279 -0
- package/node/auth/secutiry-poilicy/interfaces.js +5 -0
- package/node/connectivity/index.js +201 -0
- package/node/connectivity/interfaces.js +5 -0
- package/node/constants.js +177 -0
- package/node/error.js +50 -0
- package/node/fetch.js +589 -0
- package/node/index.js +359 -0
- package/node/interfaces.js +5 -0
- package/node/jwt.js +125 -0
- package/node/metadata/index.js +188 -0
- package/node/metadata/interfaces.js +5 -0
- package/node/notifications/index.js +115 -0
- package/node/notifications/interfaces.js +5 -0
- package/node/reports/index.js +205 -0
- package/node/reports/interfaces.js +5 -0
- package/node/roles/index.js +209 -0
- package/node/roles/interfaces.js +5 -0
- package/node/routers.js +13 -0
- package/node/sub-tenants/index.js +153 -0
- package/node/sub-tenants/interfaces.js +5 -0
- package/node/subscriptions/enums.js +39 -0
- package/node/subscriptions/index.js +135 -0
- package/node/subscriptions/interfaces.js +18 -0
- package/node/subscriptions/invoices.js +88 -0
- package/node/subscriptions/managedSubscriptions.js +135 -0
- package/node/subscriptions/paymentMethods.js +91 -0
- package/node/subscriptions/paymentProviders.js +38 -0
- package/node/subscriptions/plans.js +61 -0
- package/node/subscriptions/providers/index.js +18 -0
- package/node/subscriptions/providers/stripe/index.js +130 -0
- package/node/subscriptions/providers/stripe/interfaces.js +5 -0
- package/node/subscriptions/subscriptions.js +135 -0
- package/node/subscriptions/summaries.js +38 -0
- package/node/subscriptions/tenantConfiguration.js +61 -0
- package/node/teams/index.js +478 -0
- package/node/teams/interfaces.js +5 -0
- package/node/tenants/index.js +107 -0
- package/node/tenants/interfaces.js +5 -0
- package/node/vendor/index.js +40 -0
- package/node/vendor/interfaces.js +5 -0
- package/{dist/es2015/notifications → notifications}/index.d.ts +0 -0
- package/notifications/index.js +99 -0
- package/{dist/es2015/notifications → notifications}/interfaces.d.ts +0 -0
- package/notifications/interfaces.js +1 -0
- package/notifications/package.json +6 -0
- package/package.json +9 -32
- package/{dist/es2015/reports → reports}/index.d.ts +0 -0
- package/reports/index.js +185 -0
- package/{dist/es2015/reports → reports}/interfaces.d.ts +0 -0
- package/reports/interfaces.js +1 -0
- package/reports/package.json +6 -0
- package/{dist/es2015/roles → roles}/index.d.ts +0 -0
- package/roles/index.js +188 -0
- package/{dist/es2015/roles → roles}/interfaces.d.ts +0 -0
- package/roles/interfaces.js +1 -0
- package/roles/package.json +6 -0
- package/{dist/es2015/routers.d.ts → routers.d.ts} +0 -0
- package/routers.js +3 -0
- package/{dist/es2015/sub-tenants → sub-tenants}/index.d.ts +0 -0
- package/sub-tenants/index.js +135 -0
- package/{dist/es2015/sub-tenants → sub-tenants}/interfaces.d.ts +0 -0
- package/sub-tenants/interfaces.js +1 -0
- package/sub-tenants/package.json +6 -0
- package/{dist/es2015/subscriptions → subscriptions}/enums.d.ts +0 -0
- package/subscriptions/enums.js +29 -0
- package/{dist/es2015/subscriptions → subscriptions}/index.d.ts +0 -0
- package/{dist/subscriptions/index.d.ts → subscriptions/index.js} +1 -1
- package/{dist/es2015/subscriptions → subscriptions}/interfaces.d.ts +0 -0
- package/{dist/es2015/subscriptions → subscriptions}/interfaces.js +1 -1
- package/{dist/es2015/subscriptions → subscriptions}/invoices.d.ts +0 -0
- package/subscriptions/invoices.js +73 -0
- package/{dist/es2015/subscriptions → subscriptions}/managedSubscriptions.d.ts +0 -0
- package/subscriptions/managedSubscriptions.js +118 -0
- package/subscriptions/package.json +6 -0
- package/{dist/es2015/subscriptions → subscriptions}/paymentMethods.d.ts +0 -0
- package/subscriptions/paymentMethods.js +75 -0
- package/{dist/es2015/subscriptions → subscriptions}/paymentProviders.d.ts +0 -0
- package/subscriptions/paymentProviders.js +25 -0
- package/{dist/es2015/subscriptions → subscriptions}/plans.d.ts +0 -0
- package/subscriptions/plans.js +47 -0
- package/{dist/es2015/subscriptions → subscriptions}/providers/index.d.ts +0 -0
- package/subscriptions/providers/index.js +1 -0
- package/{dist/es2015/subscriptions → subscriptions}/providers/stripe/index.d.ts +0 -0
- package/subscriptions/providers/stripe/index.js +113 -0
- package/{dist/es2015/subscriptions → subscriptions}/providers/stripe/interfaces.d.ts +0 -0
- package/subscriptions/providers/stripe/interfaces.js +1 -0
- package/{dist/es2015/subscriptions → subscriptions}/subscriptions.d.ts +0 -0
- package/subscriptions/subscriptions.js +118 -0
- package/{dist/es2015/subscriptions → subscriptions}/summaries.d.ts +0 -0
- package/subscriptions/summaries.js +25 -0
- package/{dist/es2015/subscriptions → subscriptions}/tenantConfiguration.d.ts +0 -0
- package/subscriptions/tenantConfiguration.js +47 -0
- package/{dist/es2015/teams → teams}/index.d.ts +0 -0
- package/teams/index.js +445 -0
- package/{dist/es2015/teams → teams}/interfaces.d.ts +0 -0
- package/teams/interfaces.js +1 -0
- package/teams/package.json +6 -0
- package/{dist/es2015/tenants → tenants}/index.d.ts +0 -0
- package/tenants/index.js +91 -0
- package/{dist/es2015/tenants → tenants}/interfaces.d.ts +0 -0
- package/tenants/interfaces.js +1 -0
- package/tenants/package.json +6 -0
- package/{dist/es2015/vendor → vendor}/index.d.ts +0 -0
- package/vendor/index.js +27 -0
- package/{dist/es2015/vendor → vendor}/interfaces.d.ts +0 -0
- package/vendor/interfaces.js +1 -0
- package/vendor/package.json +6 -0
- package/CHANGELOG.md +0 -211
- package/README.md +0 -139
- package/SECURITY.md +0 -13
- package/dist/ContextHolder.js +0 -69
- package/dist/ContextHolder.js.map +0 -1
- package/dist/account-settings/index.js +0 -33
- package/dist/account-settings/index.js.map +0 -1
- package/dist/account-settings/interfaces.js +0 -3
- package/dist/account-settings/interfaces.js.map +0 -1
- package/dist/audits/index.js +0 -59
- package/dist/audits/index.js.map +0 -1
- package/dist/audits/interfaces.js +0 -3
- package/dist/audits/interfaces.js.map +0 -1
- package/dist/auth/enums.js +0 -19
- package/dist/auth/enums.js.map +0 -1
- package/dist/auth/index.js +0 -1042
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/interfaces.js +0 -29
- package/dist/auth/interfaces.js.map +0 -1
- package/dist/auth/secutiry-poilicy/index.js +0 -134
- package/dist/auth/secutiry-poilicy/index.js.map +0 -1
- package/dist/auth/secutiry-poilicy/interfaces.js +0 -3
- package/dist/auth/secutiry-poilicy/interfaces.js.map +0 -1
- package/dist/connectivity/index.js +0 -158
- package/dist/connectivity/index.js.map +0 -1
- package/dist/connectivity/interfaces.js +0 -3
- package/dist/connectivity/interfaces.js.map +0 -1
- package/dist/constants.js +0 -174
- package/dist/constants.js.map +0 -1
- package/dist/error.js +0 -14
- package/dist/error.js.map +0 -1
- package/dist/es2015/ContextHolder.d.ts +0 -29
- package/dist/es2015/ContextHolder.js +0 -65
- package/dist/es2015/ContextHolder.js.map +0 -1
- package/dist/es2015/account-settings/index.d.ts +0 -7
- package/dist/es2015/account-settings/index.js +0 -28
- package/dist/es2015/account-settings/index.js.map +0 -1
- package/dist/es2015/account-settings/interfaces.d.ts +0 -9
- package/dist/es2015/account-settings/interfaces.js +0 -2
- package/dist/es2015/account-settings/interfaces.js.map +0 -1
- package/dist/es2015/audits/index.d.ts +0 -16
- package/dist/es2015/audits/index.js +0 -53
- package/dist/es2015/audits/index.js.map +0 -1
- package/dist/es2015/audits/interfaces.d.ts +0 -61
- package/dist/es2015/audits/interfaces.js +0 -2
- package/dist/es2015/audits/interfaces.js.map +0 -1
- package/dist/es2015/auth/enums.d.ts +0 -13
- package/dist/es2015/auth/enums.js +0 -16
- package/dist/es2015/auth/enums.js.map +0 -1
- package/dist/es2015/auth/index.d.ts +0 -447
- package/dist/es2015/auth/index.js +0 -943
- package/dist/es2015/auth/index.js.map +0 -1
- package/dist/es2015/auth/interfaces.d.ts +0 -430
- package/dist/es2015/auth/interfaces.js +0 -16
- package/dist/es2015/auth/interfaces.js.map +0 -1
- package/dist/es2015/auth/secutiry-poilicy/index.d.ts +0 -41
- package/dist/es2015/auth/secutiry-poilicy/index.js +0 -121
- package/dist/es2015/auth/secutiry-poilicy/index.js.map +0 -1
- package/dist/es2015/auth/secutiry-poilicy/interfaces.d.ts +0 -70
- package/dist/es2015/auth/secutiry-poilicy/interfaces.js +0 -2
- package/dist/es2015/auth/secutiry-poilicy/interfaces.js.map +0 -1
- package/dist/es2015/connectivity/index.d.ts +0 -27
- package/dist/es2015/connectivity/index.js +0 -129
- package/dist/es2015/connectivity/index.js.map +0 -1
- package/dist/es2015/connectivity/interfaces.d.ts +0 -95
- package/dist/es2015/connectivity/interfaces.js +0 -2
- package/dist/es2015/connectivity/interfaces.js.map +0 -1
- package/dist/es2015/constants.d.ts +0 -170
- package/dist/es2015/constants.js +0 -171
- package/dist/es2015/constants.js.map +0 -1
- package/dist/es2015/error.d.ts +0 -5
- package/dist/es2015/error.js +0 -10
- package/dist/es2015/error.js.map +0 -1
- package/dist/es2015/fetch.d.ts +0 -19
- package/dist/es2015/fetch.js +0 -177
- package/dist/es2015/fetch.js.map +0 -1
- package/dist/es2015/index.js.map +0 -1
- package/dist/es2015/interfaces.js +0 -2
- package/dist/es2015/interfaces.js.map +0 -1
- package/dist/es2015/jwt.js +0 -83
- package/dist/es2015/jwt.js.map +0 -1
- package/dist/es2015/metadata/index.js +0 -32
- package/dist/es2015/metadata/index.js.map +0 -1
- package/dist/es2015/metadata/interfaces.js +0 -2
- package/dist/es2015/metadata/interfaces.js.map +0 -1
- package/dist/es2015/notifications/index.js +0 -49
- package/dist/es2015/notifications/index.js.map +0 -1
- package/dist/es2015/notifications/interfaces.js +0 -2
- package/dist/es2015/notifications/interfaces.js.map +0 -1
- package/dist/es2015/reports/index.js +0 -118
- package/dist/es2015/reports/index.js.map +0 -1
- package/dist/es2015/reports/interfaces.js +0 -2
- package/dist/es2015/reports/interfaces.js.map +0 -1
- package/dist/es2015/roles/index.js +0 -99
- package/dist/es2015/roles/index.js.map +0 -1
- package/dist/es2015/roles/interfaces.js +0 -2
- package/dist/es2015/roles/interfaces.js.map +0 -1
- package/dist/es2015/routers.js +0 -17
- package/dist/es2015/routers.js.map +0 -1
- package/dist/es2015/sub-tenants/index.js +0 -42
- package/dist/es2015/sub-tenants/index.js.map +0 -1
- package/dist/es2015/sub-tenants/interfaces.js +0 -2
- package/dist/es2015/sub-tenants/interfaces.js.map +0 -1
- package/dist/es2015/subscriptions/enums.js +0 -23
- package/dist/es2015/subscriptions/enums.js.map +0 -1
- package/dist/es2015/subscriptions/index.js +0 -11
- package/dist/es2015/subscriptions/index.js.map +0 -1
- package/dist/es2015/subscriptions/interfaces.js.map +0 -1
- package/dist/es2015/subscriptions/invoices.js +0 -43
- package/dist/es2015/subscriptions/invoices.js.map +0 -1
- package/dist/es2015/subscriptions/managedSubscriptions.js +0 -51
- package/dist/es2015/subscriptions/managedSubscriptions.js.map +0 -1
- package/dist/es2015/subscriptions/paymentMethods.js +0 -55
- package/dist/es2015/subscriptions/paymentMethods.js.map +0 -1
- package/dist/es2015/subscriptions/paymentProviders.js +0 -21
- package/dist/es2015/subscriptions/paymentProviders.js.map +0 -1
- package/dist/es2015/subscriptions/plans.js +0 -30
- package/dist/es2015/subscriptions/plans.js.map +0 -1
- package/dist/es2015/subscriptions/providers/index.js +0 -2
- package/dist/es2015/subscriptions/providers/index.js.map +0 -1
- package/dist/es2015/subscriptions/providers/stripe/index.js +0 -57
- package/dist/es2015/subscriptions/providers/stripe/index.js.map +0 -1
- package/dist/es2015/subscriptions/providers/stripe/interfaces.js +0 -2
- package/dist/es2015/subscriptions/providers/stripe/interfaces.js.map +0 -1
- package/dist/es2015/subscriptions/subscriptions.js +0 -57
- package/dist/es2015/subscriptions/subscriptions.js.map +0 -1
- package/dist/es2015/subscriptions/summaries.js +0 -21
- package/dist/es2015/subscriptions/summaries.js.map +0 -1
- package/dist/es2015/subscriptions/tenantConfiguration.js +0 -24
- package/dist/es2015/subscriptions/tenantConfiguration.js.map +0 -1
- package/dist/es2015/teams/index.js +0 -228
- package/dist/es2015/teams/index.js.map +0 -1
- package/dist/es2015/teams/interfaces.js +0 -2
- package/dist/es2015/teams/interfaces.js.map +0 -1
- package/dist/es2015/tenants/index.js +0 -57
- package/dist/es2015/tenants/index.js.map +0 -1
- package/dist/es2015/tenants/interfaces.js +0 -2
- package/dist/es2015/tenants/interfaces.js.map +0 -1
- package/dist/es2015/vendor/index.js +0 -23
- package/dist/es2015/vendor/index.js.map +0 -1
- package/dist/es2015/vendor/interfaces.js +0 -2
- package/dist/es2015/vendor/interfaces.js.map +0 -1
- package/dist/fetch.d.ts +0 -19
- package/dist/fetch.js +0 -187
- package/dist/fetch.js.map +0 -1
- package/dist/index.d.ts +0 -83
- package/dist/index.js +0 -98
- package/dist/index.js.map +0 -1
- package/dist/interfaces.d.ts +0 -40
- package/dist/interfaces.js +0 -3
- package/dist/interfaces.js.map +0 -1
- package/dist/jwt.d.ts +0 -13
- package/dist/jwt.js +0 -89
- package/dist/jwt.js.map +0 -1
- package/dist/metadata/index.d.ts +0 -5
- package/dist/metadata/index.js +0 -39
- package/dist/metadata/index.js.map +0 -1
- package/dist/metadata/interfaces.d.ts +0 -46
- package/dist/metadata/interfaces.js +0 -3
- package/dist/metadata/interfaces.js.map +0 -1
- package/dist/notifications/index.d.ts +0 -17
- package/dist/notifications/index.js +0 -56
- package/dist/notifications/index.js.map +0 -1
- package/dist/notifications/interfaces.d.ts +0 -40
- package/dist/notifications/interfaces.js +0 -3
- package/dist/notifications/interfaces.js.map +0 -1
- package/dist/reports/index.d.ts +0 -45
- package/dist/reports/index.js +0 -127
- package/dist/reports/index.js.map +0 -1
- package/dist/reports/interfaces.d.ts +0 -146
- package/dist/reports/interfaces.js +0 -3
- package/dist/reports/interfaces.js.map +0 -1
- package/dist/roles/index.d.ts +0 -34
- package/dist/roles/index.js +0 -110
- package/dist/roles/index.js.map +0 -1
- package/dist/roles/interfaces.d.ts +0 -58
- package/dist/roles/interfaces.js +0 -3
- package/dist/roles/interfaces.js.map +0 -1
- package/dist/routers.d.ts +0 -2
- package/dist/routers.js +0 -20
- package/dist/routers.js.map +0 -1
- package/dist/sub-tenants/index.d.ts +0 -8
- package/dist/sub-tenants/index.js +0 -51
- package/dist/sub-tenants/index.js.map +0 -1
- package/dist/sub-tenants/interfaces.d.ts +0 -87
- package/dist/sub-tenants/interfaces.js +0 -3
- package/dist/sub-tenants/interfaces.js.map +0 -1
- package/dist/subscriptions/enums.d.ts +0 -18
- package/dist/subscriptions/enums.js +0 -26
- package/dist/subscriptions/enums.js.map +0 -1
- package/dist/subscriptions/index.js +0 -23
- package/dist/subscriptions/index.js.map +0 -1
- package/dist/subscriptions/interfaces.d.ts +0 -117
- package/dist/subscriptions/interfaces.js +0 -14
- package/dist/subscriptions/interfaces.js.map +0 -1
- package/dist/subscriptions/invoices.d.ts +0 -13
- package/dist/subscriptions/invoices.js +0 -49
- package/dist/subscriptions/invoices.js.map +0 -1
- package/dist/subscriptions/managedSubscriptions.d.ts +0 -15
- package/dist/subscriptions/managedSubscriptions.js +0 -59
- package/dist/subscriptions/managedSubscriptions.js.map +0 -1
- package/dist/subscriptions/paymentMethods.d.ts +0 -13
- package/dist/subscriptions/paymentMethods.js +0 -61
- package/dist/subscriptions/paymentMethods.js.map +0 -1
- package/dist/subscriptions/paymentProviders.d.ts +0 -5
- package/dist/subscriptions/paymentProviders.js +0 -25
- package/dist/subscriptions/paymentProviders.js.map +0 -1
- package/dist/subscriptions/plans.d.ts +0 -9
- package/dist/subscriptions/plans.js +0 -35
- package/dist/subscriptions/plans.js.map +0 -1
- package/dist/subscriptions/providers/index.d.ts +0 -1
- package/dist/subscriptions/providers/index.js +0 -14
- package/dist/subscriptions/providers/index.js.map +0 -1
- package/dist/subscriptions/providers/stripe/index.d.ts +0 -21
- package/dist/subscriptions/providers/stripe/index.js +0 -65
- package/dist/subscriptions/providers/stripe/index.js.map +0 -1
- package/dist/subscriptions/providers/stripe/interfaces.d.ts +0 -32
- package/dist/subscriptions/providers/stripe/interfaces.js +0 -3
- package/dist/subscriptions/providers/stripe/interfaces.js.map +0 -1
- package/dist/subscriptions/subscriptions.d.ts +0 -21
- package/dist/subscriptions/subscriptions.js +0 -65
- package/dist/subscriptions/subscriptions.js.map +0 -1
- package/dist/subscriptions/summaries.d.ts +0 -5
- package/dist/subscriptions/summaries.js +0 -25
- package/dist/subscriptions/summaries.js.map +0 -1
- package/dist/subscriptions/tenantConfiguration.d.ts +0 -3
- package/dist/subscriptions/tenantConfiguration.js +0 -29
- package/dist/subscriptions/tenantConfiguration.js.map +0 -1
- package/dist/teams/index.d.ts +0 -116
- package/dist/teams/index.js +0 -250
- package/dist/teams/index.js.map +0 -1
- package/dist/teams/interfaces.d.ts +0 -136
- package/dist/teams/interfaces.js +0 -3
- package/dist/teams/interfaces.js.map +0 -1
- package/dist/tenants/index.d.ts +0 -26
- package/dist/tenants/index.js +0 -64
- package/dist/tenants/index.js.map +0 -1
- package/dist/tenants/interfaces.d.ts +0 -30
- package/dist/tenants/interfaces.js +0 -3
- package/dist/tenants/interfaces.js.map +0 -1
- package/dist/umd/index.js +0 -2891
- package/dist/vendor/index.d.ts +0 -6
- package/dist/vendor/index.js +0 -27
- package/dist/vendor/index.js.map +0 -1
- package/dist/vendor/interfaces.d.ts +0 -6
- package/dist/vendor/interfaces.js +0 -3
- package/dist/vendor/interfaces.js.map +0 -1
- package/src/ContextHolder.ts +0 -81
- package/src/account-settings/index.ts +0 -18
- package/src/account-settings/interfaces.ts +0 -10
- package/src/audits/index.ts +0 -35
- package/src/audits/interfaces.ts +0 -70
- package/src/auth/enums.ts +0 -17
- package/src/auth/index.ts +0 -935
- package/src/auth/interfaces.ts +0 -488
- package/src/auth/secutiry-poilicy/index.ts +0 -109
- package/src/auth/secutiry-poilicy/interfaces.ts +0 -81
- package/src/connectivity/index.ts +0 -160
- package/src/connectivity/interfaces.ts +0 -106
- package/src/error.ts +0 -13
- package/src/fetch.ts +0 -220
- package/src/index.ts +0 -86
- package/src/interfaces.ts +0 -47
- package/src/jwt.ts +0 -92
- package/src/metadata/index.ts +0 -24
- package/src/metadata/interfaces.ts +0 -51
- package/src/notifications/index.ts +0 -40
- package/src/notifications/interfaces.ts +0 -45
- package/src/reports/index.ts +0 -116
- package/src/reports/interfaces.ts +0 -167
- package/src/roles/index.ts +0 -80
- package/src/roles/interfaces.ts +0 -64
- package/src/routers.ts +0 -18
- package/src/sub-tenants/index.ts +0 -49
- package/src/sub-tenants/interfaces.ts +0 -100
- package/src/subscriptions/enums.ts +0 -22
- package/src/subscriptions/index.ts +0 -10
- package/src/subscriptions/interfaces.ts +0 -144
- package/src/subscriptions/invoices.ts +0 -42
- package/src/subscriptions/managedSubscriptions.ts +0 -53
- package/src/subscriptions/paymentMethods.ts +0 -47
- package/src/subscriptions/paymentProviders.ts +0 -13
- package/src/subscriptions/plans.ts +0 -19
- package/src/subscriptions/providers/index.ts +0 -1
- package/src/subscriptions/providers/stripe/index.ts +0 -56
- package/src/subscriptions/providers/stripe/interfaces.ts +0 -39
- package/src/subscriptions/subscriptions.ts +0 -63
- package/src/subscriptions/summaries.ts +0 -11
- package/src/subscriptions/tenantConfiguration.ts +0 -23
- package/src/teams/index.ts +0 -224
- package/src/teams/interfaces.ts +0 -163
- package/src/tenants/index.ts +0 -46
- package/src/tenants/interfaces.ts +0 -33
- package/src/vendor/index.ts +0 -12
- package/src/vendor/interfaces.ts +0 -6
- package/yarn-error.log +0 -518
package/dist/umd/index.js
DELETED
|
@@ -1,2891 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FronteggRestApi = {}));
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/*! *****************************************************************************
|
|
8
|
-
Copyright (c) Microsoft Corporation.
|
|
9
|
-
|
|
10
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
11
|
-
purpose with or without fee is hereby granted.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
17
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
18
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
20
|
-
***************************************************************************** */
|
|
21
|
-
|
|
22
|
-
function __rest(s, e) {
|
|
23
|
-
var t = {};
|
|
24
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
25
|
-
t[p] = s[p];
|
|
26
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
27
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
28
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
29
|
-
t[p[i]] = s[p[i]];
|
|
30
|
-
}
|
|
31
|
-
return t;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
35
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
36
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
37
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
38
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
39
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
40
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
class ContextHolder {
|
|
45
|
-
constructor() {
|
|
46
|
-
this.context = null;
|
|
47
|
-
this.accessToken = null;
|
|
48
|
-
this.user = null;
|
|
49
|
-
this.onRedirectTo = (path) => (window.location.href = path);
|
|
50
|
-
this.logout = () => (window.location.href = '/account/logout');
|
|
51
|
-
}
|
|
52
|
-
static getInstance() {
|
|
53
|
-
if (!ContextHolder.instance) {
|
|
54
|
-
ContextHolder.instance = new ContextHolder();
|
|
55
|
-
}
|
|
56
|
-
return ContextHolder.instance;
|
|
57
|
-
}
|
|
58
|
-
static setContext(context) {
|
|
59
|
-
ContextHolder.getInstance().context = context;
|
|
60
|
-
}
|
|
61
|
-
static setAccessToken(accessToken) {
|
|
62
|
-
ContextHolder.getInstance().accessToken = accessToken;
|
|
63
|
-
}
|
|
64
|
-
static setUser(user) {
|
|
65
|
-
ContextHolder.getInstance().user = user;
|
|
66
|
-
}
|
|
67
|
-
static setOnRedirectTo(onRedirectTo) {
|
|
68
|
-
ContextHolder.getInstance().onRedirectTo = onRedirectTo;
|
|
69
|
-
}
|
|
70
|
-
static setLogout(logout, logoutUrl) {
|
|
71
|
-
ContextHolder.getInstance().logout = (callback) => {
|
|
72
|
-
if (!callback) {
|
|
73
|
-
ContextHolder.onRedirectTo(logoutUrl);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
logout(callback);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
static getContext() {
|
|
81
|
-
var _a;
|
|
82
|
-
return ((_a = ContextHolder.getInstance().context) !== null && _a !== void 0 ? _a : {
|
|
83
|
-
baseUrl: window.location.href,
|
|
84
|
-
tokenResolver: () => 'my-authentication-token',
|
|
85
|
-
logLevel: 'error',
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
static getAccessToken() {
|
|
89
|
-
return ContextHolder.getInstance().accessToken;
|
|
90
|
-
}
|
|
91
|
-
static getUser() {
|
|
92
|
-
return ContextHolder.getInstance().user;
|
|
93
|
-
}
|
|
94
|
-
static onRedirectTo(path, opts) {
|
|
95
|
-
return ContextHolder.getInstance().onRedirectTo(path, opts);
|
|
96
|
-
}
|
|
97
|
-
static logout(callback) {
|
|
98
|
-
return ContextHolder.getInstance().logout(callback);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
const FronteggContext = {
|
|
102
|
-
getContext: () => ContextHolder.getContext(),
|
|
103
|
-
getAccessToken: () => ContextHolder.getAccessToken(),
|
|
104
|
-
getUser: () => ContextHolder.getUser(),
|
|
105
|
-
onRedirectTo: (path, opts) => ContextHolder.onRedirectTo(path, opts),
|
|
106
|
-
logout: (callback) => ContextHolder.logout(callback),
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
class FronteggApiError extends Error {
|
|
110
|
-
constructor(message, statusCode) {
|
|
111
|
-
super(message);
|
|
112
|
-
this._statusCode = statusCode;
|
|
113
|
-
}
|
|
114
|
-
get statusCode() {
|
|
115
|
-
return this._statusCode;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function getBaseUrl(context, url) {
|
|
120
|
-
let baseUrl;
|
|
121
|
-
if (typeof context.baseUrl === 'function') {
|
|
122
|
-
baseUrl = context.baseUrl(url);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
baseUrl = context.baseUrl;
|
|
126
|
-
}
|
|
127
|
-
const prefix = context.urlPrefix || 'frontegg';
|
|
128
|
-
if (!baseUrl.endsWith('/')) {
|
|
129
|
-
baseUrl += '/';
|
|
130
|
-
}
|
|
131
|
-
if (!baseUrl.endsWith(prefix)) {
|
|
132
|
-
baseUrl += prefix;
|
|
133
|
-
}
|
|
134
|
-
return baseUrl;
|
|
135
|
-
}
|
|
136
|
-
function prepareUrl(context, url, params) {
|
|
137
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
const baseUrl = getBaseUrl(context, url);
|
|
139
|
-
const paramsToSend = yield buildQueryParams(context, params);
|
|
140
|
-
let finalUrl = url.startsWith('http') ? url : `${baseUrl}${url}`;
|
|
141
|
-
const hasKeys = Object.keys(paramsToSend).length > 0;
|
|
142
|
-
if (paramsToSend && hasKeys) {
|
|
143
|
-
const urlParams = new URLSearchParams(paramsToSend);
|
|
144
|
-
finalUrl += `?${urlParams}`;
|
|
145
|
-
}
|
|
146
|
-
return finalUrl;
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function buildRequestHeaders(context, contentType) {
|
|
150
|
-
var _a;
|
|
151
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
-
const authToken = yield ((_a = context === null || context === void 0 ? void 0 : context.tokenResolver) !== null && _a !== void 0 ? _a : ContextHolder.getAccessToken)();
|
|
153
|
-
const headers = {};
|
|
154
|
-
if (authToken) {
|
|
155
|
-
headers.Authorization = `Bearer ${authToken}`;
|
|
156
|
-
}
|
|
157
|
-
if (contentType) {
|
|
158
|
-
headers['Content-Type'] = contentType;
|
|
159
|
-
}
|
|
160
|
-
for (const additionalHeader of yield getAdditionalHeaders(context)) {
|
|
161
|
-
headers[`${additionalHeader.key}`] = `${additionalHeader.value}`;
|
|
162
|
-
}
|
|
163
|
-
headers['x-frontegg-source'] = 'frontegg-react';
|
|
164
|
-
return headers;
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
function buildQueryParams(context, params) {
|
|
168
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
-
if (!params) {
|
|
170
|
-
params = {};
|
|
171
|
-
}
|
|
172
|
-
const additionalQueryParams = yield getAdditionalQueryParams(context);
|
|
173
|
-
for (const queryParam of additionalQueryParams) {
|
|
174
|
-
params[queryParam.key] = queryParam.value;
|
|
175
|
-
}
|
|
176
|
-
const keys = Object.keys(params);
|
|
177
|
-
for (const key of keys) {
|
|
178
|
-
const value = params[key];
|
|
179
|
-
params[key] = typeof value === 'object' ? JSON.stringify(value) : value;
|
|
180
|
-
}
|
|
181
|
-
return params;
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
function getAdditionalQueryParams(context) {
|
|
185
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
-
let output = [];
|
|
187
|
-
if (context.additionalQueryParamsResolver) {
|
|
188
|
-
output = yield context.additionalQueryParamsResolver();
|
|
189
|
-
}
|
|
190
|
-
return output;
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
function getAdditionalHeaders(context) {
|
|
194
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
let output = [];
|
|
196
|
-
if (context.additionalHeadersResolver) {
|
|
197
|
-
output = yield context.additionalHeadersResolver();
|
|
198
|
-
}
|
|
199
|
-
return output;
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
const sendRequest = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
203
|
-
var _a, _b, _c, _d, _e;
|
|
204
|
-
const context = ContextHolder.getContext();
|
|
205
|
-
const headers = yield buildRequestHeaders(context, opts.contentType);
|
|
206
|
-
const url = yield prepareUrl(context, opts.url, opts.params);
|
|
207
|
-
const response = yield fetch(url, {
|
|
208
|
-
body: opts.body ? (opts.contentType === 'application/json' ? JSON.stringify(opts.body) : opts.body) : null,
|
|
209
|
-
method: (_a = opts.method) !== null && _a !== void 0 ? _a : 'GET',
|
|
210
|
-
headers: Object.assign(Object.assign({}, headers), opts.headers),
|
|
211
|
-
credentials: (_c = (_b = opts.credentials) !== null && _b !== void 0 ? _b : context.requestCredentials) !== null && _c !== void 0 ? _c : 'same-origin',
|
|
212
|
-
});
|
|
213
|
-
if (response.status === 302) {
|
|
214
|
-
window.location.href = yield response.text();
|
|
215
|
-
return new Promise(() => {
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
if (!response.ok) {
|
|
219
|
-
if (response.status === 413) {
|
|
220
|
-
throw new FronteggApiError('Error request is too large', response.status);
|
|
221
|
-
}
|
|
222
|
-
let errorMessage;
|
|
223
|
-
try {
|
|
224
|
-
errorMessage = yield response.text();
|
|
225
|
-
errorMessage = JSON.parse(errorMessage);
|
|
226
|
-
}
|
|
227
|
-
catch (e) {
|
|
228
|
-
}
|
|
229
|
-
if (errorMessage.errors) {
|
|
230
|
-
errorMessage = errorMessage.errors.join(', ');
|
|
231
|
-
}
|
|
232
|
-
else if (typeof errorMessage !== 'string') {
|
|
233
|
-
errorMessage = `Error ${response.status} - ${response.statusText}`;
|
|
234
|
-
}
|
|
235
|
-
if (response.status >= 400 && response.status < 500 && ['warn'].includes((_d = context.logLevel) !== null && _d !== void 0 ? _d : ''))
|
|
236
|
-
console.warn(errorMessage);
|
|
237
|
-
else if (response.status === 500 && ['warn', 'error'].includes((_e = context.logLevel) !== null && _e !== void 0 ? _e : ''))
|
|
238
|
-
console.error(errorMessage);
|
|
239
|
-
throw new FronteggApiError(errorMessage, response.status);
|
|
240
|
-
}
|
|
241
|
-
if (!opts.responseType || opts.responseType === 'json') {
|
|
242
|
-
try {
|
|
243
|
-
return yield response.json();
|
|
244
|
-
}
|
|
245
|
-
catch (e) {
|
|
246
|
-
return {};
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
else if (opts.responseType === 'blob') {
|
|
250
|
-
const { outputFileName } = opts.params;
|
|
251
|
-
return yield response
|
|
252
|
-
.blob()
|
|
253
|
-
.then((blob) => URL.createObjectURL(blob))
|
|
254
|
-
.then((url) => {
|
|
255
|
-
const tempLink = document.createElement('a');
|
|
256
|
-
tempLink.href = url;
|
|
257
|
-
tempLink.setAttribute('download', outputFileName || 'output');
|
|
258
|
-
tempLink.click();
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
return yield response.text();
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
const Get = (url, params, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
266
|
-
return sendRequest(Object.assign({ url, method: 'GET', contentType: 'application/json', params }, opts));
|
|
267
|
-
});
|
|
268
|
-
const Post = (url, body, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
269
|
-
return sendRequest(Object.assign({ url, method: 'POST', contentType: 'application/json', body }, opts));
|
|
270
|
-
});
|
|
271
|
-
const Patch = (url, body, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
272
|
-
return sendRequest(Object.assign({ url, method: 'PATCH', contentType: 'application/json', body }, opts));
|
|
273
|
-
});
|
|
274
|
-
const Put = (url, body, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
275
|
-
return sendRequest(Object.assign({ url, method: 'PUT', contentType: 'application/json', body }, opts));
|
|
276
|
-
});
|
|
277
|
-
const Delete = (url, body, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
278
|
-
return sendRequest(Object.assign({ url, method: 'DELETE', contentType: 'application/json', body }, opts));
|
|
279
|
-
});
|
|
280
|
-
const PostDownload = (url, body, params, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
281
|
-
return sendRequest(Object.assign({ url, method: 'POST', contentType: 'application/json', responseType: 'blob', body,
|
|
282
|
-
params }, opts));
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
var fetch$1 = /*#__PURE__*/Object.freeze({
|
|
286
|
-
__proto__: null,
|
|
287
|
-
getBaseUrl: getBaseUrl,
|
|
288
|
-
Get: Get,
|
|
289
|
-
Post: Post,
|
|
290
|
-
Patch: Patch,
|
|
291
|
-
Put: Put,
|
|
292
|
-
Delete: Delete,
|
|
293
|
-
PostDownload: PostDownload
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
const urls = {
|
|
297
|
-
vendor: '/vendors',
|
|
298
|
-
identity: {
|
|
299
|
-
webAuthnDevices: {
|
|
300
|
-
v1: '/identity/resources/users/webauthn/v1/devices',
|
|
301
|
-
},
|
|
302
|
-
auth: {
|
|
303
|
-
v1: '/identity/resources/auth/v1',
|
|
304
|
-
v2: '/identity/resources/auth/v2'
|
|
305
|
-
},
|
|
306
|
-
users: {
|
|
307
|
-
v1: '/identity/resources/users/v1',
|
|
308
|
-
v2: '/identity/resources/users/v2',
|
|
309
|
-
apiTokens: {
|
|
310
|
-
v1: '/identity/resources/users/api-tokens/v1',
|
|
311
|
-
},
|
|
312
|
-
sessions: {
|
|
313
|
-
currentUser: {
|
|
314
|
-
v1: '/identity/resources/users/sessions/v1/me',
|
|
315
|
-
},
|
|
316
|
-
configurations: {
|
|
317
|
-
v1: '/identity/resources/configurations/sessions/v1'
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
invitation: {
|
|
321
|
-
resendAll: {
|
|
322
|
-
v1: '/identity/resources/users/v1/invitation/reset/all',
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
configurations: {
|
|
327
|
-
v1: '/identity/resources/configurations/v1'
|
|
328
|
-
},
|
|
329
|
-
sso: {
|
|
330
|
-
v1: '/identity/resources/sso/v1',
|
|
331
|
-
v2: '/identity/resources/sso/v2'
|
|
332
|
-
},
|
|
333
|
-
permissions: {
|
|
334
|
-
v1: '/identity/resources/permissions/v1'
|
|
335
|
-
},
|
|
336
|
-
tenants: {
|
|
337
|
-
apiTokens: {
|
|
338
|
-
v1: '/identity/resources/tenants/api-tokens/v1',
|
|
339
|
-
v2: '/identity/resources/tenants/api-tokens/v2'
|
|
340
|
-
},
|
|
341
|
-
invites: {
|
|
342
|
-
user: {
|
|
343
|
-
v1: '/identity/resources/tenants/invites/v1/user'
|
|
344
|
-
},
|
|
345
|
-
verify: {
|
|
346
|
-
v1: '/identity/resources/tenants/invites/v1/verify'
|
|
347
|
-
},
|
|
348
|
-
configuration: {
|
|
349
|
-
v1: '/identity/resources/tenants/invites/v1/configuration'
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
roles: {
|
|
354
|
-
v1: '/identity/resources/roles/v1'
|
|
355
|
-
},
|
|
356
|
-
subTenants: {
|
|
357
|
-
v1: '/identity/resources/sub-tenants/users/v1'
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
team: {
|
|
361
|
-
sso: {
|
|
362
|
-
v1: '/team/resources/sso/v1',
|
|
363
|
-
v2: '/team/resources/sso/v2',
|
|
364
|
-
},
|
|
365
|
-
members: {
|
|
366
|
-
v1: '/team/resources/members/v1'
|
|
367
|
-
},
|
|
368
|
-
roles: {
|
|
369
|
-
v1: '/team/resources/roles/v1'
|
|
370
|
-
},
|
|
371
|
-
stats: {
|
|
372
|
-
v1: '/team/resources/stats/v1'
|
|
373
|
-
},
|
|
374
|
-
profile: {
|
|
375
|
-
v1: '/team/resources/profile' // no versioning in backend
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
tenants: {
|
|
379
|
-
accountSettings: {
|
|
380
|
-
v1: '/tenants/resources/account-settings/v1'
|
|
381
|
-
},
|
|
382
|
-
hierarchy: {
|
|
383
|
-
v1: '/tenants/resources/hierarchy/v1',
|
|
384
|
-
tree: {
|
|
385
|
-
v1: '/tenants/resources/hierarchy/v1/tree'
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
},
|
|
389
|
-
integrations: {
|
|
390
|
-
configurations: {
|
|
391
|
-
v1: '/integrations/resources/configurations/v1',
|
|
392
|
-
v2: '/integrations/resources/configurations/v2',
|
|
393
|
-
}
|
|
394
|
-
},
|
|
395
|
-
subscriptions: {
|
|
396
|
-
billing: {
|
|
397
|
-
subscriptions: {
|
|
398
|
-
v1: '/subscriptions/resources/billing/subscriptions/v1'
|
|
399
|
-
},
|
|
400
|
-
plans: {
|
|
401
|
-
v1: '/subscriptions/resources/billing/plans/v1'
|
|
402
|
-
},
|
|
403
|
-
invoices: {
|
|
404
|
-
v1: '/subscriptions/resources/billing/invoices/v1'
|
|
405
|
-
},
|
|
406
|
-
paymentMethods: {
|
|
407
|
-
v1: '/subscriptions/resources/billing/payment-methods/v1'
|
|
408
|
-
},
|
|
409
|
-
summaries: {
|
|
410
|
-
v1: '/subscriptions/resources/billing/summaries/v1'
|
|
411
|
-
},
|
|
412
|
-
tenantConfiguration: {
|
|
413
|
-
v1: '/subscriptions/resources/billing/tenant-configurations/v1'
|
|
414
|
-
},
|
|
415
|
-
paymentProviders: {
|
|
416
|
-
stripe: {
|
|
417
|
-
customers: {
|
|
418
|
-
v1: '/subscriptions/resources/billing/payment-providers/stripe/customers/v1'
|
|
419
|
-
},
|
|
420
|
-
publicConfigurations: {
|
|
421
|
-
v1: '/subscriptions/resources/billing/payment-providers/stripe/public-configurations/v1'
|
|
422
|
-
},
|
|
423
|
-
subscriptions: {
|
|
424
|
-
v1: '/subscriptions/resources/billing/payment-providers/stripe/subscriptions/v1'
|
|
425
|
-
},
|
|
426
|
-
setupIntents: {
|
|
427
|
-
v1: '/subscriptions/resources/billing/payment-providers/stripe/setup-intents/v1'
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
},
|
|
432
|
-
paymentProviders: {
|
|
433
|
-
v1: '/subscriptions/resources/payment-providers/v1'
|
|
434
|
-
},
|
|
435
|
-
managedSubscriptions: {
|
|
436
|
-
v1: '/subscriptions/resources/subscriptions/v1'
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
reports: {
|
|
440
|
-
service: {
|
|
441
|
-
v1: '/reports/resources/reports/v1',
|
|
442
|
-
v2: '/reports/resources/reports/v2'
|
|
443
|
-
},
|
|
444
|
-
trigger: {
|
|
445
|
-
v1: '/reports/engine/resources/triggers/v1'
|
|
446
|
-
}
|
|
447
|
-
},
|
|
448
|
-
notifications: {
|
|
449
|
-
v1: '/notification'
|
|
450
|
-
},
|
|
451
|
-
audits: {
|
|
452
|
-
v1: '/audits',
|
|
453
|
-
},
|
|
454
|
-
events: {
|
|
455
|
-
configurations: {
|
|
456
|
-
v1: '/event/resources/configurations/v1'
|
|
457
|
-
}
|
|
458
|
-
},
|
|
459
|
-
webhooks: {
|
|
460
|
-
v1: '/webhook'
|
|
461
|
-
},
|
|
462
|
-
oauth: {
|
|
463
|
-
v1: '/oauth'
|
|
464
|
-
},
|
|
465
|
-
};
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* switch logged in user to specific tenant by providing tenantId.
|
|
469
|
-
*
|
|
470
|
-
* @throws exception if invalid tenantId.
|
|
471
|
-
* ``authorized user``
|
|
472
|
-
*/
|
|
473
|
-
function switchTenant(body) {
|
|
474
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
475
|
-
console.debug('switchTenant()', body);
|
|
476
|
-
return Put(`${urls.identity.users.v1}/tenant`, body);
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* retrieve logged in user's available tenants.
|
|
481
|
-
*
|
|
482
|
-
* ``authorized user``
|
|
483
|
-
*/
|
|
484
|
-
function getTenants() {
|
|
485
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
486
|
-
console.debug('getTenants()');
|
|
487
|
-
return Get(`${urls.identity.users.v2}/me/tenants`);
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* retrieve logged in user's available sub tenants.
|
|
492
|
-
*
|
|
493
|
-
* ``authorized user``
|
|
494
|
-
*/
|
|
495
|
-
function getSubTenants() {
|
|
496
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
497
|
-
console.debug('getSubTenants()');
|
|
498
|
-
return Get(urls.tenants.hierarchy.v1);
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* retrieve logged in user's available sub tenants as a tree.
|
|
503
|
-
*
|
|
504
|
-
* ``authorized user``
|
|
505
|
-
*/
|
|
506
|
-
function getSubTenantsAsTree() {
|
|
507
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
508
|
-
console.debug('getSubTenantsAsTree()');
|
|
509
|
-
return Get(urls.tenants.hierarchy.tree.v1);
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
var tenants = /*#__PURE__*/Object.freeze({
|
|
514
|
-
__proto__: null,
|
|
515
|
-
switchTenant: switchTenant,
|
|
516
|
-
getTenants: getTenants,
|
|
517
|
-
getSubTenants: getSubTenants,
|
|
518
|
-
getSubTenantsAsTree: getSubTenantsAsTree
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Get global secure access configuration
|
|
523
|
-
*/
|
|
524
|
-
function getGlobalSecurityPolicy() {
|
|
525
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
526
|
-
console.debug('getGlobalSecurityPolicy()');
|
|
527
|
-
return Get(urls.identity.configurations.v1);
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* Get Mfa configuration from security policy
|
|
532
|
-
*/
|
|
533
|
-
function getMfaPolicy() {
|
|
534
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
535
|
-
console.debug('getMfaPolicy()');
|
|
536
|
-
return Get(`${urls.identity.configurations.v1}/mfa-policy`);
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* Get Mfa configuration from security policy
|
|
541
|
-
*/
|
|
542
|
-
function getVendorMfaPolicy() {
|
|
543
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
544
|
-
console.debug('getVendorMfaPolicy()');
|
|
545
|
-
return Get(`${urls.identity.configurations.v1}/mfa-policy/vendor`);
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Create/Update Mfa configuration from security policy
|
|
550
|
-
*/
|
|
551
|
-
function saveMfaPolicy(body) {
|
|
552
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
553
|
-
console.debug('saveMfaPolicy()');
|
|
554
|
-
if (body.id) {
|
|
555
|
-
return Patch(`${urls.identity.configurations.v1}/mfa-policy`, body);
|
|
556
|
-
}
|
|
557
|
-
else {
|
|
558
|
-
return Post(`${urls.identity.configurations.v1}/mfa-policy`, body);
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
/**
|
|
563
|
-
* Get Lockout configuration from security policy
|
|
564
|
-
*/
|
|
565
|
-
function getLockoutPolicy() {
|
|
566
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
567
|
-
console.debug('getLockoutPolicy()');
|
|
568
|
-
return Get(`${urls.identity.configurations.v1}/lockout-policy`);
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* Create/Update Lockout configuration from security policy
|
|
573
|
-
*/
|
|
574
|
-
function saveLockoutPolicy(body) {
|
|
575
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
576
|
-
console.debug('saveLockoutPolicy()');
|
|
577
|
-
if (body.id) {
|
|
578
|
-
return Patch(`${urls.identity.configurations.v1}/lockout-policy`, body);
|
|
579
|
-
}
|
|
580
|
-
else {
|
|
581
|
-
return Post(`${urls.identity.configurations.v1}/lockout-policy`, body);
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* Get Captcha configuration from security policy
|
|
587
|
-
*/
|
|
588
|
-
function getCaptchaPolicy() {
|
|
589
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
590
|
-
try {
|
|
591
|
-
return yield Get(`${urls.identity.configurations.v1}/captcha-policy/public`);
|
|
592
|
-
}
|
|
593
|
-
catch (_a) {
|
|
594
|
-
return null;
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* Get Password History configuration from security policy
|
|
600
|
-
*/
|
|
601
|
-
function getPasswordHistoryPolicy() {
|
|
602
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
603
|
-
console.debug('getPasswordHistoryPolicy()');
|
|
604
|
-
return Get(`${urls.identity.configurations.v1}/password-history-policy`);
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Create/Update Password History configuration from security policy
|
|
609
|
-
*/
|
|
610
|
-
function savePasswordHistoryPolicy(body) {
|
|
611
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
612
|
-
console.debug('savePasswordHistoryPolicy()');
|
|
613
|
-
if (body.id) {
|
|
614
|
-
return Patch(`${urls.identity.configurations.v1}/password-history-policy`, body);
|
|
615
|
-
}
|
|
616
|
-
else {
|
|
617
|
-
return Post(`${urls.identity.configurations.v1}/password-history-policy`, body);
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
/**
|
|
622
|
-
* load vendor password configuration.
|
|
623
|
-
*/
|
|
624
|
-
function getPasswordConfigPolicy() {
|
|
625
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
626
|
-
console.debug('getPasswordConfigPolicy()');
|
|
627
|
-
return Get(`${urls.identity.configurations.v1}/password`);
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
exports.SocialLoginProviders = void 0;
|
|
632
|
-
(function (SocialLoginProviders) {
|
|
633
|
-
SocialLoginProviders["Microsoft"] = "microsoft";
|
|
634
|
-
SocialLoginProviders["Facebook"] = "facebook";
|
|
635
|
-
SocialLoginProviders["Google"] = "google";
|
|
636
|
-
SocialLoginProviders["Github"] = "github";
|
|
637
|
-
})(exports.SocialLoginProviders || (exports.SocialLoginProviders = {}));
|
|
638
|
-
exports.AuthStrategyEnum = void 0;
|
|
639
|
-
(function (AuthStrategyEnum) {
|
|
640
|
-
AuthStrategyEnum["EmailAndPassword"] = "EmailAndPassword";
|
|
641
|
-
AuthStrategyEnum["MagicLink"] = "MagicLink";
|
|
642
|
-
AuthStrategyEnum["Code"] = "Code";
|
|
643
|
-
AuthStrategyEnum["NoLocalAuthentication"] = "NoLocalAuthentication";
|
|
644
|
-
AuthStrategyEnum["SmsCode"] = "SmsCode";
|
|
645
|
-
})(exports.AuthStrategyEnum || (exports.AuthStrategyEnum = {}));
|
|
646
|
-
|
|
647
|
-
/**
|
|
648
|
-
* The code was extracted from:
|
|
649
|
-
* https://github.com/davidchambers/Base64.js
|
|
650
|
-
*/
|
|
651
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
652
|
-
class InvalidCharacterError extends Error {
|
|
653
|
-
constructor(message) {
|
|
654
|
-
super(message);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
function polyfill(input) {
|
|
658
|
-
const str = String(input).replace(/=+$/, '');
|
|
659
|
-
if (str.length % 4 === 1) {
|
|
660
|
-
throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
661
|
-
}
|
|
662
|
-
let output = '';
|
|
663
|
-
// noinspection JSAssignmentUsedAsCondition,JSUnusedAssignment,CommaExpressionJS
|
|
664
|
-
for (
|
|
665
|
-
// initialize result and counters
|
|
666
|
-
let bc = 0, bs, buffer, idx = 0;
|
|
667
|
-
// get next character
|
|
668
|
-
// tslint:disable-next-line:no-conditional-assignment
|
|
669
|
-
(buffer = str.charAt(idx++));
|
|
670
|
-
// character found in table? initialize bit storage and add its ascii value;
|
|
671
|
-
// tslint:disable-next-line:no-conditional-assignment
|
|
672
|
-
~buffer &&
|
|
673
|
-
((bs = bc % 4 ? bs * 64 + buffer : buffer),
|
|
674
|
-
// and if not first of each 4 characters,
|
|
675
|
-
// convert the first 8 bits to one ascii character
|
|
676
|
-
bc++ % 4)
|
|
677
|
-
? (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6))))
|
|
678
|
-
: 0) {
|
|
679
|
-
// try to find character in table (0-63, not found => -1)
|
|
680
|
-
buffer = chars.indexOf(buffer);
|
|
681
|
-
}
|
|
682
|
-
return output;
|
|
683
|
-
}
|
|
684
|
-
const atob = (typeof window !== 'undefined' && window.atob && window.atob.bind(window)) || polyfill;
|
|
685
|
-
function b64DecodeUnicode(str) {
|
|
686
|
-
return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
|
|
687
|
-
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
688
|
-
if (code.length < 2) {
|
|
689
|
-
code = '0' + code;
|
|
690
|
-
}
|
|
691
|
-
return '%' + code;
|
|
692
|
-
}));
|
|
693
|
-
}
|
|
694
|
-
const base64UrlDecode = (str) => {
|
|
695
|
-
let output = str.replace(/-/g, '+').replace(/_/g, '/');
|
|
696
|
-
switch (output.length % 4) {
|
|
697
|
-
case 0:
|
|
698
|
-
break;
|
|
699
|
-
case 2:
|
|
700
|
-
output += '==';
|
|
701
|
-
break;
|
|
702
|
-
case 3:
|
|
703
|
-
output += '=';
|
|
704
|
-
break;
|
|
705
|
-
default:
|
|
706
|
-
throw new Error('Illegal base64url string!');
|
|
707
|
-
}
|
|
708
|
-
try {
|
|
709
|
-
return b64DecodeUnicode(output);
|
|
710
|
-
}
|
|
711
|
-
catch (err) {
|
|
712
|
-
return atob(output);
|
|
713
|
-
}
|
|
714
|
-
};
|
|
715
|
-
class InvalidTokenError extends Error {
|
|
716
|
-
constructor(message) {
|
|
717
|
-
super(message);
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
const jwtDecode = (token, options = {}) => {
|
|
721
|
-
const pos = !!options.header ? 0 : 1;
|
|
722
|
-
try {
|
|
723
|
-
return JSON.parse(base64UrlDecode(token.split('.')[pos]));
|
|
724
|
-
}
|
|
725
|
-
catch (e) {
|
|
726
|
-
throw new InvalidTokenError('Invalid token specified: ' + e.message);
|
|
727
|
-
}
|
|
728
|
-
};
|
|
729
|
-
|
|
730
|
-
/*****************************************
|
|
731
|
-
* Authentication
|
|
732
|
-
*****************************************/
|
|
733
|
-
function generateLoginResponse(loginResponse) {
|
|
734
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
735
|
-
if (!loginResponse.accessToken) {
|
|
736
|
-
return loginResponse;
|
|
737
|
-
}
|
|
738
|
-
ContextHolder.setAccessToken(loginResponse.accessToken);
|
|
739
|
-
const me = yield Get(`${urls.identity.users.v2}/me`);
|
|
740
|
-
const decodedContent = loginResponse.accessToken ? jwtDecode(loginResponse.accessToken) : {};
|
|
741
|
-
const user = Object.assign(Object.assign(Object.assign({}, loginResponse), decodedContent), me);
|
|
742
|
-
ContextHolder.setUser(user);
|
|
743
|
-
return user;
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
function generateLoginResponseV2(loginResponse) {
|
|
747
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
748
|
-
if (!loginResponse.accessToken) {
|
|
749
|
-
return { user: loginResponse };
|
|
750
|
-
}
|
|
751
|
-
ContextHolder.setAccessToken(loginResponse.accessToken);
|
|
752
|
-
const [me, tenants] = yield Promise.all([Get(`${urls.identity.users.v2}/me`), getTenants()]);
|
|
753
|
-
const decodedContent = loginResponse.accessToken ? jwtDecode(loginResponse.accessToken) : {};
|
|
754
|
-
const user = Object.assign(Object.assign(Object.assign({}, loginResponse), decodedContent), me);
|
|
755
|
-
ContextHolder.setUser(user);
|
|
756
|
-
return { user, tenants };
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
function generateLoginResponseFromOAuthResponse(oauthResponse) {
|
|
760
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
761
|
-
ContextHolder.setAccessToken(oauthResponse.id_token);
|
|
762
|
-
const me = yield Get(`${urls.identity.users.v2}/me`);
|
|
763
|
-
const decodedContent = oauthResponse.id_token ? jwtDecode(oauthResponse.id_token) : {};
|
|
764
|
-
const user = Object.assign(Object.assign({ mfaRequired: false, accessToken: oauthResponse.id_token, refreshToken: oauthResponse.refresh_token }, decodedContent), me);
|
|
765
|
-
ContextHolder.setUser(user);
|
|
766
|
-
return user;
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* Check if requested email address has sso configuration
|
|
771
|
-
* If true, this function will return the sso address to navigate to
|
|
772
|
-
* else, return null
|
|
773
|
-
*/
|
|
774
|
-
function preLogin(body) {
|
|
775
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
776
|
-
console.debug('preLogin()', body);
|
|
777
|
-
try {
|
|
778
|
-
const { address } = yield Post(`${urls.identity.auth.v1}/user/saml/prelogin`, body);
|
|
779
|
-
return address;
|
|
780
|
-
}
|
|
781
|
-
catch (_a) {
|
|
782
|
-
return null;
|
|
783
|
-
}
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
/**
|
|
787
|
-
* Check if requested email address has sso configuration
|
|
788
|
-
* If true, this function will return the sso address and IdpType to navigate to
|
|
789
|
-
*/
|
|
790
|
-
function preLoginWithIdpType(body) {
|
|
791
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
792
|
-
console.debug('preLoginWithIdpType()', body);
|
|
793
|
-
return Post(`${urls.identity.auth.v1}/user/saml/prelogin`, body);
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
/**
|
|
797
|
-
* After calling preLogin and navigated to SSO url, the IDP will redirect you to the ACS Url
|
|
798
|
-
* Which configured in the SSO configuraation
|
|
799
|
-
* else, return null
|
|
800
|
-
*/
|
|
801
|
-
function postLogin(body) {
|
|
802
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
803
|
-
console.debug('postLogin()');
|
|
804
|
-
const data = yield Post(`${urls.identity.auth.v1}/user/saml/postlogin`, body);
|
|
805
|
-
return generateLoginResponse(data);
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
/**
|
|
809
|
-
* After calling preLogin and navigated to SSO url, the IDP will redirect you to the redirect url
|
|
810
|
-
* with code and state
|
|
811
|
-
*/
|
|
812
|
-
function oidcPostLogin(body) {
|
|
813
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
814
|
-
console.debug('oidcPostLogin()');
|
|
815
|
-
const data = yield Post(`${urls.identity.auth.v1}/user/oidc/postlogin`, body);
|
|
816
|
-
return generateLoginResponse(data);
|
|
817
|
-
});
|
|
818
|
-
}
|
|
819
|
-
/**
|
|
820
|
-
* login with username and password.
|
|
821
|
-
* if the user has two factor authentication
|
|
822
|
-
* the server will return mfaToken with mfaRequired: true,
|
|
823
|
-
* and then ``loginWithMfa`` should be called with the mfaToken and and generated code
|
|
824
|
-
* else, the server will accessToken and refreshToken.
|
|
825
|
-
* the refresh should be used to renew your access token by calling ``refreshToken``
|
|
826
|
-
*
|
|
827
|
-
* @throw exception if login failed
|
|
828
|
-
*/
|
|
829
|
-
function login(body) {
|
|
830
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
831
|
-
console.debug('login()');
|
|
832
|
-
const data = yield Post(`${urls.identity.auth.v1}/user`, body);
|
|
833
|
-
return generateLoginResponse(data);
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* after login succeeded with mfaRequired token response, this function should be called
|
|
838
|
-
* with the mfaToken and the generated code from your authenticator app.
|
|
839
|
-
*
|
|
840
|
-
* @throw exception if generated code or mfaToken are incorrect
|
|
841
|
-
*/
|
|
842
|
-
function loginWithMfa(body) {
|
|
843
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
844
|
-
console.debug('loginWithMfa()');
|
|
845
|
-
const data = yield Post(`${urls.identity.auth.v1}/user/mfa/verify`, body);
|
|
846
|
-
return generateLoginResponse(data);
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* activating account should be called after registering new user of deactivate account
|
|
851
|
-
* ``activateAccount`` should contains userId and the token that has been sent to the user after activation requested.
|
|
852
|
-
*
|
|
853
|
-
* @throws exception if activation failed
|
|
854
|
-
*/
|
|
855
|
-
function activateAccount(body) {
|
|
856
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
857
|
-
console.debug('activateAccount()');
|
|
858
|
-
return Post(`${urls.identity.users.v1}/activate`, body);
|
|
859
|
-
});
|
|
860
|
-
}
|
|
861
|
-
/**
|
|
862
|
-
* get account activation configuration.
|
|
863
|
-
*/
|
|
864
|
-
function getActivateAccountStrategy(params) {
|
|
865
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
866
|
-
console.debug('getActivateAccountStrategy()');
|
|
867
|
-
return Get(`${urls.identity.users.v1}/activate/strategy`, params);
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
/**
|
|
871
|
-
* resend activation email should be called after a failed user activation.
|
|
872
|
-
* ``resend activation email`` should contain the user email.
|
|
873
|
-
*
|
|
874
|
-
* @throws exception if resend failed
|
|
875
|
-
*/
|
|
876
|
-
function resendActivationEmail(body) {
|
|
877
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
878
|
-
console.debug('resendActivationEmail()');
|
|
879
|
-
return Post(`${urls.identity.users.v1}/activate/reset`, body);
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* activating account should be called after registering new user of deactivate account
|
|
884
|
-
* ``activateAccount`` should contains userId and the token that has been sent to the user after activation requested.
|
|
885
|
-
*
|
|
886
|
-
* @throws exception if activation failed
|
|
887
|
-
*/
|
|
888
|
-
function acceptInvitation(body) {
|
|
889
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
890
|
-
console.debug('acceptInvitation()');
|
|
891
|
-
return Post(`${urls.identity.users.v1}/invitation/accept`, body);
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
|
-
/**
|
|
895
|
-
* refresh token called as authenticated use, access and refresh tokens resolved by the cookies.
|
|
896
|
-
* the server will return ILoginResponse with new access Token and refresh token and store it in the browser cookies.
|
|
897
|
-
*/
|
|
898
|
-
function refreshToken() {
|
|
899
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
900
|
-
console.debug('refreshToken()');
|
|
901
|
-
const data = yield Post(`${urls.identity.auth.v1}/user/token/refresh`);
|
|
902
|
-
return generateLoginResponse(data);
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* refresh token called as authenticated use, access and refresh tokens resolved by the cookies.
|
|
907
|
-
* the server will return ILoginResponseV2 with new access Token and refresh token and store it in the browser cookies, as well as the tenants.
|
|
908
|
-
*/
|
|
909
|
-
function refreshTokenV2() {
|
|
910
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
911
|
-
console.debug('refreshTokenV2()');
|
|
912
|
-
const data = yield Post(`${urls.identity.auth.v1}/user/token/refresh`);
|
|
913
|
-
return generateLoginResponseV2(data);
|
|
914
|
-
});
|
|
915
|
-
}
|
|
916
|
-
/**
|
|
917
|
-
* logout from server, invalidate access and refresh token, remove it from cookies.
|
|
918
|
-
*/
|
|
919
|
-
function logout() {
|
|
920
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
921
|
-
console.debug('logout()');
|
|
922
|
-
return Post(`${urls.identity.auth.v1}/logout`);
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
/**
|
|
926
|
-
* calling forgot password request will send email with link to reset user's password.
|
|
927
|
-
*
|
|
928
|
-
* @throws exception if the user not found
|
|
929
|
-
*/
|
|
930
|
-
function forgotPassword(body) {
|
|
931
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
932
|
-
console.debug('forgotPassword()', body);
|
|
933
|
-
return Post(`${urls.identity.users.v1}/passwords/reset`, body);
|
|
934
|
-
});
|
|
935
|
-
}
|
|
936
|
-
/**
|
|
937
|
-
* reset password should be called after forget password request.
|
|
938
|
-
* userId, new password and the token has been sent to the user email.
|
|
939
|
-
*
|
|
940
|
-
* @throws exception if the user not found, password validation failed or invalid token.
|
|
941
|
-
*/
|
|
942
|
-
function resetPassword(body) {
|
|
943
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
944
|
-
console.debug('resetPassword()');
|
|
945
|
-
return Post(`${urls.identity.users.v1}/passwords/reset/verify`, body);
|
|
946
|
-
});
|
|
947
|
-
}
|
|
948
|
-
/**
|
|
949
|
-
* load password configuration for user.
|
|
950
|
-
*/
|
|
951
|
-
function loadPasswordConfig(params) {
|
|
952
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
953
|
-
console.debug('loadPasswordConfig()');
|
|
954
|
-
return Get(`${urls.identity.users.v1}/passwords/config`, params);
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
/**
|
|
958
|
-
* recover Multi-Factor authentication by providing the recoveryCode
|
|
959
|
-
* that has been received when activated it
|
|
960
|
-
*
|
|
961
|
-
* @throws exception if recovery code is not valid
|
|
962
|
-
*/
|
|
963
|
-
function recoverMfaToken(body) {
|
|
964
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
965
|
-
console.debug('recoverMfaToken()', body);
|
|
966
|
-
return Post(`${urls.identity.auth.v1}/user/mfa/recover`, body);
|
|
967
|
-
});
|
|
968
|
-
}
|
|
969
|
-
/**
|
|
970
|
-
* Multi-Factor Settings
|
|
971
|
-
*/
|
|
972
|
-
/**
|
|
973
|
-
* enroll Multi-Factor Auth Code to use in 3rd party apps like Google Authenticator.
|
|
974
|
-
* the server returns qrCode as png image in base64 format
|
|
975
|
-
*
|
|
976
|
-
* @throws exception if the user already have mfa-enabled
|
|
977
|
-
* ``authorized user``
|
|
978
|
-
*/
|
|
979
|
-
function enrollMfa() {
|
|
980
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
981
|
-
console.debug('enrollMfa()');
|
|
982
|
-
return Post(`${urls.identity.users.v1}/mfa/enroll`);
|
|
983
|
-
});
|
|
984
|
-
}
|
|
985
|
-
/**
|
|
986
|
-
* after enrolling MFA QR code, verify function should be called
|
|
987
|
-
* with the generated code in the Authenticator App
|
|
988
|
-
*
|
|
989
|
-
* @return recoveryCode to use to disable mfa if your device is lost, this code won't show it again.
|
|
990
|
-
* @throws exception if the generated token is invalid
|
|
991
|
-
* ``authorized user``
|
|
992
|
-
*/
|
|
993
|
-
function verifyMfa(body) {
|
|
994
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
995
|
-
console.debug('verifyMfa()', body);
|
|
996
|
-
return Post(`${urls.identity.users.v1}/mfa/enroll/verify`, body);
|
|
997
|
-
});
|
|
998
|
-
}
|
|
999
|
-
/**
|
|
1000
|
-
* disable MFA by either passing the recoveryCode or the generated code from the Authenticator App.
|
|
1001
|
-
*
|
|
1002
|
-
* @throws exception if the generated token or the recoveryCode are incorrect.
|
|
1003
|
-
* * ``authorized user``
|
|
1004
|
-
*/
|
|
1005
|
-
function disableMfa(body) {
|
|
1006
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1007
|
-
console.debug('disableMfa()', body);
|
|
1008
|
-
return Post(`${urls.identity.users.v1}/mfa/disable`, body);
|
|
1009
|
-
});
|
|
1010
|
-
}
|
|
1011
|
-
/**
|
|
1012
|
-
* SSO Configurations
|
|
1013
|
-
*/
|
|
1014
|
-
/**
|
|
1015
|
-
* Retrieve SAML configurations from server by logged in user (tenantId, vendorId)
|
|
1016
|
-
*
|
|
1017
|
-
* @return {enabled: false} if no saml configuration found. else ISamlConfiguration
|
|
1018
|
-
* * ``authorized user``
|
|
1019
|
-
*/
|
|
1020
|
-
function getSamlConfiguration() {
|
|
1021
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1022
|
-
console.debug('getSamlConfiguration()');
|
|
1023
|
-
return Get(`${urls.team.sso.v1}/saml/configurations`);
|
|
1024
|
-
});
|
|
1025
|
-
}
|
|
1026
|
-
/**
|
|
1027
|
-
* Update SAML configuration by logged in user (tenantId, vendorId)
|
|
1028
|
-
* * ``authorized user``
|
|
1029
|
-
*/
|
|
1030
|
-
function updateSamlConfiguration(body) {
|
|
1031
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1032
|
-
console.debug('updateSamlConfiguration()', body);
|
|
1033
|
-
return Post(`${urls.team.sso.v1}/saml/configurations`, body);
|
|
1034
|
-
});
|
|
1035
|
-
}
|
|
1036
|
-
/**
|
|
1037
|
-
* Retrieve 'Vendor' Saml config from server by logged in user (tenantId, vendorId)
|
|
1038
|
-
*
|
|
1039
|
-
* @throws exception 'ACS url information not found' if no saml vendor configuration found.
|
|
1040
|
-
* * ``authorized user``
|
|
1041
|
-
*/
|
|
1042
|
-
function getSamlVendorConfiguration() {
|
|
1043
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1044
|
-
console.debug('getSamlVendorConfiguration()');
|
|
1045
|
-
return Get(`${urls.team.sso.v1}/saml/configurations/vendor-config`);
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
/**
|
|
1049
|
-
* Update Vendor Saml metadata by logged in user (tenantId, vendorId)
|
|
1050
|
-
*
|
|
1051
|
-
* @return {enabled: false} if no saml configuration found. else ISamlConfiguration
|
|
1052
|
-
* * ``authorized user``
|
|
1053
|
-
*/
|
|
1054
|
-
function updateSamlVendorMetadata(body) {
|
|
1055
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1056
|
-
console.debug('updateSamlVendorMetadata()', body);
|
|
1057
|
-
return Put(`${urls.team.sso.v1}/saml/configurations/metadata`, body);
|
|
1058
|
-
});
|
|
1059
|
-
}
|
|
1060
|
-
/**
|
|
1061
|
-
* Validate Saml configuration's domain by logged in user (tenantId, vendorId)
|
|
1062
|
-
*
|
|
1063
|
-
* @return {enabled: false} if no saml configuration found. else ISamlConfiguration
|
|
1064
|
-
* * ``authorized user``
|
|
1065
|
-
*/
|
|
1066
|
-
function validateSamlDomain() {
|
|
1067
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1068
|
-
console.debug('validateSamlDomain()');
|
|
1069
|
-
return Put(`${urls.team.sso.v1}/saml/validations/domain`);
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
/**
|
|
1073
|
-
* Get Saml roles for authorization
|
|
1074
|
-
* @return array of role IDs
|
|
1075
|
-
*/
|
|
1076
|
-
function getSamlRoles() {
|
|
1077
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1078
|
-
console.debug('getSamlRoles()');
|
|
1079
|
-
return Get(`${urls.team.sso.v1}/saml/configurations/roles/default`);
|
|
1080
|
-
});
|
|
1081
|
-
}
|
|
1082
|
-
/**
|
|
1083
|
-
* Get Saml roles groups
|
|
1084
|
-
* @return array of groups and assigend role IDs
|
|
1085
|
-
*/
|
|
1086
|
-
function getSamlRolesGroups() {
|
|
1087
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1088
|
-
console.debug('getSamlRoles()');
|
|
1089
|
-
return Get(`${urls.team.sso.v2}/saml/configurations/groups`);
|
|
1090
|
-
});
|
|
1091
|
-
}
|
|
1092
|
-
/**
|
|
1093
|
-
* Update Saml roles for authorization
|
|
1094
|
-
*/
|
|
1095
|
-
function updateSamlRoles({ roleIds }) {
|
|
1096
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1097
|
-
console.debug('updateSamlRoles()');
|
|
1098
|
-
return Post(`${urls.team.sso.v1}/saml/configurations/roles/default`, { roleIds });
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
1101
|
-
/**
|
|
1102
|
-
* Create Saml group roles for authorization
|
|
1103
|
-
*/
|
|
1104
|
-
function createSamlGroup({ roleIds, group }) {
|
|
1105
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1106
|
-
console.debug('createSamlGroup()');
|
|
1107
|
-
return Post(`${urls.team.sso.v2}/saml/configurations/groups`, { group, roleIds });
|
|
1108
|
-
});
|
|
1109
|
-
}
|
|
1110
|
-
/**
|
|
1111
|
-
* Update Saml group roles for authorization
|
|
1112
|
-
*/
|
|
1113
|
-
function updateSamlGroup({ roleIds, group, id }) {
|
|
1114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1115
|
-
console.debug('updateSamlGroup()');
|
|
1116
|
-
return Patch(`${urls.team.sso.v2}/saml/configurations/groups/${id}`, { group, roleIds });
|
|
1117
|
-
});
|
|
1118
|
-
}
|
|
1119
|
-
/**
|
|
1120
|
-
* Delete Saml group
|
|
1121
|
-
*/
|
|
1122
|
-
function deleteSamlGroup({ id }) {
|
|
1123
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1124
|
-
console.debug('deleteSamlGroup()');
|
|
1125
|
-
return Delete(`${urls.team.sso.v2}/saml/configurations/groups/${id}`);
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
/**
|
|
1129
|
-
* Retrieve OIDC configurations from server by logged in user (vendorId)
|
|
1130
|
-
*
|
|
1131
|
-
* @return {active: true} if no oidc configuration found. else IOidcConfiguration
|
|
1132
|
-
* * ``authorized user``
|
|
1133
|
-
*/
|
|
1134
|
-
function getOidcConfiguration() {
|
|
1135
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1136
|
-
console.debug('getOidcConfiguration()');
|
|
1137
|
-
return Get(`${urls.team.sso.v1}/oidc/configurations`);
|
|
1138
|
-
});
|
|
1139
|
-
}
|
|
1140
|
-
/**
|
|
1141
|
-
* Check if one or more saml/oidc configuration are active
|
|
1142
|
-
*
|
|
1143
|
-
** @return {isActive: true/false}
|
|
1144
|
-
*/
|
|
1145
|
-
function getSSOPublicConfiguration() {
|
|
1146
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1147
|
-
console.debug('getSSOPublicConfiguration()');
|
|
1148
|
-
return Get(`${urls.team.sso.v2}/configurations/public`);
|
|
1149
|
-
});
|
|
1150
|
-
}
|
|
1151
|
-
/**
|
|
1152
|
-
* Get social logins providers configurations for vendor
|
|
1153
|
-
* @return array of providers configurations
|
|
1154
|
-
*/
|
|
1155
|
-
function getSocialLoginProviders() {
|
|
1156
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1157
|
-
console.debug('getSocialLoginProviders()');
|
|
1158
|
-
return Get(urls.identity.sso.v1);
|
|
1159
|
-
});
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* Get social logins providers configurations V2 supports dev credentials as well
|
|
1163
|
-
* @return array of providers configurations
|
|
1164
|
-
*/
|
|
1165
|
-
function getSocialLoginProvidersV2() {
|
|
1166
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1167
|
-
console.debug('getSocialLoginProvidersV2()');
|
|
1168
|
-
return Get(urls.identity.sso.v2);
|
|
1169
|
-
});
|
|
1170
|
-
}
|
|
1171
|
-
/**
|
|
1172
|
-
* Login using social login
|
|
1173
|
-
* @return cookie with refresh token
|
|
1174
|
-
*/
|
|
1175
|
-
function loginViaSocialLogin({ provider, code, redirectUri, codeVerifier, metadata, invitationToken, state, }) {
|
|
1176
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1177
|
-
console.debug('loginViaSocialLogin()');
|
|
1178
|
-
const params = { code };
|
|
1179
|
-
if (redirectUri) {
|
|
1180
|
-
params.redirectUri = redirectUri;
|
|
1181
|
-
}
|
|
1182
|
-
if (codeVerifier) {
|
|
1183
|
-
params.code_verifier = codeVerifier;
|
|
1184
|
-
}
|
|
1185
|
-
if (state) {
|
|
1186
|
-
params.state = state;
|
|
1187
|
-
}
|
|
1188
|
-
return Post(`${urls.identity.auth.v1}/user/sso/${provider}/postlogin`, { metadata, invitationToken }, { params });
|
|
1189
|
-
});
|
|
1190
|
-
}
|
|
1191
|
-
/**
|
|
1192
|
-
* Get vendor secure access configuration
|
|
1193
|
-
*/
|
|
1194
|
-
function getVendorConfig() {
|
|
1195
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1196
|
-
console.debug('getVendorConfig()');
|
|
1197
|
-
return Get(`${urls.identity.configurations.v1}/public`);
|
|
1198
|
-
});
|
|
1199
|
-
}
|
|
1200
|
-
/**
|
|
1201
|
-
* Sign up new user
|
|
1202
|
-
* create new user with a new tenant
|
|
1203
|
-
*/
|
|
1204
|
-
function signUpUser(body) {
|
|
1205
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1206
|
-
console.debug('signUpUser()', body);
|
|
1207
|
-
const { shouldActivate, authResponse, userId, tenantId } = yield Post(`${urls.identity.users.v1}/signUp`, body);
|
|
1208
|
-
const loginResponse = !shouldActivate && authResponse ? yield generateLoginResponse(authResponse) : undefined;
|
|
1209
|
-
return { shouldActivate, user: loginResponse, userId, tenantId };
|
|
1210
|
-
});
|
|
1211
|
-
}
|
|
1212
|
-
/**
|
|
1213
|
-
* Get all current user active sessions
|
|
1214
|
-
*/
|
|
1215
|
-
function getCurrentUserSessions() {
|
|
1216
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1217
|
-
console.debug('getCurrentUserSessions');
|
|
1218
|
-
const sessions = yield Get(urls.identity.users.sessions.currentUser.v1);
|
|
1219
|
-
return sessions;
|
|
1220
|
-
});
|
|
1221
|
-
}
|
|
1222
|
-
/**
|
|
1223
|
-
* Get session configurations
|
|
1224
|
-
*/
|
|
1225
|
-
function getSessionConfigurations() {
|
|
1226
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1227
|
-
console.debug('getSessionConfigurations');
|
|
1228
|
-
const sessionsConfigurations = yield Get(urls.identity.users.sessions.configurations.v1);
|
|
1229
|
-
return sessionsConfigurations;
|
|
1230
|
-
});
|
|
1231
|
-
}
|
|
1232
|
-
/**
|
|
1233
|
-
* Create or update session configurations
|
|
1234
|
-
*/
|
|
1235
|
-
function createOrUpdateSessionConfigrations(body) {
|
|
1236
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1237
|
-
console.debug('createOrUpdateSessionConfigrations');
|
|
1238
|
-
yield Post(urls.identity.users.sessions.configurations.v1, body);
|
|
1239
|
-
});
|
|
1240
|
-
}
|
|
1241
|
-
/**
|
|
1242
|
-
* Delete user session
|
|
1243
|
-
*/
|
|
1244
|
-
function deleteSessionForUser(id) {
|
|
1245
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1246
|
-
console.debug('deleteSessionForUser', id);
|
|
1247
|
-
yield Delete(`${urls.identity.users.sessions.currentUser.v1}/${id}`);
|
|
1248
|
-
});
|
|
1249
|
-
}
|
|
1250
|
-
/**
|
|
1251
|
-
* Delete all user sessions
|
|
1252
|
-
*/
|
|
1253
|
-
function deleteAllSessionsForUser() {
|
|
1254
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1255
|
-
console.debug('deleteAllSessionsForUser');
|
|
1256
|
-
yield Delete(`${urls.identity.users.sessions.currentUser.v1}/all`);
|
|
1257
|
-
});
|
|
1258
|
-
}
|
|
1259
|
-
/**
|
|
1260
|
-
* Api tokens Configurations
|
|
1261
|
-
*/
|
|
1262
|
-
/**
|
|
1263
|
-
* Get user api tokens data
|
|
1264
|
-
*/
|
|
1265
|
-
function getUserApiTokensData() {
|
|
1266
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1267
|
-
console.debug('getUserApiTokensData()');
|
|
1268
|
-
return Get(urls.identity.users.apiTokens.v1);
|
|
1269
|
-
});
|
|
1270
|
-
}
|
|
1271
|
-
/**
|
|
1272
|
-
* Get tenant api tokens data
|
|
1273
|
-
*/
|
|
1274
|
-
function getTenantApiTokensData() {
|
|
1275
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1276
|
-
console.debug('geTenantApiTokensData()');
|
|
1277
|
-
return Get(urls.identity.tenants.apiTokens.v1);
|
|
1278
|
-
});
|
|
1279
|
-
}
|
|
1280
|
-
/**
|
|
1281
|
-
* Update User Api Tokens
|
|
1282
|
-
*/
|
|
1283
|
-
function updateUserApiTokensData(body) {
|
|
1284
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1285
|
-
console.debug('updateUserApiTokensData()', body);
|
|
1286
|
-
return Post(urls.identity.users.apiTokens.v1, body);
|
|
1287
|
-
});
|
|
1288
|
-
}
|
|
1289
|
-
/**
|
|
1290
|
-
* Update Tenant Api Tokens
|
|
1291
|
-
*/
|
|
1292
|
-
function updateTenantApiTokensData(body) {
|
|
1293
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1294
|
-
console.debug('updateTenantApiTokensData()', body);
|
|
1295
|
-
return Post(urls.identity.tenants.apiTokens.v2, body);
|
|
1296
|
-
});
|
|
1297
|
-
}
|
|
1298
|
-
/**
|
|
1299
|
-
* Delete Tenant Api Token
|
|
1300
|
-
*/
|
|
1301
|
-
function deleteTenantApiToken({ tokenId }) {
|
|
1302
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1303
|
-
console.debug('deleteTenantApiToken()', tokenId);
|
|
1304
|
-
return Delete(`${urls.identity.tenants.apiTokens.v1}/${tokenId}`);
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
/**
|
|
1308
|
-
* Delete Tenant Api Token
|
|
1309
|
-
*/
|
|
1310
|
-
function deleteUserApiToken({ tokenId }) {
|
|
1311
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1312
|
-
console.debug('deleteUserApiToken()', tokenId);
|
|
1313
|
-
return Delete(`${urls.identity.users.apiTokens.v1}/${tokenId}`);
|
|
1314
|
-
});
|
|
1315
|
-
}
|
|
1316
|
-
/**
|
|
1317
|
-
* Get Tenant Api Token Creator User
|
|
1318
|
-
*/
|
|
1319
|
-
function getUserById({ userId }) {
|
|
1320
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1321
|
-
console.debug('getUserById()');
|
|
1322
|
-
return Get(`${urls.identity.users.v1}/${userId}`);
|
|
1323
|
-
});
|
|
1324
|
-
}
|
|
1325
|
-
/**
|
|
1326
|
-
* Checks if remember MFA device is enabled for user.
|
|
1327
|
-
*/
|
|
1328
|
-
function checkIfAllowToRememberMfaDevice(mfaToken) {
|
|
1329
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1330
|
-
console.debug('checkIfAllowToRememberMfaDevice()');
|
|
1331
|
-
return Get(`${urls.identity.configurations.v1}/mfa-policy/allow-remember-device`, { mfaToken });
|
|
1332
|
-
});
|
|
1333
|
-
}
|
|
1334
|
-
/**
|
|
1335
|
-
* Passwordless prelogin authentication
|
|
1336
|
-
*/
|
|
1337
|
-
function passwordlessPreLogin(_a) {
|
|
1338
|
-
var { type } = _a, body = __rest(_a, ["type"]);
|
|
1339
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1340
|
-
console.debug('passwordlessPrelogin()');
|
|
1341
|
-
return Post(`${urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/prelogin`, body);
|
|
1342
|
-
});
|
|
1343
|
-
}
|
|
1344
|
-
function passwordlessPostLogin(_a) {
|
|
1345
|
-
var { type } = _a, body = __rest(_a, ["type"]);
|
|
1346
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1347
|
-
console.debug('passwordlessPostLogin()');
|
|
1348
|
-
return Post(`${urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/postlogin`, body);
|
|
1349
|
-
});
|
|
1350
|
-
}
|
|
1351
|
-
/**
|
|
1352
|
-
* Check if tenant invitation token is valid
|
|
1353
|
-
* @param token - invitation token
|
|
1354
|
-
* @returns tenant name
|
|
1355
|
-
*/
|
|
1356
|
-
function verifyInviteToken({ token }) {
|
|
1357
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1358
|
-
console.debug('verifyInviteToken()');
|
|
1359
|
-
return Post(urls.identity.tenants.invites.verify.v1, { token });
|
|
1360
|
-
});
|
|
1361
|
-
}
|
|
1362
|
-
/**
|
|
1363
|
-
* SSO Configurations V1
|
|
1364
|
-
*/
|
|
1365
|
-
/**
|
|
1366
|
-
* Retrieve SSO configurations from server by logged in user (tenantId, vendorId)
|
|
1367
|
-
*
|
|
1368
|
-
* @return ISSOConfiguration[]
|
|
1369
|
-
* * ``authorized user``
|
|
1370
|
-
*/
|
|
1371
|
-
function getSSOConfigurations() {
|
|
1372
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1373
|
-
console.debug('getSSOConfigurations()');
|
|
1374
|
-
return Get(`${urls.team.sso.v1}/configurations`);
|
|
1375
|
-
});
|
|
1376
|
-
}
|
|
1377
|
-
/**
|
|
1378
|
-
* Create SSO configuration by logged in user (tenantId, vendorId)
|
|
1379
|
-
*
|
|
1380
|
-
* @returns ISSOConfiguration
|
|
1381
|
-
* * ``authorized user``
|
|
1382
|
-
*/
|
|
1383
|
-
function createSSOConfiguration(body) {
|
|
1384
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1385
|
-
console.debug('createSSOConfiguration()', body);
|
|
1386
|
-
return Post(`${urls.team.sso.v1}/configurations`, body);
|
|
1387
|
-
});
|
|
1388
|
-
}
|
|
1389
|
-
/**
|
|
1390
|
-
* Update SSO configuration by logged in user (tenantId, vendorId)
|
|
1391
|
-
*
|
|
1392
|
-
* @returns ISSOConfiguration
|
|
1393
|
-
* * ``authorized user``
|
|
1394
|
-
*/
|
|
1395
|
-
function updateSSOConfiguration(ssoConfigId, body) {
|
|
1396
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1397
|
-
console.debug('updateSSOConfiguration()', { body, ssoConfigId });
|
|
1398
|
-
return Patch(`${urls.team.sso.v1}/configurations/${ssoConfigId}`, body);
|
|
1399
|
-
});
|
|
1400
|
-
}
|
|
1401
|
-
/**
|
|
1402
|
-
* Delete SSO configuration by logged in user (tenantId, vendorId)
|
|
1403
|
-
* * ``authorized user``
|
|
1404
|
-
*/
|
|
1405
|
-
function deleteSSOConfiguration(ssoConfigId) {
|
|
1406
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1407
|
-
console.debug('deleteSSOConfiguration()', { ssoConfigId });
|
|
1408
|
-
return Delete(`${urls.team.sso.v1}/configurations/${ssoConfigId}`);
|
|
1409
|
-
});
|
|
1410
|
-
}
|
|
1411
|
-
/**
|
|
1412
|
-
* Create SSO configuration by metadata by logged in user (tenantId, vendorId)
|
|
1413
|
-
*
|
|
1414
|
-
* @returns ISSOConfiguration
|
|
1415
|
-
* * ``authorized user``
|
|
1416
|
-
*/
|
|
1417
|
-
function createSSOConfigurationByMetadata(body) {
|
|
1418
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1419
|
-
console.debug('createSSOConfigurationByMetadata()', body);
|
|
1420
|
-
return Post(`${urls.team.sso.v1}/configurations/metadata`, body);
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1423
|
-
/**
|
|
1424
|
-
* Update SSO configuration by metadata by logged in user (tenantId, vendorId)
|
|
1425
|
-
*
|
|
1426
|
-
* @returns ISSOConfiguration
|
|
1427
|
-
* * ``authorized user``
|
|
1428
|
-
*/
|
|
1429
|
-
function updateSSOConfigurationByMetadata(ssoConfigId, body) {
|
|
1430
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1431
|
-
console.debug('updateSSOConfigurationByMetadata()', { body, ssoConfigId });
|
|
1432
|
-
return Put(`${urls.team.sso.v1}/configurations/${ssoConfigId}/metadata`, body);
|
|
1433
|
-
});
|
|
1434
|
-
}
|
|
1435
|
-
/**
|
|
1436
|
-
* Create SSO configuration domain by logged in user (tenantId, vendorId)
|
|
1437
|
-
*
|
|
1438
|
-
* @returns ISSODomain
|
|
1439
|
-
* * ``authorized user``
|
|
1440
|
-
*/
|
|
1441
|
-
function createSSODomain(ssoConfigId, body) {
|
|
1442
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1443
|
-
console.debug('createSSODomain()', { body, ssoConfigId });
|
|
1444
|
-
return Post(`${urls.team.sso.v1}/configurations/${ssoConfigId}/domains`, body);
|
|
1445
|
-
});
|
|
1446
|
-
}
|
|
1447
|
-
/**
|
|
1448
|
-
* Create SSO configuration domain by logged in user (tenantId, vendorId)
|
|
1449
|
-
* * ``authorized user``
|
|
1450
|
-
*/
|
|
1451
|
-
function deleteSSODomain(ssoConfigId, domainId) {
|
|
1452
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1453
|
-
console.debug('deleteSSODomain()', { domainId, ssoConfigId });
|
|
1454
|
-
return Delete(`${urls.team.sso.v1}/configurations/${ssoConfigId}/domains/${domainId}`);
|
|
1455
|
-
});
|
|
1456
|
-
}
|
|
1457
|
-
/**
|
|
1458
|
-
* Validate SSO configuration domain by logged in user (tenantId, vendorId)
|
|
1459
|
-
* * ``authorized user``
|
|
1460
|
-
*/
|
|
1461
|
-
function validateSSODomain(ssoConfigId, domainId) {
|
|
1462
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1463
|
-
console.debug('validateSSODomain()', { domainId, ssoConfigId });
|
|
1464
|
-
return Put(`${urls.team.sso.v1}/configurations/${ssoConfigId}/domains/${domainId}/validate`);
|
|
1465
|
-
});
|
|
1466
|
-
}
|
|
1467
|
-
/**
|
|
1468
|
-
* Get SSO configuration default roles by logged in user (tenantId, vendorId)
|
|
1469
|
-
* * ``authorized user``
|
|
1470
|
-
*/
|
|
1471
|
-
function getSSODefaultRoles(ssoConfigId) {
|
|
1472
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1473
|
-
console.debug('getSSODefaultRoles()', { ssoConfigId });
|
|
1474
|
-
return Get(`${urls.team.sso.v1}/configurations/${ssoConfigId}/roles`);
|
|
1475
|
-
});
|
|
1476
|
-
}
|
|
1477
|
-
/**
|
|
1478
|
-
* Create SSO configuration default roles by logged in user (tenantId, vendorId)
|
|
1479
|
-
* * ``authorized user``
|
|
1480
|
-
*/
|
|
1481
|
-
function setSSODefaultRoles(ssoConfigId, body) {
|
|
1482
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1483
|
-
console.debug('setSSODefaultRoles()', { body, ssoConfigId });
|
|
1484
|
-
return Put(`${urls.team.sso.v1}/configurations/${ssoConfigId}/roles`, body);
|
|
1485
|
-
});
|
|
1486
|
-
}
|
|
1487
|
-
/**
|
|
1488
|
-
* Create SSO configuration group roles for authorization
|
|
1489
|
-
*/
|
|
1490
|
-
function createSSOGroup(ssoConfigId, body) {
|
|
1491
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1492
|
-
console.debug('createSSOGroup()', { body, ssoConfigId });
|
|
1493
|
-
return Post(`${urls.team.sso.v1}/configurations/${ssoConfigId}/groups`, body);
|
|
1494
|
-
});
|
|
1495
|
-
}
|
|
1496
|
-
/**
|
|
1497
|
-
* Update SSO configuration group roles for authorization
|
|
1498
|
-
*/
|
|
1499
|
-
function updateSSOGroup(ssoConfigId, { roleIds, group, id }) {
|
|
1500
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1501
|
-
console.debug('updateSSOGroup()', { ssoConfigId, roleIds, group });
|
|
1502
|
-
return Patch(`${urls.team.sso.v1}/configurations/${ssoConfigId}/groups/${id}`, { group, roleIds });
|
|
1503
|
-
});
|
|
1504
|
-
}
|
|
1505
|
-
/**
|
|
1506
|
-
* Delete SSO configuration group
|
|
1507
|
-
*/
|
|
1508
|
-
function deleteSSOGroup(ssoConfigId, groupId) {
|
|
1509
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1510
|
-
console.debug('deleteSSOGroup()', { ssoConfigId, groupId });
|
|
1511
|
-
return Delete(`${urls.team.sso.v1}/configurations/${ssoConfigId}/groups/${groupId}`);
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
/**
|
|
1515
|
-
* Get SSO configuration groups
|
|
1516
|
-
*/
|
|
1517
|
-
function getSSOGroups(ssoConfigId) {
|
|
1518
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1519
|
-
console.debug('getSSOGroups()', { ssoConfigId });
|
|
1520
|
-
return Get(`${urls.team.sso.v1}/configurations/${ssoConfigId}/groups`);
|
|
1521
|
-
});
|
|
1522
|
-
}
|
|
1523
|
-
/**
|
|
1524
|
-
* Check if requested email address has sso configuration
|
|
1525
|
-
* If true, this function will return the sso address to navigate to
|
|
1526
|
-
* else, return null
|
|
1527
|
-
*/
|
|
1528
|
-
function preLoginV2(body) {
|
|
1529
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1530
|
-
console.debug('preLoginV2()', body);
|
|
1531
|
-
return Post(`${urls.identity.auth.v2}/user/sso/prelogin`, body);
|
|
1532
|
-
});
|
|
1533
|
-
}
|
|
1534
|
-
/**
|
|
1535
|
-
* After calling preLogin and navigated to SSO url, the IDP will redirect you to the redirect url
|
|
1536
|
-
* with code and state
|
|
1537
|
-
*/
|
|
1538
|
-
function oidcPostLoginV2(body) {
|
|
1539
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1540
|
-
console.debug('oidcPostLoginV2()');
|
|
1541
|
-
const data = yield Post(`${urls.identity.auth.v2}/user/oidc/postlogin`, body);
|
|
1542
|
-
return generateLoginResponse(data);
|
|
1543
|
-
});
|
|
1544
|
-
}
|
|
1545
|
-
function exchangeOAuthTokens(body) {
|
|
1546
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1547
|
-
console.debug('exchangeOauthTokens()');
|
|
1548
|
-
const data = yield Post(`${urls.oauth.v1}/token`, body);
|
|
1549
|
-
return generateLoginResponseFromOAuthResponse(data);
|
|
1550
|
-
});
|
|
1551
|
-
}
|
|
1552
|
-
/**
|
|
1553
|
-
* reset phone should be called in case user want to reset his phone number
|
|
1554
|
-
* when using sms authentication strategy. a 6-digits code will be send to the user email.
|
|
1555
|
-
*/
|
|
1556
|
-
function resetPhoneNumber(body) {
|
|
1557
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1558
|
-
console.debug('resetPhoneNumber()', body);
|
|
1559
|
-
return Post(`${urls.identity.users.v1}/phone/reset`, body);
|
|
1560
|
-
});
|
|
1561
|
-
}
|
|
1562
|
-
/**
|
|
1563
|
-
* verify reset phone should be called after reset phone number request
|
|
1564
|
-
* with the token received from the reset phone number request and a code that was sent to the user email
|
|
1565
|
-
*/
|
|
1566
|
-
function verifyResetPhoneNumber(body) {
|
|
1567
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1568
|
-
console.debug('verifyResetPhoneNumber()', body);
|
|
1569
|
-
return Post(`${urls.identity.users.v1}/phone/reset/verify`, body);
|
|
1570
|
-
});
|
|
1571
|
-
}
|
|
1572
|
-
/**
|
|
1573
|
-
* change phone number with verification.
|
|
1574
|
-
*/
|
|
1575
|
-
function changePhoneNumberWithVerification(body) {
|
|
1576
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1577
|
-
console.debug('changePhoneNumberWithVerification()', body);
|
|
1578
|
-
return Post(`${urls.identity.users.v1}/phone`, body);
|
|
1579
|
-
});
|
|
1580
|
-
}
|
|
1581
|
-
/**
|
|
1582
|
-
* verify new phone number.
|
|
1583
|
-
*/
|
|
1584
|
-
function verifyChangePhoneNumber(body) {
|
|
1585
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1586
|
-
console.debug('verifyChangePhoneNumber()', body);
|
|
1587
|
-
return Post(`${urls.identity.users.v1}/phone/verify`, body);
|
|
1588
|
-
});
|
|
1589
|
-
}
|
|
1590
|
-
/**
|
|
1591
|
-
* change phone number should be called after verify reset phone number with the new phone number
|
|
1592
|
-
*/
|
|
1593
|
-
function changePhoneNumber(body) {
|
|
1594
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1595
|
-
console.debug('changePhoneNumber()', body);
|
|
1596
|
-
return Put(`${urls.identity.users.v1}/phone/change`, body);
|
|
1597
|
-
});
|
|
1598
|
-
}
|
|
1599
|
-
/**
|
|
1600
|
-
* webauthn prelogin should be called when the user wants to be authenticated using his device/android/usb key
|
|
1601
|
-
*/
|
|
1602
|
-
function webAuthnPreLogin(body) {
|
|
1603
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1604
|
-
console.debug('webAuthnPreLogin()', body);
|
|
1605
|
-
return Post(`${urls.identity.auth.v1}/webauthn/prelogin`, body);
|
|
1606
|
-
});
|
|
1607
|
-
}
|
|
1608
|
-
/**
|
|
1609
|
-
* webauthn postlogin should be called after the user used his authenticator (device/android/usb key) in order to login
|
|
1610
|
-
*/
|
|
1611
|
-
function webAuthnPostLogin(body) {
|
|
1612
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1613
|
-
console.debug('webAuthnPostLogin()', body);
|
|
1614
|
-
return Post(`${urls.identity.auth.v1}/webauthn/postlogin`, body);
|
|
1615
|
-
});
|
|
1616
|
-
}
|
|
1617
|
-
/**
|
|
1618
|
-
* webauthn create new device should be called once the user wants to add new device as authenticator
|
|
1619
|
-
*/
|
|
1620
|
-
function webAuthnCreateNewDeviceSession() {
|
|
1621
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1622
|
-
console.debug('webAuthnCreateNewDeviceSession()');
|
|
1623
|
-
return Post(urls.identity.webAuthnDevices.v1);
|
|
1624
|
-
});
|
|
1625
|
-
}
|
|
1626
|
-
/**
|
|
1627
|
-
* webauthn verify new device should be called after the user used his authenticator in order to register the new device
|
|
1628
|
-
*/
|
|
1629
|
-
function verifyNewDeviceSession(body) {
|
|
1630
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1631
|
-
console.debug('verifyNewDeviceSession()', body);
|
|
1632
|
-
return Post(`${urls.identity.webAuthnDevices.v1}/verify`, body);
|
|
1633
|
-
});
|
|
1634
|
-
}
|
|
1635
|
-
/**
|
|
1636
|
-
* Get public vendor auth strategies public configuration
|
|
1637
|
-
*/
|
|
1638
|
-
function getVendorPublicAuthStrategiesConfig() {
|
|
1639
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1640
|
-
console.debug('getVendorPublicAuthStrategiesConfig()');
|
|
1641
|
-
return Get(`${urls.identity.configurations.v1}/auth/strategies/public`);
|
|
1642
|
-
});
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
var auth = /*#__PURE__*/Object.freeze({
|
|
1646
|
-
__proto__: null,
|
|
1647
|
-
generateLoginResponse: generateLoginResponse,
|
|
1648
|
-
generateLoginResponseV2: generateLoginResponseV2,
|
|
1649
|
-
generateLoginResponseFromOAuthResponse: generateLoginResponseFromOAuthResponse,
|
|
1650
|
-
preLogin: preLogin,
|
|
1651
|
-
preLoginWithIdpType: preLoginWithIdpType,
|
|
1652
|
-
postLogin: postLogin,
|
|
1653
|
-
oidcPostLogin: oidcPostLogin,
|
|
1654
|
-
login: login,
|
|
1655
|
-
loginWithMfa: loginWithMfa,
|
|
1656
|
-
activateAccount: activateAccount,
|
|
1657
|
-
getActivateAccountStrategy: getActivateAccountStrategy,
|
|
1658
|
-
resendActivationEmail: resendActivationEmail,
|
|
1659
|
-
acceptInvitation: acceptInvitation,
|
|
1660
|
-
refreshToken: refreshToken,
|
|
1661
|
-
refreshTokenV2: refreshTokenV2,
|
|
1662
|
-
logout: logout,
|
|
1663
|
-
forgotPassword: forgotPassword,
|
|
1664
|
-
resetPassword: resetPassword,
|
|
1665
|
-
loadPasswordConfig: loadPasswordConfig,
|
|
1666
|
-
recoverMfaToken: recoverMfaToken,
|
|
1667
|
-
enrollMfa: enrollMfa,
|
|
1668
|
-
verifyMfa: verifyMfa,
|
|
1669
|
-
disableMfa: disableMfa,
|
|
1670
|
-
getSamlConfiguration: getSamlConfiguration,
|
|
1671
|
-
updateSamlConfiguration: updateSamlConfiguration,
|
|
1672
|
-
getSamlVendorConfiguration: getSamlVendorConfiguration,
|
|
1673
|
-
updateSamlVendorMetadata: updateSamlVendorMetadata,
|
|
1674
|
-
validateSamlDomain: validateSamlDomain,
|
|
1675
|
-
getSamlRoles: getSamlRoles,
|
|
1676
|
-
getSamlRolesGroups: getSamlRolesGroups,
|
|
1677
|
-
updateSamlRoles: updateSamlRoles,
|
|
1678
|
-
createSamlGroup: createSamlGroup,
|
|
1679
|
-
updateSamlGroup: updateSamlGroup,
|
|
1680
|
-
deleteSamlGroup: deleteSamlGroup,
|
|
1681
|
-
getOidcConfiguration: getOidcConfiguration,
|
|
1682
|
-
getSSOPublicConfiguration: getSSOPublicConfiguration,
|
|
1683
|
-
getSocialLoginProviders: getSocialLoginProviders,
|
|
1684
|
-
getSocialLoginProvidersV2: getSocialLoginProvidersV2,
|
|
1685
|
-
loginViaSocialLogin: loginViaSocialLogin,
|
|
1686
|
-
getVendorConfig: getVendorConfig,
|
|
1687
|
-
signUpUser: signUpUser,
|
|
1688
|
-
getCurrentUserSessions: getCurrentUserSessions,
|
|
1689
|
-
getSessionConfigurations: getSessionConfigurations,
|
|
1690
|
-
createOrUpdateSessionConfigrations: createOrUpdateSessionConfigrations,
|
|
1691
|
-
deleteSessionForUser: deleteSessionForUser,
|
|
1692
|
-
deleteAllSessionsForUser: deleteAllSessionsForUser,
|
|
1693
|
-
getUserApiTokensData: getUserApiTokensData,
|
|
1694
|
-
getTenantApiTokensData: getTenantApiTokensData,
|
|
1695
|
-
updateUserApiTokensData: updateUserApiTokensData,
|
|
1696
|
-
updateTenantApiTokensData: updateTenantApiTokensData,
|
|
1697
|
-
deleteTenantApiToken: deleteTenantApiToken,
|
|
1698
|
-
deleteUserApiToken: deleteUserApiToken,
|
|
1699
|
-
getUserById: getUserById,
|
|
1700
|
-
checkIfAllowToRememberMfaDevice: checkIfAllowToRememberMfaDevice,
|
|
1701
|
-
passwordlessPreLogin: passwordlessPreLogin,
|
|
1702
|
-
passwordlessPostLogin: passwordlessPostLogin,
|
|
1703
|
-
verifyInviteToken: verifyInviteToken,
|
|
1704
|
-
getSSOConfigurations: getSSOConfigurations,
|
|
1705
|
-
createSSOConfiguration: createSSOConfiguration,
|
|
1706
|
-
updateSSOConfiguration: updateSSOConfiguration,
|
|
1707
|
-
deleteSSOConfiguration: deleteSSOConfiguration,
|
|
1708
|
-
createSSOConfigurationByMetadata: createSSOConfigurationByMetadata,
|
|
1709
|
-
updateSSOConfigurationByMetadata: updateSSOConfigurationByMetadata,
|
|
1710
|
-
createSSODomain: createSSODomain,
|
|
1711
|
-
deleteSSODomain: deleteSSODomain,
|
|
1712
|
-
validateSSODomain: validateSSODomain,
|
|
1713
|
-
getSSODefaultRoles: getSSODefaultRoles,
|
|
1714
|
-
setSSODefaultRoles: setSSODefaultRoles,
|
|
1715
|
-
createSSOGroup: createSSOGroup,
|
|
1716
|
-
updateSSOGroup: updateSSOGroup,
|
|
1717
|
-
deleteSSOGroup: deleteSSOGroup,
|
|
1718
|
-
getSSOGroups: getSSOGroups,
|
|
1719
|
-
preLoginV2: preLoginV2,
|
|
1720
|
-
oidcPostLoginV2: oidcPostLoginV2,
|
|
1721
|
-
exchangeOAuthTokens: exchangeOAuthTokens,
|
|
1722
|
-
resetPhoneNumber: resetPhoneNumber,
|
|
1723
|
-
verifyResetPhoneNumber: verifyResetPhoneNumber,
|
|
1724
|
-
changePhoneNumberWithVerification: changePhoneNumberWithVerification,
|
|
1725
|
-
verifyChangePhoneNumber: verifyChangePhoneNumber,
|
|
1726
|
-
changePhoneNumber: changePhoneNumber,
|
|
1727
|
-
webAuthnPreLogin: webAuthnPreLogin,
|
|
1728
|
-
webAuthnPostLogin: webAuthnPostLogin,
|
|
1729
|
-
webAuthnCreateNewDeviceSession: webAuthnCreateNewDeviceSession,
|
|
1730
|
-
verifyNewDeviceSession: verifyNewDeviceSession,
|
|
1731
|
-
getVendorPublicAuthStrategiesConfig: getVendorPublicAuthStrategiesConfig,
|
|
1732
|
-
getGlobalSecurityPolicy: getGlobalSecurityPolicy,
|
|
1733
|
-
getMfaPolicy: getMfaPolicy,
|
|
1734
|
-
getVendorMfaPolicy: getVendorMfaPolicy,
|
|
1735
|
-
saveMfaPolicy: saveMfaPolicy,
|
|
1736
|
-
getLockoutPolicy: getLockoutPolicy,
|
|
1737
|
-
saveLockoutPolicy: saveLockoutPolicy,
|
|
1738
|
-
getCaptchaPolicy: getCaptchaPolicy,
|
|
1739
|
-
getPasswordHistoryPolicy: getPasswordHistoryPolicy,
|
|
1740
|
-
savePasswordHistoryPolicy: savePasswordHistoryPolicy,
|
|
1741
|
-
getPasswordConfigPolicy: getPasswordConfigPolicy,
|
|
1742
|
-
get SocialLoginProviders () { return exports.SocialLoginProviders; },
|
|
1743
|
-
get AuthStrategyEnum () { return exports.AuthStrategyEnum; }
|
|
1744
|
-
});
|
|
1745
|
-
|
|
1746
|
-
/*****************************************
|
|
1747
|
-
* Profile Api
|
|
1748
|
-
*****************************************/
|
|
1749
|
-
/**
|
|
1750
|
-
* change user password by providing current password and the new password.
|
|
1751
|
-
*
|
|
1752
|
-
* @throws exception if the current password incorrect or new password validation failed.
|
|
1753
|
-
* ``authorized user``
|
|
1754
|
-
*/
|
|
1755
|
-
function getProfile(params) {
|
|
1756
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1757
|
-
console.debug('getProfile()');
|
|
1758
|
-
return Get(`${urls.identity.users.v2}/me`, params !== null && params !== void 0 ? params : { addRoles: true });
|
|
1759
|
-
});
|
|
1760
|
-
}
|
|
1761
|
-
/**
|
|
1762
|
-
* update user profile by providing updated fields.
|
|
1763
|
-
* ``authorized user``
|
|
1764
|
-
*/
|
|
1765
|
-
function updateProfile(body) {
|
|
1766
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1767
|
-
console.debug('updateProfile()', body);
|
|
1768
|
-
return Put(`${urls.identity.users.v2}/me`, body);
|
|
1769
|
-
});
|
|
1770
|
-
}
|
|
1771
|
-
/**
|
|
1772
|
-
* update user profile image
|
|
1773
|
-
* ``authorized user``
|
|
1774
|
-
*/
|
|
1775
|
-
function updateProfileImage(body) {
|
|
1776
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1777
|
-
console.debug('updateProfileImage()', body);
|
|
1778
|
-
return Put(`${urls.team.profile.v1}/me/image/v1`, body, { responseType: 'plain', contentType: undefined });
|
|
1779
|
-
});
|
|
1780
|
-
}
|
|
1781
|
-
/**
|
|
1782
|
-
* change user password by providing current password and the new password.
|
|
1783
|
-
*
|
|
1784
|
-
* @throws exception if the current password incorrect or new password validation failed.
|
|
1785
|
-
* ``authorized user``
|
|
1786
|
-
*/
|
|
1787
|
-
function changePassword(body) {
|
|
1788
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1789
|
-
console.debug('changePassword()');
|
|
1790
|
-
return Post(`${urls.identity.users.v1}/passwords/change`, body);
|
|
1791
|
-
});
|
|
1792
|
-
}
|
|
1793
|
-
/*****************************************
|
|
1794
|
-
* Team Api
|
|
1795
|
-
*****************************************/
|
|
1796
|
-
/**
|
|
1797
|
-
* load users from team-management-service
|
|
1798
|
-
*
|
|
1799
|
-
* ``authorized user``
|
|
1800
|
-
*/
|
|
1801
|
-
function loadUsers(params) {
|
|
1802
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1803
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1804
|
-
const filters = (params.filter || []).reduce((p, n) => (Object.assign(Object.assign({}, p), { [n.id]: n.value })), {});
|
|
1805
|
-
const sorts = ((_a = params.sort) === null || _a === void 0 ? void 0 : _a.length)
|
|
1806
|
-
? {
|
|
1807
|
-
sortBy: (_d = (_c = (_b = params.sort) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : 'name',
|
|
1808
|
-
sortDirection: ((_f = (_e = params.sort) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.desc) ? 'desc' : 'asc',
|
|
1809
|
-
}
|
|
1810
|
-
: null;
|
|
1811
|
-
return Get(urls.team.members.v1, Object.assign(Object.assign({ pageOffset: params.pageOffset, pageSize: params.pageSize }, filters), sorts));
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
/**
|
|
1815
|
-
* add user to team, invitation link will be sent to the added user.
|
|
1816
|
-
*
|
|
1817
|
-
* ``authorized user``
|
|
1818
|
-
*/
|
|
1819
|
-
function addUser(body) {
|
|
1820
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1821
|
-
console.debug('addUser()', body);
|
|
1822
|
-
return Post(urls.identity.users.v2, Object.assign(Object.assign({}, body), { provider: 'local' }));
|
|
1823
|
-
});
|
|
1824
|
-
}
|
|
1825
|
-
/**
|
|
1826
|
-
* delete user from team, user will be deleted.
|
|
1827
|
-
*
|
|
1828
|
-
* ``authorized user``
|
|
1829
|
-
*/
|
|
1830
|
-
function deleteUser(body) {
|
|
1831
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1832
|
-
console.debug('deleteUser()', body);
|
|
1833
|
-
return Delete(`${urls.team.members.v1}/${body.userId}`);
|
|
1834
|
-
});
|
|
1835
|
-
}
|
|
1836
|
-
/**
|
|
1837
|
-
* edit user roles in team
|
|
1838
|
-
*
|
|
1839
|
-
* ``authorized user``
|
|
1840
|
-
*/
|
|
1841
|
-
function updateUser(body) {
|
|
1842
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1843
|
-
console.debug('editUser()', body);
|
|
1844
|
-
return Put(urls.team.members.v1, body);
|
|
1845
|
-
});
|
|
1846
|
-
}
|
|
1847
|
-
/**
|
|
1848
|
-
* create link to invite user
|
|
1849
|
-
*
|
|
1850
|
-
* ``authorized user``
|
|
1851
|
-
*/
|
|
1852
|
-
function createInviteUserLink(body) {
|
|
1853
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1854
|
-
console.debug('createInviteUserLink()');
|
|
1855
|
-
return Post(urls.identity.tenants.invites.user.v1, Object.assign({}, body));
|
|
1856
|
-
});
|
|
1857
|
-
}
|
|
1858
|
-
/**
|
|
1859
|
-
* update link to invite user
|
|
1860
|
-
*
|
|
1861
|
-
* ``authorized user``
|
|
1862
|
-
*/
|
|
1863
|
-
function updateInviteUserLink(body) {
|
|
1864
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1865
|
-
console.debug('updateInviteUserLink()', body);
|
|
1866
|
-
return Patch(urls.identity.tenants.invites.user.v1, Object.assign({}, body));
|
|
1867
|
-
});
|
|
1868
|
-
}
|
|
1869
|
-
/**
|
|
1870
|
-
* delete link to invite user
|
|
1871
|
-
*
|
|
1872
|
-
* ``authorized user``
|
|
1873
|
-
*/
|
|
1874
|
-
function deleteInviteUserLink() {
|
|
1875
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1876
|
-
console.debug('deleteInviteUserLink()');
|
|
1877
|
-
return Delete(urls.identity.tenants.invites.user.v1);
|
|
1878
|
-
});
|
|
1879
|
-
}
|
|
1880
|
-
/**
|
|
1881
|
-
* get link to invite user
|
|
1882
|
-
*
|
|
1883
|
-
* ``authorized user``
|
|
1884
|
-
*/
|
|
1885
|
-
function getInviteUserLink() {
|
|
1886
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1887
|
-
console.debug('getInviteUserLink()');
|
|
1888
|
-
return Get(urls.identity.tenants.invites.user.v1);
|
|
1889
|
-
});
|
|
1890
|
-
}
|
|
1891
|
-
/**
|
|
1892
|
-
* get invite link configuration
|
|
1893
|
-
*
|
|
1894
|
-
*/
|
|
1895
|
-
function getInviteLinkConfiguration() {
|
|
1896
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1897
|
-
console.debug('getInviteLinkConfiguration()');
|
|
1898
|
-
return Get(urls.identity.tenants.invites.configuration.v1);
|
|
1899
|
-
});
|
|
1900
|
-
}
|
|
1901
|
-
/**
|
|
1902
|
-
* load available roles that can be assigned to team users from team-management-service
|
|
1903
|
-
*
|
|
1904
|
-
* ``authorized user``
|
|
1905
|
-
*/
|
|
1906
|
-
function loadAvailableRoles() {
|
|
1907
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1908
|
-
console.debug('loadAvailableRoles()');
|
|
1909
|
-
return Get(urls.team.roles.v1);
|
|
1910
|
-
});
|
|
1911
|
-
}
|
|
1912
|
-
function loadAvailablePermissions() {
|
|
1913
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1914
|
-
console.debug('loadAvailablePermissions()');
|
|
1915
|
-
return Get(urls.identity.permissions.v1);
|
|
1916
|
-
});
|
|
1917
|
-
}
|
|
1918
|
-
/**
|
|
1919
|
-
* load users stats from team-management-service
|
|
1920
|
-
*
|
|
1921
|
-
* ``authorized user``
|
|
1922
|
-
*/
|
|
1923
|
-
function loadStats() {
|
|
1924
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1925
|
-
console.debug('loadStats()');
|
|
1926
|
-
return Get(`${urls.team.stats.v1}/members`);
|
|
1927
|
-
});
|
|
1928
|
-
}
|
|
1929
|
-
/**
|
|
1930
|
-
* resend activation link to specific user
|
|
1931
|
-
*
|
|
1932
|
-
* ``authorized user``
|
|
1933
|
-
*/
|
|
1934
|
-
function resendActivationLink(body) {
|
|
1935
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1936
|
-
console.debug('resendActivationLink()', body);
|
|
1937
|
-
return Post(`${urls.team.members.v1}/${body.userId}/resendActivationEmail`, {});
|
|
1938
|
-
});
|
|
1939
|
-
}
|
|
1940
|
-
/**
|
|
1941
|
-
* resend accept join tenant invitation link to specific user
|
|
1942
|
-
*
|
|
1943
|
-
* ``authorized user``
|
|
1944
|
-
*/
|
|
1945
|
-
function resendInvitationLink(body) {
|
|
1946
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1947
|
-
console.debug('resendInvitationLink()', body);
|
|
1948
|
-
return Post(urls.identity.users.v2, Object.assign(Object.assign({}, body), { provider: 'local' }));
|
|
1949
|
-
});
|
|
1950
|
-
}
|
|
1951
|
-
/**
|
|
1952
|
-
* resend accept join all pending tenant for current hierarchy invitation link to specific user
|
|
1953
|
-
*
|
|
1954
|
-
* ``authorized user``
|
|
1955
|
-
*/
|
|
1956
|
-
function resendInvitationLinkToAllTenants(body) {
|
|
1957
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1958
|
-
console.debug('resendInvitationLinkToAllTenants()', body);
|
|
1959
|
-
return Post(urls.identity.users.invitation.resendAll.v1, Object.assign({}, body));
|
|
1960
|
-
});
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
var teams = /*#__PURE__*/Object.freeze({
|
|
1964
|
-
__proto__: null,
|
|
1965
|
-
getProfile: getProfile,
|
|
1966
|
-
updateProfile: updateProfile,
|
|
1967
|
-
updateProfileImage: updateProfileImage,
|
|
1968
|
-
changePassword: changePassword,
|
|
1969
|
-
loadUsers: loadUsers,
|
|
1970
|
-
addUser: addUser,
|
|
1971
|
-
deleteUser: deleteUser,
|
|
1972
|
-
updateUser: updateUser,
|
|
1973
|
-
createInviteUserLink: createInviteUserLink,
|
|
1974
|
-
updateInviteUserLink: updateInviteUserLink,
|
|
1975
|
-
deleteInviteUserLink: deleteInviteUserLink,
|
|
1976
|
-
getInviteUserLink: getInviteUserLink,
|
|
1977
|
-
getInviteLinkConfiguration: getInviteLinkConfiguration,
|
|
1978
|
-
loadAvailableRoles: loadAvailableRoles,
|
|
1979
|
-
loadAvailablePermissions: loadAvailablePermissions,
|
|
1980
|
-
loadStats: loadStats,
|
|
1981
|
-
resendActivationLink: resendActivationLink,
|
|
1982
|
-
resendInvitationLink: resendInvitationLink,
|
|
1983
|
-
resendInvitationLinkToAllTenants: resendInvitationLinkToAllTenants
|
|
1984
|
-
});
|
|
1985
|
-
|
|
1986
|
-
function getMetadata(body) {
|
|
1987
|
-
var _a, _b;
|
|
1988
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1989
|
-
const data = yield Get('/metadata', body);
|
|
1990
|
-
if ((_a = data === null || data === void 0 ? void 0 : data.rows) === null || _a === void 0 ? void 0 : _a[0])
|
|
1991
|
-
return (_b = data === null || data === void 0 ? void 0 : data.rows) === null || _b === void 0 ? void 0 : _b[0];
|
|
1992
|
-
throw new Error(`metadata not found: ${body.entityName}`);
|
|
1993
|
-
});
|
|
1994
|
-
}
|
|
1995
|
-
function getIpMetadata(ip) {
|
|
1996
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1997
|
-
const data = yield Get(`/metadata/ip/${ip}`);
|
|
1998
|
-
if (data)
|
|
1999
|
-
return data;
|
|
2000
|
-
throw new Error(`ip metadata not found`);
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
const getNotificationsMetadata = () => __awaiter(void 0, void 0, void 0, function* () { return getMetadata({ entityName: 'notifications' }); });
|
|
2004
|
-
const getSamlMetadata = () => __awaiter(void 0, void 0, void 0, function* () { return getMetadata({ entityName: 'saml' }); });
|
|
2005
|
-
const getAuditsMetadata = () => __awaiter(void 0, void 0, void 0, function* () { return getMetadata({ entityName: 'audits' }); });
|
|
2006
|
-
const getIpAdressMetadata = (ip) => __awaiter(void 0, void 0, void 0, function* () { return getIpMetadata(ip); });
|
|
2007
|
-
|
|
2008
|
-
var metadata = /*#__PURE__*/Object.freeze({
|
|
2009
|
-
__proto__: null,
|
|
2010
|
-
getNotificationsMetadata: getNotificationsMetadata,
|
|
2011
|
-
getSamlMetadata: getSamlMetadata,
|
|
2012
|
-
getAuditsMetadata: getAuditsMetadata,
|
|
2013
|
-
getIpAdressMetadata: getIpAdressMetadata
|
|
2014
|
-
});
|
|
2015
|
-
|
|
2016
|
-
/**
|
|
2017
|
-
* Get all active tenant reports from reports service by active vendor.
|
|
2018
|
-
* Optional: pass filters and sort options to reports.
|
|
2019
|
-
*
|
|
2020
|
-
* @returns list of reports objects
|
|
2021
|
-
*/
|
|
2022
|
-
function getReports(body) {
|
|
2023
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2024
|
-
console.debug('getReports()', body);
|
|
2025
|
-
return Get(`${urls.reports.service.v2}/tenant-reports`, body);
|
|
2026
|
-
});
|
|
2027
|
-
}
|
|
2028
|
-
/**
|
|
2029
|
-
* Get report record by id.
|
|
2030
|
-
*
|
|
2031
|
-
* @returns list of report object
|
|
2032
|
-
* @throws exception if report not found.
|
|
2033
|
-
*/
|
|
2034
|
-
function getReport(body) {
|
|
2035
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2036
|
-
console.debug('getReport()', body);
|
|
2037
|
-
return Get(`${urls.reports.service.v2}/${body.id}/tenant-reports`);
|
|
2038
|
-
});
|
|
2039
|
-
}
|
|
2040
|
-
/**
|
|
2041
|
-
* Render report by id.
|
|
2042
|
-
* Optional: pass data filters if exists to render report by specific data.
|
|
2043
|
-
*
|
|
2044
|
-
* @returns html content of the rendered reports
|
|
2045
|
-
* @throws exception if report not found or the data api unreached.
|
|
2046
|
-
*/
|
|
2047
|
-
function renderReport(_a) {
|
|
2048
|
-
var { dataFilters } = _a, body = __rest(_a, ["dataFilters"]);
|
|
2049
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2050
|
-
console.debug('renderReport()', body);
|
|
2051
|
-
const html = yield Get(`${urls.reports.trigger.v1}/preview-report`, Object.assign(Object.assign({}, body), { dataFilters: btoa(JSON.stringify(dataFilters || {})), responseType: 'html' }), { responseType: 'plain' });
|
|
2052
|
-
return { html };
|
|
2053
|
-
});
|
|
2054
|
-
}
|
|
2055
|
-
/**
|
|
2056
|
-
* schedule report by providing cron expression and data filters.
|
|
2057
|
-
*
|
|
2058
|
-
* @returns the updated report object
|
|
2059
|
-
* @throws exception if report not found or the data api unreached.
|
|
2060
|
-
*/
|
|
2061
|
-
function scheduleReport(_a) {
|
|
2062
|
-
var { templateId, dataFilters } = _a, body = __rest(_a, ["templateId", "dataFilters"]);
|
|
2063
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2064
|
-
console.debug('scheduleReport()', body);
|
|
2065
|
-
return Post(`${urls.reports.service.v2}/${templateId}/tenant-reports`, Object.assign(Object.assign({}, body), { dataFilters: btoa(JSON.stringify(dataFilters || {})) }));
|
|
2066
|
-
});
|
|
2067
|
-
}
|
|
2068
|
-
/**
|
|
2069
|
-
* download report as file in specific format.
|
|
2070
|
-
* this function will add a href element with url to trigger file download.
|
|
2071
|
-
* Optional: pass data filters if exists to generate report by specific data.
|
|
2072
|
-
*
|
|
2073
|
-
* @throws exception if report not found or the data api unreached.
|
|
2074
|
-
*/
|
|
2075
|
-
function downloadReport(_a) {
|
|
2076
|
-
var { dataFilters } = _a, body = __rest(_a, ["dataFilters"]);
|
|
2077
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2078
|
-
console.debug('downloadReport()', body);
|
|
2079
|
-
const blob = yield Get(`${urls.reports.trigger.v1}/preview-report`, Object.assign(Object.assign({}, body), { dataFilters: btoa(JSON.stringify(dataFilters || {})) }), { responseType: 'blob' });
|
|
2080
|
-
let contentType = 'text/html';
|
|
2081
|
-
let contentExt = 'html';
|
|
2082
|
-
if (body.responseType === 'pdf') {
|
|
2083
|
-
contentType = 'application/pdf';
|
|
2084
|
-
contentExt = 'pdf';
|
|
2085
|
-
}
|
|
2086
|
-
else if (body.responseType === 'image') {
|
|
2087
|
-
contentType = 'image/jpeg';
|
|
2088
|
-
contentExt = 'jpg';
|
|
2089
|
-
}
|
|
2090
|
-
const newBlob = new Blob([blob], { type: contentType });
|
|
2091
|
-
const fileURL = URL.createObjectURL(newBlob);
|
|
2092
|
-
const tempLink = document.createElement('a');
|
|
2093
|
-
tempLink.href = fileURL;
|
|
2094
|
-
tempLink.setAttribute('download', `report_${body.name || ''}.${contentExt}`);
|
|
2095
|
-
tempLink.click();
|
|
2096
|
-
setTimeout(tempLink.remove.bind(tempLink));
|
|
2097
|
-
});
|
|
2098
|
-
}
|
|
2099
|
-
/**
|
|
2100
|
-
* send report to specific email address.
|
|
2101
|
-
* Optional: pass data filters if exists to send report by specific data.
|
|
2102
|
-
*
|
|
2103
|
-
* @throws exception if report not found or the data api unreached.
|
|
2104
|
-
*/
|
|
2105
|
-
function sendReport(body) {
|
|
2106
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2107
|
-
console.debug('sendReport()', body);
|
|
2108
|
-
return Post(`${urls.reports.trigger.v1}/tenant-reports`, body);
|
|
2109
|
-
});
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
|
-
var reports = /*#__PURE__*/Object.freeze({
|
|
2113
|
-
__proto__: null,
|
|
2114
|
-
getReports: getReports,
|
|
2115
|
-
getReport: getReport,
|
|
2116
|
-
renderReport: renderReport,
|
|
2117
|
-
scheduleReport: scheduleReport,
|
|
2118
|
-
downloadReport: downloadReport,
|
|
2119
|
-
sendReport: sendReport
|
|
2120
|
-
});
|
|
2121
|
-
|
|
2122
|
-
/**
|
|
2123
|
-
* get Notifications
|
|
2124
|
-
*/
|
|
2125
|
-
function getNotifications(params) {
|
|
2126
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2127
|
-
console.debug('getNotifications()');
|
|
2128
|
-
return Get(urls.notifications.v1, { params });
|
|
2129
|
-
});
|
|
2130
|
-
}
|
|
2131
|
-
/**
|
|
2132
|
-
* update Notification status
|
|
2133
|
-
*/
|
|
2134
|
-
function updateNotificationStatus(params) {
|
|
2135
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2136
|
-
console.debug('getNotifications()');
|
|
2137
|
-
return Put(`${urls.notifications.v1}/status`, { params });
|
|
2138
|
-
});
|
|
2139
|
-
}
|
|
2140
|
-
/**
|
|
2141
|
-
* update Notification pin status
|
|
2142
|
-
*/
|
|
2143
|
-
function updateNotificationIsPinned(params) {
|
|
2144
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2145
|
-
const { notificationId, pinStatus } = params;
|
|
2146
|
-
console.debug('getNotifications()');
|
|
2147
|
-
return Put(`${urls.notifications.v1}/${pinStatus}`, { notificationId });
|
|
2148
|
-
});
|
|
2149
|
-
}
|
|
2150
|
-
/**
|
|
2151
|
-
* mark all notifications as read
|
|
2152
|
-
*/
|
|
2153
|
-
function markAllAsRead() {
|
|
2154
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2155
|
-
console.debug('getNotifications()');
|
|
2156
|
-
return Post(`${urls.notifications.v1}/status/mark-all-read`);
|
|
2157
|
-
});
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
var notifications = /*#__PURE__*/Object.freeze({
|
|
2161
|
-
__proto__: null,
|
|
2162
|
-
getNotifications: getNotifications,
|
|
2163
|
-
updateNotificationStatus: updateNotificationStatus,
|
|
2164
|
-
updateNotificationIsPinned: updateNotificationIsPinned,
|
|
2165
|
-
markAllAsRead: markAllAsRead
|
|
2166
|
-
});
|
|
2167
|
-
|
|
2168
|
-
/*****************************************
|
|
2169
|
-
* Audits Api
|
|
2170
|
-
*****************************************/
|
|
2171
|
-
/**
|
|
2172
|
-
* get Audits
|
|
2173
|
-
*/
|
|
2174
|
-
function getAudits(params) {
|
|
2175
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2176
|
-
console.debug('getAudits()');
|
|
2177
|
-
return Get(urls.audits.v1, params);
|
|
2178
|
-
});
|
|
2179
|
-
}
|
|
2180
|
-
/**
|
|
2181
|
-
* get Audits Stats
|
|
2182
|
-
*/
|
|
2183
|
-
function getAuditsStats(params) {
|
|
2184
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2185
|
-
console.debug('getAuditsStats()');
|
|
2186
|
-
return Get(`${urls.audits.v1}/stats`, params);
|
|
2187
|
-
});
|
|
2188
|
-
}
|
|
2189
|
-
/**
|
|
2190
|
-
* export Audits
|
|
2191
|
-
*/
|
|
2192
|
-
function exportAudits(params) {
|
|
2193
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2194
|
-
const { endpoint, headerProps } = params, restParams = __rest(params, ["endpoint", "headerProps"]);
|
|
2195
|
-
return PostDownload(`${urls.audits.v1}/export/${endpoint}`, { properties: headerProps }, restParams);
|
|
2196
|
-
});
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
var audits = /*#__PURE__*/Object.freeze({
|
|
2200
|
-
__proto__: null,
|
|
2201
|
-
getAudits: getAudits,
|
|
2202
|
-
getAuditsStats: getAuditsStats,
|
|
2203
|
-
exportAudits: exportAudits
|
|
2204
|
-
});
|
|
2205
|
-
|
|
2206
|
-
const getSlackConfiguration = () => {
|
|
2207
|
-
console.debug('getSlackConfiguration()');
|
|
2208
|
-
return Get(`${urls.integrations.configurations.v1}/slack`);
|
|
2209
|
-
};
|
|
2210
|
-
const getSlackScope = () => {
|
|
2211
|
-
console.debug('getSlackScope()');
|
|
2212
|
-
return Get(`${urls.integrations.configurations.v1}/slack/applications`);
|
|
2213
|
-
};
|
|
2214
|
-
const getSlackChannels = () => {
|
|
2215
|
-
console.debug('getSlackChannels()');
|
|
2216
|
-
return Get(`${urls.integrations.configurations.v1}/slack/channels`);
|
|
2217
|
-
};
|
|
2218
|
-
const postSlackConfiguration = (data) => {
|
|
2219
|
-
console.debug('postSlackConfiguration()', data);
|
|
2220
|
-
if (data.id) {
|
|
2221
|
-
return Patch(`${urls.integrations.configurations.v1}/slack/subscription/${data.id}`, data);
|
|
2222
|
-
}
|
|
2223
|
-
return Post(`${urls.integrations.configurations.v1}/slack/subscriptions`, data);
|
|
2224
|
-
};
|
|
2225
|
-
const deleteSlackConfiguration = (data) => {
|
|
2226
|
-
console.debug('deleteSlackConfiguration()', data);
|
|
2227
|
-
return Delete(`${urls.integrations.configurations.v1}/slack/subscriptions/${data.id}`);
|
|
2228
|
-
};
|
|
2229
|
-
const postSlackCode = (code) => {
|
|
2230
|
-
console.debug('postSlackCode()', { code });
|
|
2231
|
-
return Post(`${urls.integrations.configurations.v1}/slack/applications/registrations`, { code });
|
|
2232
|
-
};
|
|
2233
|
-
const getEmailConfiguration = () => {
|
|
2234
|
-
console.debug('getEmailConfiguration()');
|
|
2235
|
-
return Get(`${urls.integrations.configurations.v1}/emails`);
|
|
2236
|
-
};
|
|
2237
|
-
const postEmailConfiguration = (_a) => {
|
|
2238
|
-
var { eventKey } = _a, data = __rest(_a, ["eventKey"]);
|
|
2239
|
-
console.debug('postEmailConfiguration()', Object.assign(Object.assign({}, data), { eventKey }));
|
|
2240
|
-
return Post(`${urls.integrations.configurations.v1}/emails/${eventKey}`, data);
|
|
2241
|
-
};
|
|
2242
|
-
const patchEmailConfiguration = ({ eventKey, enabled, }) => {
|
|
2243
|
-
console.debug('patchEmailConfiguration()', { eventKey, enabled });
|
|
2244
|
-
return Patch(`${urls.integrations.configurations.v1}/emails/${eventKey}`, { enabled });
|
|
2245
|
-
};
|
|
2246
|
-
const deleteEmailSubscriptions = (eventKey, subscriptionId) => {
|
|
2247
|
-
console.debug('deleteEmailSubscriptions()', { eventKey, subscriptionId });
|
|
2248
|
-
return Delete(`${urls.integrations.configurations.v1}/emails/${eventKey}/subscriptions/${subscriptionId}`);
|
|
2249
|
-
};
|
|
2250
|
-
const putEmailSubscriptions = (subscriptionId, eventKey, data) => {
|
|
2251
|
-
console.debug('putEmailSubscriptions()', Object.assign(Object.assign({}, data), { subscriptionId, eventKey }));
|
|
2252
|
-
return Put(`${urls.integrations.configurations.v1}/emails/${eventKey}/subscriptions/${subscriptionId}`, data);
|
|
2253
|
-
};
|
|
2254
|
-
const deleteEmailConfiguration = (eventKey) => {
|
|
2255
|
-
console.debug('deleteEmailConfiguration()', { eventKey });
|
|
2256
|
-
return Delete(`${urls.integrations.configurations.v1}/emails/${eventKey}`);
|
|
2257
|
-
};
|
|
2258
|
-
const getSMSConfiguration = () => {
|
|
2259
|
-
console.debug('getSMSConfiguration()');
|
|
2260
|
-
return Get(`${urls.integrations.configurations.v2}/sms`);
|
|
2261
|
-
};
|
|
2262
|
-
const postSMSConfiguration = (_a) => {
|
|
2263
|
-
var { eventKey } = _a, data = __rest(_a, ["eventKey"]);
|
|
2264
|
-
console.debug('postSMSConfiguration()', Object.assign(Object.assign({}, data), { eventKey }));
|
|
2265
|
-
return Post(`${urls.integrations.configurations.v2}/sms/${eventKey}`, data);
|
|
2266
|
-
};
|
|
2267
|
-
const patchSMSConfiguration = ({ eventKey, enabled, }) => {
|
|
2268
|
-
console.debug('patchSMSConfiguration()', { eventKey, enabled });
|
|
2269
|
-
return Patch(`${urls.integrations.configurations.v2}/sms/${eventKey}`, { enabled });
|
|
2270
|
-
};
|
|
2271
|
-
const deleteSMSSubscriptions = (eventKey, subscriptionId) => {
|
|
2272
|
-
console.debug('deleteSMSSubscriptions()', { eventKey, subscriptionId });
|
|
2273
|
-
return Delete(`${urls.integrations.configurations.v2}/sms/${eventKey}/subscriptions/${subscriptionId}`);
|
|
2274
|
-
};
|
|
2275
|
-
const putSMSSubscriptions = (subscriptionId, eventKey, data) => {
|
|
2276
|
-
console.debug('putSMSSubscriptions()', Object.assign(Object.assign({}, data), { subscriptionId, eventKey }));
|
|
2277
|
-
return Put(`${urls.integrations.configurations.v2}/sms/${eventKey}/subscriptions/${subscriptionId}`, data);
|
|
2278
|
-
};
|
|
2279
|
-
const deleteSMSConfiguration = (eventKey) => {
|
|
2280
|
-
console.debug('deleteSMSConfiguration()', { eventKey });
|
|
2281
|
-
return Delete(`${urls.integrations.configurations.v2}/sms/${eventKey}`);
|
|
2282
|
-
};
|
|
2283
|
-
const getWebhooksConfigurations = () => {
|
|
2284
|
-
console.debug('getWebhooksConfigurations()');
|
|
2285
|
-
return Get(urls.webhooks.v1);
|
|
2286
|
-
};
|
|
2287
|
-
const postWebhooksConfiguration = (data) => {
|
|
2288
|
-
console.debug('postWebhooksConfiguration()', data);
|
|
2289
|
-
if (data._id) {
|
|
2290
|
-
return Patch(`${urls.webhooks.v1}/${data._id}`, data);
|
|
2291
|
-
}
|
|
2292
|
-
else {
|
|
2293
|
-
return Post(`${urls.webhooks.v1}/custom`, data);
|
|
2294
|
-
}
|
|
2295
|
-
};
|
|
2296
|
-
const deleteWebhooksConfiguration = (id) => {
|
|
2297
|
-
console.debug('deleteWebhooksConfiguration()', id);
|
|
2298
|
-
return Delete(`${urls.webhooks.v1}/${id}`);
|
|
2299
|
-
};
|
|
2300
|
-
const getWebhookLog = (id, offset = 0, limit = 10) => {
|
|
2301
|
-
console.debug('getWebhookLog()', id);
|
|
2302
|
-
const query = new URLSearchParams({ id, offset: `${offset}`, limit: `${limit}` });
|
|
2303
|
-
return Get(`${urls.webhooks.v1}/logs/?${query.toString()}`);
|
|
2304
|
-
};
|
|
2305
|
-
const postWebhookTest = (data) => {
|
|
2306
|
-
console.debug('postWebhookTest', data);
|
|
2307
|
-
return Post(`${urls.webhooks.v1}/test`, data);
|
|
2308
|
-
};
|
|
2309
|
-
const postWebhookRetry = (id) => {
|
|
2310
|
-
console.debug('postWebhookRetry', id);
|
|
2311
|
-
return Post(`${urls.webhooks.v1}/logs/${id}/retries`);
|
|
2312
|
-
};
|
|
2313
|
-
const getCategories = () => {
|
|
2314
|
-
console.debug('getCategories()');
|
|
2315
|
-
return Get(`${urls.events.configurations.v1}/categories`);
|
|
2316
|
-
};
|
|
2317
|
-
const getChannelMaps = (channels) => {
|
|
2318
|
-
console.debug('getChannelMaps()', channels);
|
|
2319
|
-
return Get(urls.events.configurations.v1, { channels });
|
|
2320
|
-
};
|
|
2321
|
-
|
|
2322
|
-
var connectivity = /*#__PURE__*/Object.freeze({
|
|
2323
|
-
__proto__: null,
|
|
2324
|
-
getSlackConfiguration: getSlackConfiguration,
|
|
2325
|
-
getSlackScope: getSlackScope,
|
|
2326
|
-
getSlackChannels: getSlackChannels,
|
|
2327
|
-
postSlackConfiguration: postSlackConfiguration,
|
|
2328
|
-
deleteSlackConfiguration: deleteSlackConfiguration,
|
|
2329
|
-
postSlackCode: postSlackCode,
|
|
2330
|
-
getEmailConfiguration: getEmailConfiguration,
|
|
2331
|
-
postEmailConfiguration: postEmailConfiguration,
|
|
2332
|
-
patchEmailConfiguration: patchEmailConfiguration,
|
|
2333
|
-
deleteEmailSubscriptions: deleteEmailSubscriptions,
|
|
2334
|
-
putEmailSubscriptions: putEmailSubscriptions,
|
|
2335
|
-
deleteEmailConfiguration: deleteEmailConfiguration,
|
|
2336
|
-
getSMSConfiguration: getSMSConfiguration,
|
|
2337
|
-
postSMSConfiguration: postSMSConfiguration,
|
|
2338
|
-
patchSMSConfiguration: patchSMSConfiguration,
|
|
2339
|
-
deleteSMSSubscriptions: deleteSMSSubscriptions,
|
|
2340
|
-
putSMSSubscriptions: putSMSSubscriptions,
|
|
2341
|
-
deleteSMSConfiguration: deleteSMSConfiguration,
|
|
2342
|
-
getWebhooksConfigurations: getWebhooksConfigurations,
|
|
2343
|
-
postWebhooksConfiguration: postWebhooksConfiguration,
|
|
2344
|
-
deleteWebhooksConfiguration: deleteWebhooksConfiguration,
|
|
2345
|
-
getWebhookLog: getWebhookLog,
|
|
2346
|
-
postWebhookTest: postWebhookTest,
|
|
2347
|
-
postWebhookRetry: postWebhookRetry,
|
|
2348
|
-
getCategories: getCategories,
|
|
2349
|
-
getChannelMaps: getChannelMaps
|
|
2350
|
-
});
|
|
2351
|
-
|
|
2352
|
-
/*** update account settings for tenant.
|
|
2353
|
-
* tenantId is caclulated in the backend from context
|
|
2354
|
-
* ``authorized user``
|
|
2355
|
-
*/
|
|
2356
|
-
function updateSettings(body) {
|
|
2357
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2358
|
-
console.debug('updateSettings()', body);
|
|
2359
|
-
return Put(urls.tenants.accountSettings.v1, body);
|
|
2360
|
-
});
|
|
2361
|
-
}
|
|
2362
|
-
function getSettings() {
|
|
2363
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2364
|
-
console.debug('getSettings()');
|
|
2365
|
-
return Get(urls.tenants.accountSettings.v1);
|
|
2366
|
-
});
|
|
2367
|
-
}
|
|
2368
|
-
|
|
2369
|
-
var accountSettings = /*#__PURE__*/Object.freeze({
|
|
2370
|
-
__proto__: null,
|
|
2371
|
-
updateSettings: updateSettings,
|
|
2372
|
-
getSettings: getSettings
|
|
2373
|
-
});
|
|
2374
|
-
|
|
2375
|
-
/**
|
|
2376
|
-
* Gets tenant related roles
|
|
2377
|
-
*/
|
|
2378
|
-
function getRoles() {
|
|
2379
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2380
|
-
console.debug('getRoles()');
|
|
2381
|
-
return Get(urls.identity.roles.v1);
|
|
2382
|
-
});
|
|
2383
|
-
}
|
|
2384
|
-
/**
|
|
2385
|
-
* Adds tenant related roles
|
|
2386
|
-
* @param body: IAddRole
|
|
2387
|
-
*/
|
|
2388
|
-
function addRole(body) {
|
|
2389
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2390
|
-
console.debug('addRole()', body);
|
|
2391
|
-
return Post(urls.identity.roles.v1, body);
|
|
2392
|
-
});
|
|
2393
|
-
}
|
|
2394
|
-
/**
|
|
2395
|
-
* Deletes role given role ID
|
|
2396
|
-
*/
|
|
2397
|
-
function deleteRole({ roleId }) {
|
|
2398
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2399
|
-
console.debug('deleteRole()', roleId);
|
|
2400
|
-
return Delete(`${urls.identity.roles.v1}/${roleId}`);
|
|
2401
|
-
});
|
|
2402
|
-
}
|
|
2403
|
-
/**
|
|
2404
|
-
* Updates role using a given role ID and IUpdateRole object
|
|
2405
|
-
*/
|
|
2406
|
-
function updateRole(_a) {
|
|
2407
|
-
var { roleId } = _a, body = __rest(_a, ["roleId"]);
|
|
2408
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2409
|
-
console.debug('updateRole()', roleId, body);
|
|
2410
|
-
return Patch(`${urls.identity.roles.v1}/${roleId}`, body);
|
|
2411
|
-
});
|
|
2412
|
-
}
|
|
2413
|
-
/**
|
|
2414
|
-
* Attaches permissions to role given a role ID
|
|
2415
|
-
*/
|
|
2416
|
-
function attachPermissionsToRole(_a) {
|
|
2417
|
-
var { roleId } = _a, body = __rest(_a, ["roleId"]);
|
|
2418
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2419
|
-
console.debug('attachPermissionsToRole()', roleId, body);
|
|
2420
|
-
return Put(`${urls.identity.roles.v1}/${roleId}/permissions`, body);
|
|
2421
|
-
});
|
|
2422
|
-
}
|
|
2423
|
-
/**
|
|
2424
|
-
* Gets all vendor permissions
|
|
2425
|
-
*/
|
|
2426
|
-
function getPermissions() {
|
|
2427
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2428
|
-
console.debug('getPermissions()');
|
|
2429
|
-
return Get(urls.identity.permissions.v1);
|
|
2430
|
-
});
|
|
2431
|
-
}
|
|
2432
|
-
/**
|
|
2433
|
-
* Associate permission to roles
|
|
2434
|
-
*/
|
|
2435
|
-
function attachPermissionToRoles(_a) {
|
|
2436
|
-
var { permissionId } = _a, body = __rest(_a, ["permissionId"]);
|
|
2437
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2438
|
-
console.debug('attachPermissionToRoles()');
|
|
2439
|
-
return Put(`${urls.identity.permissions.v1}/${permissionId}/roles`, body);
|
|
2440
|
-
});
|
|
2441
|
-
}
|
|
2442
|
-
/**
|
|
2443
|
-
* Gets all vendor categories including the permissions
|
|
2444
|
-
*/
|
|
2445
|
-
function getPermissionCategories() {
|
|
2446
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2447
|
-
console.debug('getPermissionCategories()');
|
|
2448
|
-
return Get(`${urls.identity.permissions.v1}/categories`);
|
|
2449
|
-
});
|
|
2450
|
-
}
|
|
2451
|
-
|
|
2452
|
-
var roles = /*#__PURE__*/Object.freeze({
|
|
2453
|
-
__proto__: null,
|
|
2454
|
-
getRoles: getRoles,
|
|
2455
|
-
addRole: addRole,
|
|
2456
|
-
deleteRole: deleteRole,
|
|
2457
|
-
updateRole: updateRole,
|
|
2458
|
-
attachPermissionsToRole: attachPermissionsToRole,
|
|
2459
|
-
getPermissions: getPermissions,
|
|
2460
|
-
attachPermissionToRoles: attachPermissionToRoles,
|
|
2461
|
-
getPermissionCategories: getPermissionCategories
|
|
2462
|
-
});
|
|
2463
|
-
|
|
2464
|
-
/**
|
|
2465
|
-
* Get tenant subscriptions
|
|
2466
|
-
*/
|
|
2467
|
-
function getSubscriptions() {
|
|
2468
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2469
|
-
console.debug("getSubscriptions()");
|
|
2470
|
-
return Get(urls.subscriptions.billing.subscriptions.v1);
|
|
2471
|
-
});
|
|
2472
|
-
}
|
|
2473
|
-
/**
|
|
2474
|
-
* Get tenant subscription
|
|
2475
|
-
*/
|
|
2476
|
-
function getSubscription(subscriptionId) {
|
|
2477
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2478
|
-
console.debug("getSubscription()", { subscriptionId });
|
|
2479
|
-
return Get(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`);
|
|
2480
|
-
});
|
|
2481
|
-
}
|
|
2482
|
-
/**
|
|
2483
|
-
* Cancel tenant subscription
|
|
2484
|
-
*/
|
|
2485
|
-
function cancelSubscription(subscriptionId) {
|
|
2486
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2487
|
-
console.debug("cancelSubscription()", { subscriptionId });
|
|
2488
|
-
return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/cancellations/`, {});
|
|
2489
|
-
});
|
|
2490
|
-
}
|
|
2491
|
-
/**
|
|
2492
|
-
* Renew tenant subscription
|
|
2493
|
-
*/
|
|
2494
|
-
function renewSubscription(subscriptionId) {
|
|
2495
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2496
|
-
console.debug("renewSubscription()", { subscriptionId });
|
|
2497
|
-
return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/renewals/`, {});
|
|
2498
|
-
});
|
|
2499
|
-
}
|
|
2500
|
-
/**
|
|
2501
|
-
* Upgrade/Downgrade tenant subscription plan
|
|
2502
|
-
*/
|
|
2503
|
-
function updateSubscription(subscriptionId, { paymentMethodId, planId }) {
|
|
2504
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2505
|
-
console.debug("updateSubscription()", { subscriptionId });
|
|
2506
|
-
return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, { paymentMethodId, planId });
|
|
2507
|
-
});
|
|
2508
|
-
}
|
|
2509
|
-
|
|
2510
|
-
function getManagedSubscription(subscriptionId) {
|
|
2511
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2512
|
-
console.debug('getManagedSubscription()', { subscriptionId });
|
|
2513
|
-
return Get(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`);
|
|
2514
|
-
});
|
|
2515
|
-
}
|
|
2516
|
-
function getManagedSubscriptions() {
|
|
2517
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2518
|
-
console.debug('getManagedSubscriptions()');
|
|
2519
|
-
return Get(`${urls.subscriptions.managedSubscriptions.v1}`);
|
|
2520
|
-
});
|
|
2521
|
-
}
|
|
2522
|
-
/**
|
|
2523
|
-
* Cancel tenant subscription
|
|
2524
|
-
*/
|
|
2525
|
-
function cancelManagedSubscription(subscriptionId) {
|
|
2526
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2527
|
-
console.debug("cancelManagedSubscription()", { subscriptionId });
|
|
2528
|
-
return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/cancellations/`, {});
|
|
2529
|
-
});
|
|
2530
|
-
}
|
|
2531
|
-
/**
|
|
2532
|
-
* Renew tenant subscription
|
|
2533
|
-
*/
|
|
2534
|
-
function renewManagedSubscription(subscriptionId) {
|
|
2535
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2536
|
-
console.debug("renewManagedSubscription()", { subscriptionId });
|
|
2537
|
-
return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/renewals/`, {});
|
|
2538
|
-
});
|
|
2539
|
-
}
|
|
2540
|
-
/**
|
|
2541
|
-
* Upgrade/Downgrade tenant subscription plan
|
|
2542
|
-
*/
|
|
2543
|
-
function updateManagedSubscription(subscriptionId, { paymentMethodId, planId }) {
|
|
2544
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2545
|
-
console.debug("updateManagedSubscription()", { subscriptionId });
|
|
2546
|
-
return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`, { paymentMethodId, planId });
|
|
2547
|
-
});
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
|
-
/**
|
|
2551
|
-
* Gets subscription plans
|
|
2552
|
-
*/
|
|
2553
|
-
function getSubscriptionPlans() {
|
|
2554
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2555
|
-
console.debug('getSubscriptionPlans()');
|
|
2556
|
-
return Get(urls.subscriptions.billing.plans.v1);
|
|
2557
|
-
});
|
|
2558
|
-
}
|
|
2559
|
-
/**
|
|
2560
|
-
* Gets subscription plan singular
|
|
2561
|
-
*/
|
|
2562
|
-
function getSubscriptionPlan(planId) {
|
|
2563
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2564
|
-
console.debug('getSubscriptionPlan()');
|
|
2565
|
-
return Get(`${urls.subscriptions.billing.plans.v1}/${planId}`);
|
|
2566
|
-
});
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
|
-
/**
|
|
2570
|
-
* Get subscription invoices
|
|
2571
|
-
*/
|
|
2572
|
-
function getSubscriptionInvoices() {
|
|
2573
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2574
|
-
console.debug("getSubscriptionInvoices()");
|
|
2575
|
-
return Get(urls.subscriptions.billing.invoices.v1);
|
|
2576
|
-
});
|
|
2577
|
-
}
|
|
2578
|
-
/**
|
|
2579
|
-
* Get subscription invoice
|
|
2580
|
-
*/
|
|
2581
|
-
function getSubscriptionInvoice(invoiceId) {
|
|
2582
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2583
|
-
console.debug("getSubscriptionInvoice()", { invoiceId });
|
|
2584
|
-
return Get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}`);
|
|
2585
|
-
});
|
|
2586
|
-
}
|
|
2587
|
-
/**
|
|
2588
|
-
* Get subscription invoice pdf file
|
|
2589
|
-
*/
|
|
2590
|
-
function getSubscriptionInvoicePdf(invoiceId, outputFileName) {
|
|
2591
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2592
|
-
console.debug("getSubscriptionInvoicePdf()", { invoiceId });
|
|
2593
|
-
return Get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}/pdf`, {
|
|
2594
|
-
outputFileName,
|
|
2595
|
-
}, {
|
|
2596
|
-
responseType: "blob",
|
|
2597
|
-
});
|
|
2598
|
-
});
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
|
-
/**
|
|
2602
|
-
* Get payment methods
|
|
2603
|
-
*/
|
|
2604
|
-
function getPaymentMethods() {
|
|
2605
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2606
|
-
console.debug("getPaymentMethods()");
|
|
2607
|
-
return Get(urls.subscriptions.billing.paymentMethods.v1);
|
|
2608
|
-
});
|
|
2609
|
-
}
|
|
2610
|
-
/**
|
|
2611
|
-
* Get payment method
|
|
2612
|
-
*/
|
|
2613
|
-
function getPaymentMethod(paymentMethodId) {
|
|
2614
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2615
|
-
console.debug("getPaymentMethod()", { paymentMethodId });
|
|
2616
|
-
return Get(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}`);
|
|
2617
|
-
});
|
|
2618
|
-
}
|
|
2619
|
-
/**
|
|
2620
|
-
* Update payment method billing details
|
|
2621
|
-
*/
|
|
2622
|
-
function updatePaymentMethodBillingDetails(paymentMethodId, _a) {
|
|
2623
|
-
var { email } = _a, address = __rest(_a, ["email"]);
|
|
2624
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2625
|
-
console.debug("updatePaymentMethodBillingDetails()", {
|
|
2626
|
-
paymentMethodId,
|
|
2627
|
-
email,
|
|
2628
|
-
address,
|
|
2629
|
-
});
|
|
2630
|
-
return Patch(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}/billing-details`, { email, address });
|
|
2631
|
-
});
|
|
2632
|
-
}
|
|
2633
|
-
|
|
2634
|
-
/**
|
|
2635
|
-
* Creates new stripe subscription
|
|
2636
|
-
* @param request
|
|
2637
|
-
*/
|
|
2638
|
-
function createSubscription(request) {
|
|
2639
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2640
|
-
console.debug('createSubscription()');
|
|
2641
|
-
return Post(urls.subscriptions.billing.paymentProviders.stripe.subscriptions.v1, request);
|
|
2642
|
-
});
|
|
2643
|
-
}
|
|
2644
|
-
/**
|
|
2645
|
-
* Fetch tenant mapping external stripe customer object
|
|
2646
|
-
*/
|
|
2647
|
-
function getStripeCustomer(tenantId) {
|
|
2648
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2649
|
-
console.debug('getStripeCustomer()');
|
|
2650
|
-
return Get(`${urls.subscriptions.billing.paymentProviders.stripe.customers.v1}/${tenantId}`);
|
|
2651
|
-
});
|
|
2652
|
-
}
|
|
2653
|
-
/**
|
|
2654
|
-
* Create tenant mapping external stripe customer object
|
|
2655
|
-
* @param request
|
|
2656
|
-
*/
|
|
2657
|
-
function createStripeCustomer(request) {
|
|
2658
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2659
|
-
console.debug('createStripeCustomer()');
|
|
2660
|
-
return Post(`${urls.subscriptions.billing.paymentProviders.stripe.customers.v1}`, request);
|
|
2661
|
-
});
|
|
2662
|
-
}
|
|
2663
|
-
function getStripePaymentProviderConfiguration() {
|
|
2664
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2665
|
-
console.debug('getStripePaymentProviderConfiguration()');
|
|
2666
|
-
return Get(`${urls.subscriptions.billing.paymentProviders.stripe.publicConfigurations.v1}`);
|
|
2667
|
-
});
|
|
2668
|
-
}
|
|
2669
|
-
/**
|
|
2670
|
-
* Create payment method intent secret
|
|
2671
|
-
* @param request
|
|
2672
|
-
*/
|
|
2673
|
-
function createStripePaymentMethodSetupIntentSecret(request) {
|
|
2674
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2675
|
-
console.debug('createStripePaymentMethodSetupIntentSecret()');
|
|
2676
|
-
return Post(`${urls.subscriptions.billing.paymentProviders.stripe.setupIntents.v1}`, request);
|
|
2677
|
-
});
|
|
2678
|
-
}
|
|
2679
|
-
|
|
2680
|
-
/**
|
|
2681
|
-
* Gets subscription summaries
|
|
2682
|
-
*/
|
|
2683
|
-
function getSubscriptionSummaries(tenantId) {
|
|
2684
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2685
|
-
console.debug('getSubscriptionSummaries()');
|
|
2686
|
-
return Get(`${urls.subscriptions.billing.summaries.v1}/${tenantId}`);
|
|
2687
|
-
});
|
|
2688
|
-
}
|
|
2689
|
-
|
|
2690
|
-
function getTenantConfiguration(tenantId) {
|
|
2691
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2692
|
-
console.debug("getTenantConfiguration()");
|
|
2693
|
-
return Get(`${urls.subscriptions.billing.tenantConfiguration.v1}/${tenantId}`);
|
|
2694
|
-
});
|
|
2695
|
-
}
|
|
2696
|
-
function createTenantConfiguration(request) {
|
|
2697
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2698
|
-
console.debug("createTenantConfiguration()");
|
|
2699
|
-
return Post(`${urls.subscriptions.billing.tenantConfiguration.v1}`, request);
|
|
2700
|
-
});
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
|
-
/**
|
|
2704
|
-
* Gets payment providers for vendor
|
|
2705
|
-
*/
|
|
2706
|
-
function getPaymentProviders() {
|
|
2707
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2708
|
-
console.debug("getPaymentProviders()");
|
|
2709
|
-
return Get(urls.subscriptions.paymentProviders.v1);
|
|
2710
|
-
});
|
|
2711
|
-
}
|
|
2712
|
-
|
|
2713
|
-
exports.ISubscriptionStatus = void 0;
|
|
2714
|
-
(function (ISubscriptionStatus) {
|
|
2715
|
-
ISubscriptionStatus["ACTIVE"] = "active";
|
|
2716
|
-
ISubscriptionStatus["CANCELED"] = "canceled";
|
|
2717
|
-
ISubscriptionStatus["INCOMPLETE"] = "incomplete";
|
|
2718
|
-
ISubscriptionStatus["EXPIRED"] = "expired";
|
|
2719
|
-
ISubscriptionStatus["TRIALING"] = "trialing";
|
|
2720
|
-
ISubscriptionStatus["TRIAL_ENDED"] = "trialEnded";
|
|
2721
|
-
})(exports.ISubscriptionStatus || (exports.ISubscriptionStatus = {}));
|
|
2722
|
-
exports.PaymentMethodType = void 0;
|
|
2723
|
-
(function (PaymentMethodType) {
|
|
2724
|
-
PaymentMethodType["UNKNWON"] = "unknown";
|
|
2725
|
-
PaymentMethodType["CARD"] = "card";
|
|
2726
|
-
})(exports.PaymentMethodType || (exports.PaymentMethodType = {}));
|
|
2727
|
-
exports.ISubscriptionCancellationPolicy = void 0;
|
|
2728
|
-
(function (ISubscriptionCancellationPolicy) {
|
|
2729
|
-
ISubscriptionCancellationPolicy["AT_PERIOD_END"] = "atPeriodEnd";
|
|
2730
|
-
})(exports.ISubscriptionCancellationPolicy || (exports.ISubscriptionCancellationPolicy = {}));
|
|
2731
|
-
exports.ProviderType = void 0;
|
|
2732
|
-
(function (ProviderType) {
|
|
2733
|
-
ProviderType["Stripe"] = "Stripe";
|
|
2734
|
-
})(exports.ProviderType || (exports.ProviderType = {}));
|
|
2735
|
-
|
|
2736
|
-
var subscriptions = /*#__PURE__*/Object.freeze({
|
|
2737
|
-
__proto__: null,
|
|
2738
|
-
getSubscriptions: getSubscriptions,
|
|
2739
|
-
getSubscription: getSubscription,
|
|
2740
|
-
cancelSubscription: cancelSubscription,
|
|
2741
|
-
renewSubscription: renewSubscription,
|
|
2742
|
-
updateSubscription: updateSubscription,
|
|
2743
|
-
getManagedSubscription: getManagedSubscription,
|
|
2744
|
-
getManagedSubscriptions: getManagedSubscriptions,
|
|
2745
|
-
cancelManagedSubscription: cancelManagedSubscription,
|
|
2746
|
-
renewManagedSubscription: renewManagedSubscription,
|
|
2747
|
-
updateManagedSubscription: updateManagedSubscription,
|
|
2748
|
-
getSubscriptionPlans: getSubscriptionPlans,
|
|
2749
|
-
getSubscriptionPlan: getSubscriptionPlan,
|
|
2750
|
-
getSubscriptionInvoices: getSubscriptionInvoices,
|
|
2751
|
-
getSubscriptionInvoice: getSubscriptionInvoice,
|
|
2752
|
-
getSubscriptionInvoicePdf: getSubscriptionInvoicePdf,
|
|
2753
|
-
getPaymentMethods: getPaymentMethods,
|
|
2754
|
-
getPaymentMethod: getPaymentMethod,
|
|
2755
|
-
updatePaymentMethodBillingDetails: updatePaymentMethodBillingDetails,
|
|
2756
|
-
createSubscription: createSubscription,
|
|
2757
|
-
getStripeCustomer: getStripeCustomer,
|
|
2758
|
-
createStripeCustomer: createStripeCustomer,
|
|
2759
|
-
getStripePaymentProviderConfiguration: getStripePaymentProviderConfiguration,
|
|
2760
|
-
createStripePaymentMethodSetupIntentSecret: createStripePaymentMethodSetupIntentSecret,
|
|
2761
|
-
getSubscriptionSummaries: getSubscriptionSummaries,
|
|
2762
|
-
getTenantConfiguration: getTenantConfiguration,
|
|
2763
|
-
createTenantConfiguration: createTenantConfiguration,
|
|
2764
|
-
getPaymentProviders: getPaymentProviders,
|
|
2765
|
-
get ISubscriptionStatus () { return exports.ISubscriptionStatus; },
|
|
2766
|
-
get PaymentMethodType () { return exports.PaymentMethodType; },
|
|
2767
|
-
get ISubscriptionCancellationPolicy () { return exports.ISubscriptionCancellationPolicy; },
|
|
2768
|
-
get ProviderType () { return exports.ProviderType; }
|
|
2769
|
-
});
|
|
2770
|
-
|
|
2771
|
-
/**
|
|
2772
|
-
* provide vendor public info by providing the vendor context.
|
|
2773
|
-
* @return IVendorPublicInfoResponse
|
|
2774
|
-
*/
|
|
2775
|
-
function getVendorPublicInfo() {
|
|
2776
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2777
|
-
console.debug('getVendorPublicInfo()');
|
|
2778
|
-
return Get(`${urls.vendor}/public`);
|
|
2779
|
-
});
|
|
2780
|
-
}
|
|
2781
|
-
|
|
2782
|
-
var vendor = /*#__PURE__*/Object.freeze({
|
|
2783
|
-
__proto__: null,
|
|
2784
|
-
getVendorPublicInfo: getVendorPublicInfo
|
|
2785
|
-
});
|
|
2786
|
-
|
|
2787
|
-
function loadAllUsers(params) {
|
|
2788
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2789
|
-
return Get(urls.identity.subTenants.v1, params);
|
|
2790
|
-
});
|
|
2791
|
-
}
|
|
2792
|
-
function addUserToTenantAndSubTenants(body) {
|
|
2793
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2794
|
-
return Post(urls.identity.subTenants.v1, body);
|
|
2795
|
-
});
|
|
2796
|
-
}
|
|
2797
|
-
function removeUserFromTenantAndSubTenants(body) {
|
|
2798
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2799
|
-
return Delete(urls.identity.subTenants.v1, body);
|
|
2800
|
-
});
|
|
2801
|
-
}
|
|
2802
|
-
function addUserRolesForSubTenants(userId, body) {
|
|
2803
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2804
|
-
return Post(`${urls.identity.subTenants.v1}/${userId}/roles`, body);
|
|
2805
|
-
});
|
|
2806
|
-
}
|
|
2807
|
-
function removeUserRolesFromSubTenants(userId, body) {
|
|
2808
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2809
|
-
return Delete(`${urls.identity.subTenants.v1}/${userId}/roles`, body);
|
|
2810
|
-
});
|
|
2811
|
-
}
|
|
2812
|
-
function setUserRolesForSubTenants(userId, body) {
|
|
2813
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2814
|
-
return Patch(`${urls.identity.subTenants.v1}/${userId}/roles`, body);
|
|
2815
|
-
});
|
|
2816
|
-
}
|
|
2817
|
-
|
|
2818
|
-
var subTenants = /*#__PURE__*/Object.freeze({
|
|
2819
|
-
__proto__: null,
|
|
2820
|
-
loadAllUsers: loadAllUsers,
|
|
2821
|
-
addUserToTenantAndSubTenants: addUserToTenantAndSubTenants,
|
|
2822
|
-
removeUserFromTenantAndSubTenants: removeUserFromTenantAndSubTenants,
|
|
2823
|
-
addUserRolesForSubTenants: addUserRolesForSubTenants,
|
|
2824
|
-
removeUserRolesFromSubTenants: removeUserRolesFromSubTenants,
|
|
2825
|
-
setUserRolesForSubTenants: setUserRolesForSubTenants
|
|
2826
|
-
});
|
|
2827
|
-
|
|
2828
|
-
exports.SecondaryAuthStrategy = void 0;
|
|
2829
|
-
(function (SecondaryAuthStrategy) {
|
|
2830
|
-
SecondaryAuthStrategy["WebAuthnPlatform"] = "WebAuthnPlatform";
|
|
2831
|
-
SecondaryAuthStrategy["WebAuthnCrossPlatform"] = "WebAuthnCrossPlatform";
|
|
2832
|
-
SecondaryAuthStrategy["SmsCode"] = "SmsCode";
|
|
2833
|
-
})(exports.SecondaryAuthStrategy || (exports.SecondaryAuthStrategy = {}));
|
|
2834
|
-
|
|
2835
|
-
const fronteggAuthApiRoutes = [
|
|
2836
|
-
`${urls.identity.auth.v1}/logout`,
|
|
2837
|
-
`${urls.identity.auth.v1}/user/saml/postlogin`,
|
|
2838
|
-
`${urls.identity.auth.v2}/user/oidc/postlogin`,
|
|
2839
|
-
`${urls.identity.auth.v1}/user`,
|
|
2840
|
-
`${urls.identity.auth.v1}/user/mfa/verify`,
|
|
2841
|
-
`${urls.identity.auth.v1}/user/token/refresh`,
|
|
2842
|
-
`${urls.identity.users.v1}`,
|
|
2843
|
-
`${urls.identity.auth.v1}/passwordless/magiclink/postlogin`,
|
|
2844
|
-
`${urls.identity.auth.v1}/passwordless/code/postlogin`,
|
|
2845
|
-
`${urls.identity.auth.v1}/passwordless/smscode/postlogin`,
|
|
2846
|
-
`${urls.identity.users.v1}/activate`,
|
|
2847
|
-
`${urls.identity.users.v1}/invitation/accept`
|
|
2848
|
-
];
|
|
2849
|
-
const fronteggRefreshTokenUrl = `${urls.identity.auth.v1}/user/token/refresh`;
|
|
2850
|
-
|
|
2851
|
-
const api = {
|
|
2852
|
-
auth,
|
|
2853
|
-
teams,
|
|
2854
|
-
metadata,
|
|
2855
|
-
reports,
|
|
2856
|
-
connectivity,
|
|
2857
|
-
notifications,
|
|
2858
|
-
audits,
|
|
2859
|
-
tenants,
|
|
2860
|
-
accountSettings,
|
|
2861
|
-
roles,
|
|
2862
|
-
subscriptions,
|
|
2863
|
-
vendor,
|
|
2864
|
-
subTenants
|
|
2865
|
-
};
|
|
2866
|
-
var index = {
|
|
2867
|
-
fetch: fetch$1,
|
|
2868
|
-
ContextHolder,
|
|
2869
|
-
FronteggContext,
|
|
2870
|
-
api,
|
|
2871
|
-
FronteggApiError,
|
|
2872
|
-
AuthStrategyEnum: exports.AuthStrategyEnum,
|
|
2873
|
-
SocialLoginProviders: exports.SocialLoginProviders,
|
|
2874
|
-
ISubscriptionCancellationPolicy: exports.ISubscriptionCancellationPolicy,
|
|
2875
|
-
ISubscriptionStatus: exports.ISubscriptionStatus,
|
|
2876
|
-
PaymentMethodType: exports.PaymentMethodType,
|
|
2877
|
-
ProviderType: exports.ProviderType,
|
|
2878
|
-
};
|
|
2879
|
-
|
|
2880
|
-
exports.ContextHolder = ContextHolder;
|
|
2881
|
-
exports.FronteggApiError = FronteggApiError;
|
|
2882
|
-
exports.FronteggContext = FronteggContext;
|
|
2883
|
-
exports.api = api;
|
|
2884
|
-
exports.default = index;
|
|
2885
|
-
exports.fetch = fetch$1;
|
|
2886
|
-
exports.fronteggAuthApiRoutes = fronteggAuthApiRoutes;
|
|
2887
|
-
exports.fronteggRefreshTokenUrl = fronteggRefreshTokenUrl;
|
|
2888
|
-
|
|
2889
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2890
|
-
|
|
2891
|
-
})));
|